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

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

@ -7,50 +7,74 @@ class TacticInfo {
- ownerId: string - ownerId: string
- content: string - content: string
+ __construct(id:int,name:string,creationDate:int,ownerId:int,courtType:CourtType,content:string)
+ getId(): int + getId(): int
+ getOwnerId(): int + getOwnerId(): int
+ getCreationTimestamp(): int + getCreationTimestamp(): int
+ getName(): string + getName(): string
+ getContent(): 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 { class Account {
- email: string
- token: string - token: string
- name: string
- id: int
+ getMailAddress(): string + __construct(token:string,user:User)
+ getToken(): string + getUser() : User
+ getName(): string + getToken() : string
+ getId(): int
} }
Account -->"- user" User
class Member { class Member {
- userId: int
- teamId: int - teamId: int
- role : string - role : string
+ __construct(role : string) + __construct(role : string)
+ getUserId(): int + getUser(): User
+ getTeamId(): int + getTeamId(): int
+ getRole(): string + getRole(): string
} }
note bottom: Member's role is either "Coach" or "Player"
Member -->"- user" User
class TeamInfo { class TeamInfo {
- creationDate: int
- name: string - name: string
- picture: string - picture: string
- mainColor : string - mainColor : string
- secondColor : string - secondColor : string
+ __construct(id:int,name:string,picture:string,mainColor:string,secondColor:string)
+ getName(): string + getName(): string
+ getPicture(): string + getPicture(): string
+ getMainColor(): string + getMainColor(): string
+ getSecondColor(): string + getSecondColor(): string
} }
note left: Both team's color are the hex code of the color
class Team { class Team {
+ __construct() + __construct(info:TeamInfo,members: Member[])
+ getInfo(): TeamInfo + getInfo(): TeamInfo
+ listMembers(): Member[] + listMembers(): Member[]
} }

@ -7,26 +7,26 @@ class AuthController {
+ displayLogin() : HttpResponse + displayLogin() : HttpResponse
+ login(request : array , session : MutableSessionHandle) : HttpResponse + login(request : array , session : MutableSessionHandle) : HttpResponse
} }
AuthController --> "- model" AuthModel AuthController *-- "- model" AuthModel
class AuthModel { class AuthModel {
+__construct(gateway : AccountGateway) + __construct(gateway : AccountGateway)
+ register(username : string, password : string, confirmPassword : string, email : string, failures : array): Account + register(username:string, password:string, confirmPassword:string, email:string, &failures:array): ?Account + generateToken() : string
+ generateToken() : string + generateToken(): string
+ login(email : string, password : string) + login(email:string, password:string, &failures:array): ?Account
} }
AuthModel --> "- gateway" AccountGateway 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
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 @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 @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{ class TeamGateway{
--
+ __construct(con : Connexion) + __construct(con : Connexion)
+ insert(name : string ,picture : string, mainColor : Color, secondColor : Color) + insert(name : string ,picture : string, mainColor : Color, secondColor : Color)
+ listByName(name : string): array + 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 *--"- 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{ class TeamModel{
---
+ __construct(gateway : TeamGateway) + __construct(gateway : TeamGateway)
+ createTeam(name : string,picture : string, mainColorValue : int, secondColorValue : int, errors : array) + 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 + 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 *--"- members" MemberGateway
TeamModel ..> Team TeamModel *--"- teams" TeamGateway
TeamModel ..> Color TeamModel *--"- teams" AccountGateway
class TeamController{ class TeamController{
- twig : Environement + __construct( model : TeamModel)
-- + displayCreateTeam(session:SessionHandle): ViewHttpResponse
+ __construct( model : TeamModel, twig : Environement) + displayDeleteMember(session:SessionHandle): ViewHttpResponse
+ displaySubmitTeam() : HttpResponse + submitTeam(request:array, session:SessionHandle): HttpResponse
+ submitTeam(request : array) : HttpResponse + displayListTeamByName(session:SessionHandle): ViewHttpResponse
+ displayListTeamByName(): HttpResponse + listTeamByName(request:array, session:SessionHandle): HttpResponse
+ listTeamByName(request : array) : HttpResponse + deleteTeamById(id:int, session:SessionHandle): HttpResponse
+ displayTeam(id : int): 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 TeamController *--"- model" TeamModel
class Connexion { } class Connexion { }
@enduml @enduml

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

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

Loading…
Cancel
Save