toDTO pour les user

This commit is contained in:
trochas
2026-01-08 16:30:29 +01:00
parent d68662e91c
commit 9bb487c369
3 changed files with 47 additions and 27 deletions

View File

@@ -12,7 +12,7 @@ export class Ligne{
export class User{
id!: number;
keycloakId!: String;
keycloakId!: string;
nom!: string;
prenom!:string;
email!: string;
@@ -32,6 +32,16 @@ export class Admin extends User{
this.email = ""; //TODO
}
toDTO():AdminDTO{
const dto:AdminDTO = {
id: this.id,
id_keycloak: this.keycloakId,
name: this.nom,
prenom: this.prenom,
};
return dto;
}
}
export class Athlete extends User{
@@ -53,6 +63,21 @@ export class Athlete extends User{
this.sessionsID = dto?.sessionIds ?? [];
this.sessions = [];
}
toDTO():AthleteDTO{
const dto:AthleteDTO = {
id: this.id,
id_keycloak: this.keycloakId,
name: this.nom,
prenom: this.prenom,
categorie: "",
niveau: "",
groupes: this.groupes,
sessionIds: this.sessionsID,
};
return dto;
}
}
export class Coach extends User{
@@ -73,6 +98,19 @@ export class Coach extends User{
this.sessionsID = dto?.sessionIds ?? [];
this.sessions = [];
}
toDTO():CoachDTO{
const dto:CoachDTO = {
id: this.id,
id_keycloak: this.keycloakId,
name: this.nom,
prenom: this.prenom,
sessionIds: this.sessionsID,
};
return dto;
}
}
export class Session{