Skip to content

Commit

Permalink
Merge pull request #183 from Arquisoft/last-fixes-before-3rd-deliver
Browse files Browse the repository at this point in the history
Last fixes
  • Loading branch information
Pelayori authored Apr 8, 2024
2 parents a66f387 + 0510505 commit c8b95e5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 311 deletions.
328 changes: 18 additions & 310 deletions docs/src/08_concepts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Question {
class Category {
- id: Long
- name: String
- description: String
- questions: Set<Question>
+ toString(): String
+ toJson(): JsonNode
Expand All @@ -58,8 +59,16 @@ class GameSession {
- createdAt: LocalDateTime
- finishTime: LocalDateTime
- score: int
- answeredQuestions: Set<Question>
- questionsToAnswer: List<Question>
- currentQuestion: Question
+ addQuestion(correct: boolean): void
+ addAnsweredQuestion(question: Question): void
+ isAnswered(question: Question): boolean
+ getNextQuestion(): Question
+ toJson(): JsonNode
+ hasQuestionId(idQuestion: Long): boolean
+ getDuration(): String
}
class Role {
Expand Down Expand Up @@ -90,316 +99,15 @@ class RestApiAccessLog {
- details: String
}
interface JsonEntity {
+ toJson(): JsonNode
}
interface PlayerService {
+ addNewPlayer(dto: PlayerDto): Player
+ getUsers(): List<Player>
+ getUser(id: Long): Optional<Player>
+ getUserByEmail(email: String): Optional<Player>
+ getUserByUsername(username: String): Optional<Player>
+ getUsersByRole(role: String): List<Player>
+ generateapiKey(player: Player): void
}
interface RoleService {
+ addRole(role: RoleDto): Role
+ getRole(name: String): Role
+ getRoles(): List<Role>
}
interface AnswerService {
+ addNewAnswer(answer: Answer): void
+ getAnswerPerQuestion(question: Question): List<Answer>
+ getAnswer(id: Long): Optional<Answer>
}
interface ApiKeyService {
+ createApiKey(forPlayer: Player): ApiKey
+ getApiKey(apiKey: String): ApiKey
}
interface CategoryService {
+ addNewCategory(category: Category): void
+ getAllCategories(): List<Category>
+ getCategory(id: Long): Optional<Category>
+ getCategoryByName(geography: String): Category
}
interface QuestionService {
+ addNewQuestion(question: Question): void
+ getAllQuestions(): List<Question>
+ getQuestion(id: Long): Optional<Question>
}
interface RestApiService {
+ getPlayers(params: Map<String, String>): List<Player>
+ logAccess(apiKey: ApiKey, path: String, params: Map<String, String>): void
+ getQuestions(params: Map<String, String>): List<Question>
}
class CustomUserDetailsService {
- playerRepository: PlayerRepository
+ loadUserByUsername(username: String): UserDetails
+ mapRolesToAuthorities(roles: Collection<Role>): Collection< ? extends GrantedAuthority>
}
class InsertSampleDataService {
- playerService: PlayerService
- questionService: QuestionService
- categoryService: CategoryService
- questionRepository: QuestionRepository
- gameSessionRepository: GameSessionRepository
+ insertSampleQuestions(): void
}
class PlayerServiceImpl {
- playerRepository: PlayerRepository
- roleService: RoleService
- passwordEncoder: PasswordEncoder
+ addNewPlayer(dto: PlayerDto): Player
+ getUsers(): List<Player>
+ getUser(id: Long): Optional<Player>
+ getUserByEmail(email: String): Optional<Player>
+ getUserByUsername(username: String): Optional<Player>
+ getUsersByRole(role: String): List<Player>
+ generateApiKey(player: Player): void
}
class RoleServiceImpl {
- roleRepository: RoleRepository
+ addRole(role: RoleDto): Role
+ getRole(name: String): Role
+ getRoles(): List<Role>
}
class AnswerServiceImpl {
- answerRepository: AnswerRepository
+ addNewAnswer(answer: Answer): void
+ getAnswersPerQuestion(question: Question): List<Answer>
+ getAnswer(id: Long): Optional<Answer>
}
class ApiKeyServiceImpl {
- apiKeyRepository: ApiKeyRepository
+ createApiKey(forPlayer: Player): ApiKey
+ getApiKey(apiKey: String): ApiKey
}
class CategoryServiceImpl {
- categoryRepository: CategoryRepository
+ addNewCategory(category: Category): void
+ getAllCategories(): List<Category>
+ getCategory(id: Long): Optional<Category>
+ getCategoryByName(name: String): Category
+ init(): void
}
class QuestionServiceImpl {
- questionRepository: QuestionRepository
+ addNewQuestion(question: Question): void
+ getAllQuestions(): List<Question>
+ getQuestion(id: Long): Optional<Question>
}
class RestApiServiceImpl {
- playerService: PlayerService
- restApiLogRepository: RestApiLogRepository
- questionService: QuestionService
+ getPlayers(params: Map<String, String>): List<Player>
+ logAccess(apiKey: ApiKey, path: String, params: Map<String, String>): void
+ getQuestions(params: Map<String, String>): List<Question>
}
class PlayerDto {
- username: String
- email: String
- password: String
- passwordConfirm: String
- roles: String[]
}
class RoleDto {
- name: String
}
class AbstractGeographyGenerator {
+ getCategory(): Category
}
class BorderQuestionGenerator {
- usedCountries: Set<String>
+ getAllBorderingCountries(resultsNode: JsonNode, correctCountry: String): List<String>
+ selectRandomIncorrectBorderingCountries(allBorderingCountries: List<String>, correctCountry: String, count: int): List<String>
+ generateOptions(results: JsonNode, result: JsonNode): List<String>
+ generateCorrectAnswer(result: JsonNode): String
+ getQuestionSubject(result: JsonNode): String
+ getQuery(): String
}
class CapitalQuestionGenerator {
+ getQuery(): String
+ getAllCapitals(resultsNode: JsonNode, correctCapital: String): List<String>
+ selectRandomIncorrectCapitals(allCapitals: List<String>, correctCapital: String, count: int): List<String>
+ generateOptions(results: JsonNode, result: JsonNode): List<String>
+ generateCorrectAnswer(result: JsonNode): String
+ getQuestionSubject(result: JsonNode): String
}
class ContinentQuestionGeneration {
+ getAllContinents(resultsNode: JsonNode, correctContinent: String): List<String>
+ selectRandomIncorrectContinents(allContinents: List<String>, correctContinent: String, count: int): List<String>
+ generateOptions(results: JsonNode, result: JsonNode): List<String>
+ generateCorrectAnswer(result: JsonNode): String
+ getQuestionSubject(result: JsonNode): String
+ getQuery(): String
}
class AbstractQuestionGenerator {
- questions: List<Question>
- categoryService: CategoryService
- query: String
- statement: String
+ questionGenerator(statement: String, options: List<String>, correctAnswer: String, category: Category): void
+ getQuestions(): List<Question>
+ generateOptions(results: JsonNode, result: JsonNode): List<String>
+ generateCorrectAnswer(result: JsonNode): String
+ getQuestionSubject(result: JsonNode): String
}
interface QuestionGenerator {
+ getQuery(): String
+ getQuestions(): List<Question>
+ getCategory(): Category
}
class QuestionGeneratorTestController {
+ qgen: CapitalQuestionGenerator
+ test(): void
}
class SignUpValidator {
- playerService: PlayerService
+ supports(clazz: Class<?>): boolean
+ validate(target: Object, errors: Errors): void
}
JsonEntity <|.. Answer
JsonEntity <|.. Category
JsonEntity <|.. GameSession
JsonEntity <|.. Player
JsonEntity <|.. Question
AnswerService <|.. AnswerServiceImpl
ApiKeyService <|.. ApiKeyServiceImpl
CategoryService <|.. CategoryServiceImpl
PlayerService <|.. PlayerServiceImpl
QuestionService <|.. QuestionServiceImpl
RestApiService <|.. RestApiServiceImpl
RoleService <|.. RoleServiceImpl
AbstractGeographyGenerator --|> AbstractQuestionGenerator
BorderQuestionGenerator --|> AbstractGeographyGenerator
CapitalQuestionGenerator --|> AbstractGeographyGenerator
ContinentQuestionGeneration --|> AbstractGeographyGenerator
QuestionGenerator <|.. AbstractQuestionGenerator
RoleService ..> RoleDto
Role "*" - "*" Player
AnswerService ..> Answer
AnswerService ..> Question
ApiKeyService ..> Player
CategoryService ..> Category
PlayerService ..> PlayerDto
PlayerService ..> Player
QuestionService ..> Question
RestApiService ..> ApiKey
CustomUserDetailsService ..> Player
CustomUserDetailsService ..> Role
InsertSampleDataService "1" *- "1" PlayerService
InsertSampleDataService "1" *- "1" QuestionService
InsertSampleDataService "1" *- "1" CategoryService
InsertSampleDataService ..> PlayerDto
InsertSampleDataService ..> GameSession
InsertSampleDataService ..> QuestionGenerator
PlayerServiceImpl "1" *- "1" RoleService
PlayerServiceImpl "1" *- "1" PasswordEncoder
PlayerServiceImpl ..> Role
RestApiServiceImpl "1" *- "1" PlayerService
RestApiServiceImpl "1" *- "1" QuestionService
RestApiServiceImpl ..> Player
RestApiServiceImpl ..> Question
RestApiServiceImpl ..> Role
Answer "*" - "1" Question
ApiKey "1" - "1" Player
ApiKey "1" - "*" RestApiAccessLog
Category "1" - "*" Question
Player "1" - "*" GameSession
QuestionGeneratorTestController "1" *- "1" CapitalQuestionGenerator
QuestionGeneratorTestController ..> Question
AbstractQuestionGenerator "1" - "*" Question
AbstractQuestionGenerator "1" - "1" CategoryService
AbstractQuestionGenerator ..> Category
Validator <|.. SignUpValidator
SignUpValidator "1" - "1" PlayerService
SignUpValidator ..> PlayerDto
@enduml
----

[plantuml, domain-model-2, svg]
----
@startuml
class AnswerDto {
- id: Long
- text: String
- correct: boolean
}
class CategoryDto {
- id: Long
- name: String
- description: String
- questions: List<QuestionDto>
}
class QuestionDto {
- id: Long
- statement: String
- options: List<AnswerDto>
- correctAnswer: AnswerDto
- category: CategoryDto
}
class SecurityConfig {
- userDetailsService: UserDetailsService
- customAuthenticationFailureHandler: CustomAuthenticationFailureHandler
+ passwordEncoder(): PasswordEncoder
+ filterChain(http: HttpSecurity): SecurityFilterChain
+ configureGlobal(auth: AuthenticationManagerBuilder): void
+ isAuthenticated(): boolean
}
class CustomAuthenticationFailureHandler {
+ onAuthenticationFailure(request: HttpServletRequest, responde: HttpServletResponse, exception: AuthenticationException): void
}
class CustomConfiguration {
+ localeResolver(): LocaleResolver
+ localeChangeInterceptor(): LocaleChangeInterceptor
+ addInterceptors(registry: InterceptorRegistry): void
}
class WiqEs04bApplication {
+ main(args: String[]): void
}
CategoryDto "1" - "*" QuestionDto
QuestionDto "1" *- "*" AnswerDto
SecurityConfig "1" *- "1" UserDetailsService
SecurityConfig "1" *- "1" CustomAuthenticationFailureHandler
CustomAuthenticationFailureHandler --|> SimpleUrlAuthenticationFailureHandler
WebMvcConfigurer <|.. CustomConfiguration
Role "*" -- "*" Player
Answer "4 " --* "1" Question : Options
Answer "1 " -- " 1" Question : Correct Answer
ApiKey "1" --* "1" Player
ApiKey "1" *-- "*" RestApiAccessLog
Category "1" -- "*" Question
Player "1" *-- "*" GameSession
GameSession "1" -- "*" Question : Answered Questions
GameSession "1" -- "*" Question : Questions To Answer
@enduml
----
Expand Down
2 changes: 1 addition & 1 deletion docs/src/11_technical_risks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ ifndef::imagesdir[:imagesdir: ../images]
| Priority | Debt | Description
| Low | Microservices | Research about microservices and what they can contribute to the project

|==
|===
1 change: 1 addition & 0 deletions docs/src/12_glossary.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ ifndef::imagesdir[:imagesdir: ../images]
|RestApiAccessLog | This entity is used to register the access to the application.

|Associations | Represents the associations between entities. It has internal classes for each association.

|===

0 comments on commit c8b95e5

Please sign in to comment.