updated old documentation
continuous-integration/drone/push Build is passing Details

pull/93/head
Maël DAIM 1 year ago
parent a123145acd
commit e1056f4ade

@ -6,51 +6,75 @@ class TacticInfo {
- creationDate: string
- ownerId: string
- content: string
+ __construct(id:int,name:string,creationDate:int,ownerId:int,courtType:CourtType,content:string)
+ getId(): int
+ getOwnerId(): int
+ getCreationTimestamp(): int
+ getName(): string
+ getContent(): string
+ getCourtType() : CourtType
}
TacticInfo -->"- courtType" CourtType
class CourtType{
- value : int
- COURT_PLAIN : int {static} {frozen}
- COURT_HALF : int {static} {frozen}
- __construct(val:int)
+ plain() : CourtType {static}
+ half() : CourtType {static}
+ name() : string
+ fromName(name:string) : CourtType
+ isPlain() : bool
+ isHalf() : bool
}
note bottom: Basically an evoluated enum
class Account {
- email: string
- token: string
- name: string
- id: int
+ getMailAddress(): string
+ getToken(): string
+ getName(): string
+ getId(): int
+ __construct(token:string,user:User)
+ getUser() : User
+ getToken() : string
}
Account -->"- user" User
class Member {
- userId: int
- teamId: int
- role : string
+ __construct(role : string)
+ getUserId(): int
+ getUser(): User
+ getTeamId(): int
+ getRole(): string
}
note bottom: Member's role is either "Coach" or "Player"
Member -->"- user" User
class TeamInfo {
- creationDate: int
- name: string
- picture: string
- mainColor : string
- secondColor : string
+ __construct(id:int,name:string,picture:string,mainColor:string,secondColor:string)
+ getName(): string
+ getPicture(): string
+ getMainColor(): string
+ getSecondColor(): string
}
note left: Both team's color are the hex code of the color
class Team {
+ __construct()
+ __construct(info:TeamInfo,members: Member[])
+ getInfo(): TeamInfo
+ listMembers(): Member[]
}

@ -7,26 +7,26 @@ class AuthController {
+ displayLogin() : HttpResponse
+ login(request : array , session : MutableSessionHandle) : HttpResponse
}
AuthController --> "- model" AuthModel
AuthController *-- "- model" AuthModel
class AuthModel {
+__construct(gateway : AccountGateway)
+ register(username : string, password : string, confirmPassword : string, email : string, failures : array): Account
+ generateToken() : string
+ login(email : string, password : string)
+ __construct(gateway : AccountGateway)
+ register(username:string, password:string, confirmPassword:string, email:string, &failures:array): ?Account + generateToken() : string
+ generateToken(): string
+ login(email:string, password:string, &failures:array): ?Account
}
AuthModel --> "- gateway" AccountGateway
class AccountGateway {
-con : Connection
+__construct(con : Connection)
+ insertAccount(name : string, email : string, hash : string, token : string) : int
+ getRowsFromMail(email : string): array
+ getHash(email : string) : array
+ exists(email : string) : bool
+ getAccountFromMail(email : string ): Account
+ getAccountFromToken(email : string ): Account
AuthModel *-- "- gateway" AccountGateway
class AccountGateway{
+ __construct(con : Connexion)
+ insertAccount(name:string, email:string, token:string, hash:string, profilePicture:string): int
+ getRowsFromMail(email:string): ?array
+ getHash(email:string): ?string
+ exists(email:string): bool
+ getAccountFromMail(email:string): ?Account
+ getAccountFromToken(token:string): ?Account
}
AccountGateway *--"- con" Connexion
@enduml

@ -0,0 +1,38 @@
@startuml
class EditorController {
+__construct (model : TacticModel)
+ openEditorFor(tactic:TacticInfo): ViewHttpResponse
+ createNew(): ViewHttpResponse
+ openTestEditor(courtType:CourtType): ViewHttpResponse
+ createNewOfKind(type:CourtType, session:SessionHandle): ViewHttpResponse
+ openEditor(id:int, session:SessionHandle): ViewHttpResponse
}
EditorController *-- "- model" TacticModel
class TacticModel {
+ TACTIC_DEFAULT_NAME:int {static}{frozen}
+ __construct(tactics : TacticInfoGateway)
+ makeNew(name:string, ownerId:int, type:CourtType): TacticInfo
+ makeNewDefault(ownerId:int, type:CourtType): ?TacticInfo
+ get(id:int): ?TacticInfo
+ getLast(nb:int, ownerId:int): array
+ getAll(ownerId:int): ?array
+ updateName(id:int, name:string, authId:int): array
+ updateContent(id:int, json:string): ?ValidationFail
}
TacticModel *-- "- tactics" TacticInfoGateway
class TacticInfoGateway{
+ __construct(con : Connexion)
+ get(id:int): ?TacticInfo
+ getLast(nb:int, ownerId:int): ?array
+ getAll(ownerId:int): ?array
+ insert(name:string, owner:int, type:CourtType): int
+ updateName(id:int, name:string): bool
+ updateContent(id:int, json:string): bool
}
TacticInfoGateway *--"- con" Connexion
@enduml

@ -1,63 +1,87 @@
@startuml
class Team {
- name: string
- picture: Url
- members: array<int, MemberRole>
+ __construct(name : string, picture : string, mainColor : Colo, secondColor : Color)
+ getName(): string
+ getPicture(): Url
+ getMainColor(): Color
+ getSecondColor(): Color
+ listMembers(): array<Member>
}
Team --> "- mainColor" Color
Team --> "- secondColor" Color
class Color {
- value: string
- __construct(value : string)
+ getValue(): string
+ from(value: string): Color
+ tryFrom(value : string) : ?Color
}
class TeamGateway{
--
+ __construct(con : Connexion)
+ insert(name : string ,picture : string, mainColor : Color, secondColor : Color)
+ listByName(name : string): array
+ getTeamById(id:int): ?TeamInfo
+ getTeamIdByName(name:string): ?int
+ deleteTeam(idTeam:int): void
+ editTeam(idTeam:int, newName:string, newPicture:string, newMainColor:string, newSecondColor:string)
+ getAll(user:int): array
}
TeamGateway *--"- con" Connexion
TeamGateway ..> Color
class MemberGateway{
+ __construct(con : Connexion)
+ insert(idTeam:int, userId:int, role:string): void
+ getMembersOfTeam(teamId:int): array
+ remove(idTeam:int, idMember:int): void
+ isCoach(email:string, idTeam:int): bool
+ isMemberOfTeam(idTeam:int, idCurrentUser:int): bool
}
MemberGateway *--"- con" Connexion
class AccountGateway{
+ __construct(con : Connexion)
+ insertAccount(name:string, email:string, token:string, hash:string, profilePicture:string): int
+ getRowsFromMail(email:string): ?array
+ getHash(email:string): ?string
+ exists(email:string): bool
+ getAccountFromMail(email:string): ?Account
+ getAccountFromToken(token:string): ?Account
}
AccountGateway *--"- con" Connexion
class TeamModel{
---
+ __construct(gateway : TeamGateway)
+ createTeam(name : string,picture : string, mainColorValue : int, secondColorValue : int, errors : array)
+ addMember(mail:string, teamId:int, role:string): int
+ listByName(name : string ,errors : array) : ?array
+ displayTeam(id : int): Team
+ getTeam(idTeam:int, idCurrentUser:int): ?Team
+ deleteMember(idMember:int, teamId:int): int
+ deleteTeam(email:string, idTeam:int): int
+ isCoach(idTeam:int, email:string): bool
+ editTeam(idTeam:int, newName:string, newPicture:string, newMainColor:string, newSecondColor:string)
+ getAll(user:int): array
}
TeamModel *--"- gateway" TeamGateway
TeamModel ..> Team
TeamModel ..> Color
TeamModel *--"- members" MemberGateway
TeamModel *--"- teams" TeamGateway
TeamModel *--"- teams" AccountGateway
class TeamController{
- twig : Environement
--
+ __construct( model : TeamModel, twig : Environement)
+ displaySubmitTeam() : HttpResponse
+ submitTeam(request : array) : HttpResponse
+ displayListTeamByName(): HttpResponse
+ listTeamByName(request : array) : HttpResponse
+ displayTeam(id : int): HttpResponse
+ __construct( model : TeamModel)
+ displayCreateTeam(session:SessionHandle): ViewHttpResponse
+ displayDeleteMember(session:SessionHandle): ViewHttpResponse
+ submitTeam(request:array, session:SessionHandle): HttpResponse
+ displayListTeamByName(session:SessionHandle): ViewHttpResponse
+ listTeamByName(request:array, session:SessionHandle): HttpResponse
+ deleteTeamById(id:int, session:SessionHandle): HttpResponse
+ displayTeam(id:int, session:SessionHandle): ViewHttpResponse
+ displayAddMember(idTeam:int, session:SessionHandle): ViewHttpResponse
+ addMember(idTeam:int, request:array, session:SessionHandle): HttpResponse
+ deleteMember(idTeam:int, idMember:int, session:SessionHandle): HttpResponse
+ displayEditTeam(idTeam:int, session:SessionHandle): ViewHttpResponse
+ editTeam(idTeam:int, request:array, session:SessionHandle): HttpResponse
}
TeamController *--"- model" TeamModel
class Connexion { }
@enduml

@ -1,18 +1,20 @@
@startuml
abstract class Validator {
+ validate(name: string, val: mixed): array
+ validate(name: string, val: mixed): array {abstract}
+ then(other: Validator): Validator
}
class ComposedValidator extends Validator {
- first: Validator
- then: Validator
+ __construct(first: Validator, then: Validator)
validate(name: string, val: mixed): array
+ validate(name: string, val: mixed): array
}
ComposedValidator -->"- first" Validator
ComposedValidator -->"- then" Validator
class SimpleFunctionValidator extends Validator {
- predicate: callable
- error_factory: callable
@ -28,9 +30,9 @@ class ValidationFail implements JsonSerialize {
+ __construct(kind: string, message: string)
+ getMessage(): string
+ getKind(): string
+ jsonSerialize()
+ <u>notFound(message: string): ValidationFail
+ <u>unauthorized(message:string): ValidationFail
+ <u>error(message:string): ValidationFail
}
class FieldValidationFail extends ValidationFail {
@ -49,13 +51,25 @@ class Validation {
<u> + validate(val: mixed, valName: string, failures: &array, validators: Validator...): bool
}
Validation ..> Validator
class Validators {
---
+ <u>nonEmpty(): Validator
+ <u>shorterThan(limit: int): Validator
+ <u>userString(maxLen: int): Validator
...
+ <u>regex(regex:string, msg:string): Validator
+ <u>hex(msg:string): Validator
+ <u>name(msg:string): Validator
+ <u>nameWithSpaces(): Validator
+ <u>lenBetween(min:int, max:int): Validator
+ <u>email(msg:string): Validator
+ <u>isInteger(): Validator
+ <u>isIntInRange(min:int, max:int): Validator
+ <u>isURL(): Validator
}
Validators ..> Validator
@enduml

@ -11,7 +11,6 @@ use IQBall\Core\Validation\ValidationFail;
class TacticModel {
public const TACTIC_DEFAULT_NAME = "Nouvelle tactique";
private TacticInfoGateway $tactics;
/**
@ -52,13 +51,6 @@ class TacticModel {
return $this->tactics->get($id);
}
/**
* Return the nb last tactics created
*
* @param integer $nb
* @return array<array<string,mixed>>
*/
/**
* Return the nb last tactics
*

Loading…
Cancel
Save