feat: classes to ecapsulate the api calls better

This commit is contained in:
Mohamed Maoulainine Maoulainine
2025-04-27 13:29:31 +02:00
parent fcc20d1f42
commit a8e22de4a3
10 changed files with 422 additions and 0 deletions

View File

@ -0,0 +1,72 @@
// project.ts
class Project {
private _idProject?: number;
private _projectName?: string;
private _creationDate?: string;
private _logo?: string;
private _status?: "PENDING" | "ACTIVE" | "ENDED" | "ABORTED" | "REJECTED";
constructor(data: Partial<Project> = {}) {
this._idProject = data.idProject;
this._projectName = data.projectName;
this._creationDate = data.creationDate;
this._logo = data.logo;
this._status = data.status;
}
get idProject(): number | undefined {
return this._idProject;
}
set idProject(value: number | undefined) {
this._idProject = value;
}
get projectName(): string | undefined {
return this._projectName;
}
set projectName(value: string | undefined) {
this._projectName = value;
}
get creationDate(): string | undefined {
return this._creationDate;
}
set creationDate(value: string | undefined) {
this._creationDate = value;
}
get logo(): string | undefined {
return this._logo;
}
set logo(value: string | undefined) {
this._logo = value;
}
get status():
| "PENDING"
| "ACTIVE"
| "ENDED"
| "ABORTED"
| "REJECTED"
| undefined {
return this._status;
}
set status(
value:
| "PENDING"
| "ACTIVE"
| "ENDED"
| "ABORTED"
| "REJECTED"
| undefined
) {
this._status = value;
}
}
export default Project;