feat: classes to ecapsulate the api calls better
This commit is contained in:
parent
fcc20d1f42
commit
a8e22de4a3
68
front/MyINPulse-front/src/ApiClasses/Appointment.ts
Normal file
68
front/MyINPulse-front/src/ApiClasses/Appointment.ts
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
// appointment.ts
|
||||||
|
class Appointment {
|
||||||
|
private _idAppointment?: number;
|
||||||
|
private _appointmentDate?: string;
|
||||||
|
private _appointmentTime?: string;
|
||||||
|
private _appointmentDuration?: string;
|
||||||
|
private _appointmentPlace?: string;
|
||||||
|
private _appointmentSubject?: string;
|
||||||
|
|
||||||
|
constructor(data: Partial<Appointment> = {}) {
|
||||||
|
this._idAppointment = data.idAppointment;
|
||||||
|
this._appointmentDate = data.appointmentDate;
|
||||||
|
this._appointmentTime = data.appointmentTime;
|
||||||
|
this._appointmentDuration = data.appointmentDuration;
|
||||||
|
this._appointmentPlace = data.appointmentPlace;
|
||||||
|
this._appointmentSubject = data.appointmentSubject;
|
||||||
|
}
|
||||||
|
|
||||||
|
get idAppointment(): number | undefined {
|
||||||
|
return this._idAppointment;
|
||||||
|
}
|
||||||
|
|
||||||
|
set idAppointment(value: number | undefined) {
|
||||||
|
this._idAppointment = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get appointmentDate(): string | undefined {
|
||||||
|
return this._appointmentDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
set appointmentDate(value: string | undefined) {
|
||||||
|
this._appointmentDate = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get appointmentTime(): string | undefined {
|
||||||
|
return this._appointmentTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
set appointmentTime(value: string | undefined) {
|
||||||
|
this._appointmentTime = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get appointmentDuration(): string | undefined {
|
||||||
|
return this._appointmentDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
set appointmentDuration(value: string | undefined) {
|
||||||
|
this._appointmentDuration = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get appointmentPlace(): string | undefined {
|
||||||
|
return this._appointmentPlace;
|
||||||
|
}
|
||||||
|
|
||||||
|
set appointmentPlace(value: string | undefined) {
|
||||||
|
this._appointmentPlace = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get appointmentSubject(): string | undefined {
|
||||||
|
return this._appointmentSubject;
|
||||||
|
}
|
||||||
|
|
||||||
|
set appointmentSubject(value: string | undefined) {
|
||||||
|
this._appointmentSubject = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Appointment;
|
32
front/MyINPulse-front/src/ApiClasses/JoinRequest.ts
Normal file
32
front/MyINPulse-front/src/ApiClasses/JoinRequest.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// joinRequest.ts
|
||||||
|
import UserEntrepreneur from "./UserEntrepreneur";
|
||||||
|
|
||||||
|
class JoinRequest {
|
||||||
|
private _idProject?: number;
|
||||||
|
private _entrepreneur?: UserEntrepreneur;
|
||||||
|
|
||||||
|
constructor(data: Partial<JoinRequest> = {}) {
|
||||||
|
this._idProject = data.idProject;
|
||||||
|
this._entrepreneur = data.entrepreneur
|
||||||
|
? new UserEntrepreneur(data.entrepreneur)
|
||||||
|
: undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
get idProject(): number | undefined {
|
||||||
|
return this._idProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
set idProject(value: number | undefined) {
|
||||||
|
this._idProject = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get entrepreneur(): UserEntrepreneur | undefined {
|
||||||
|
return this._entrepreneur;
|
||||||
|
}
|
||||||
|
|
||||||
|
set entrepreneur(value: UserEntrepreneur | undefined) {
|
||||||
|
this._entrepreneur = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default JoinRequest;
|
18
front/MyINPulse-front/src/ApiClasses/JoinRequestDecision.ts
Normal file
18
front/MyINPulse-front/src/ApiClasses/JoinRequestDecision.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// joinRequestDecision.ts
|
||||||
|
class JoinRequestDecision {
|
||||||
|
private _isAccepted?: boolean;
|
||||||
|
|
||||||
|
constructor(data: Partial<JoinRequestDecision> = {}) {
|
||||||
|
this._isAccepted = data.isAccepted;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isAccepted(): boolean | undefined {
|
||||||
|
return this._isAccepted;
|
||||||
|
}
|
||||||
|
|
||||||
|
set isAccepted(value: boolean | undefined) {
|
||||||
|
this._isAccepted = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default JoinRequestDecision;
|
72
front/MyINPulse-front/src/ApiClasses/Project.ts
Normal file
72
front/MyINPulse-front/src/ApiClasses/Project.ts
Normal 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;
|
38
front/MyINPulse-front/src/ApiClasses/ProjectDecision.ts
Normal file
38
front/MyINPulse-front/src/ApiClasses/ProjectDecision.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// projectDecision.ts
|
||||||
|
class ProjectDecision {
|
||||||
|
private _projectId?: number;
|
||||||
|
private _adminId?: number;
|
||||||
|
private _isAccepted?: boolean;
|
||||||
|
|
||||||
|
constructor(data: Partial<ProjectDecision> = {}) {
|
||||||
|
this._projectId = data.projectId;
|
||||||
|
this._adminId = data.adminId;
|
||||||
|
this._isAccepted = data.isAccepted;
|
||||||
|
}
|
||||||
|
|
||||||
|
get projectId(): number | undefined {
|
||||||
|
return this._projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
set projectId(value: number | undefined) {
|
||||||
|
this._projectId = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get adminId(): number | undefined {
|
||||||
|
return this._adminId;
|
||||||
|
}
|
||||||
|
|
||||||
|
set adminId(value: number | undefined) {
|
||||||
|
this._adminId = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isAccepted(): boolean | undefined {
|
||||||
|
return this._isAccepted;
|
||||||
|
}
|
||||||
|
|
||||||
|
set isAccepted(value: boolean | undefined) {
|
||||||
|
this._isAccepted = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProjectDecision;
|
28
front/MyINPulse-front/src/ApiClasses/Repport.ts
Normal file
28
front/MyINPulse-front/src/ApiClasses/Repport.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// report.ts
|
||||||
|
class Report {
|
||||||
|
private _idReport?: number;
|
||||||
|
private _reportContent?: string;
|
||||||
|
|
||||||
|
constructor(data: Partial<Report> = {}) {
|
||||||
|
this._idReport = data.idReport;
|
||||||
|
this._reportContent = data.reportContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
get idReport(): number | undefined {
|
||||||
|
return this._idReport;
|
||||||
|
}
|
||||||
|
|
||||||
|
set idReport(value: number | undefined) {
|
||||||
|
this._idReport = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get reportContent(): string | undefined {
|
||||||
|
return this._reportContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
set reportContent(value: string | undefined) {
|
||||||
|
this._reportContent = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Report;
|
48
front/MyINPulse-front/src/ApiClasses/SectionCell.ts
Normal file
48
front/MyINPulse-front/src/ApiClasses/SectionCell.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// sectionCell.ts
|
||||||
|
class SectionCell {
|
||||||
|
private _idSectionCell?: number;
|
||||||
|
private _sectionId?: number;
|
||||||
|
private _contentSectionCell?: string;
|
||||||
|
private _modificationDate?: string;
|
||||||
|
|
||||||
|
constructor(data: Partial<SectionCell> = {}) {
|
||||||
|
this._idSectionCell = data.idSectionCell;
|
||||||
|
this._sectionId = data.sectionId;
|
||||||
|
this._contentSectionCell = data.contentSectionCell;
|
||||||
|
this._modificationDate = data.modificationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
get idSectionCell(): number | undefined {
|
||||||
|
return this._idSectionCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
set idSectionCell(value: number | undefined) {
|
||||||
|
this._idSectionCell = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get sectionId(): number | undefined {
|
||||||
|
return this._sectionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
set sectionId(value: number | undefined) {
|
||||||
|
this._sectionId = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get contentSectionCell(): string | undefined {
|
||||||
|
return this._contentSectionCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
set contentSectionCell(value: string | undefined) {
|
||||||
|
this._contentSectionCell = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get modificationDate(): string | undefined {
|
||||||
|
return this._modificationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
set modificationDate(value: string | undefined) {
|
||||||
|
this._modificationDate = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SectionCell;
|
67
front/MyINPulse-front/src/ApiClasses/User.ts
Normal file
67
front/MyINPulse-front/src/ApiClasses/User.ts
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
class User {
|
||||||
|
private _idUser?: number;
|
||||||
|
private _userSurname?: string;
|
||||||
|
private _userName?: string;
|
||||||
|
private _primaryMail?: string;
|
||||||
|
private _secondaryMail?: string;
|
||||||
|
private _phoneNumber?: string;
|
||||||
|
|
||||||
|
constructor(data: Partial<User> = {}) {
|
||||||
|
this._idUser = data.idUser;
|
||||||
|
this._userSurname = data.userSurname;
|
||||||
|
this._userName = data.userName;
|
||||||
|
this._primaryMail = data.primaryMail;
|
||||||
|
this._secondaryMail = data.secondaryMail;
|
||||||
|
this._phoneNumber = data.phoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
get idUser(): number | undefined {
|
||||||
|
return this._idUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
set idUser(value: number | undefined) {
|
||||||
|
this._idUser = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get userSurname(): string | undefined {
|
||||||
|
return this._userSurname;
|
||||||
|
}
|
||||||
|
|
||||||
|
set userSurname(value: string | undefined) {
|
||||||
|
this._userSurname = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get userName(): string | undefined {
|
||||||
|
return this._userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
set userName(value: string | undefined) {
|
||||||
|
this._userName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get primaryMail(): string | undefined {
|
||||||
|
return this._primaryMail;
|
||||||
|
}
|
||||||
|
|
||||||
|
set primaryMail(value: string | undefined) {
|
||||||
|
this._primaryMail = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get secondaryMail(): string | undefined {
|
||||||
|
return this._secondaryMail;
|
||||||
|
}
|
||||||
|
|
||||||
|
set secondaryMail(value: string | undefined) {
|
||||||
|
this._secondaryMail = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get phoneNumber(): string | undefined {
|
||||||
|
return this._phoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
set phoneNumber(value: string | undefined) {
|
||||||
|
this._phoneNumber = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default User;
|
10
front/MyINPulse-front/src/ApiClasses/UserAdmin.ts
Normal file
10
front/MyINPulse-front/src/ApiClasses/UserAdmin.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// user-admin.ts
|
||||||
|
import User from "./User";
|
||||||
|
|
||||||
|
class UserAdmin extends User {
|
||||||
|
constructor(data: Partial<UserAdmin> = {}) {
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UserAdmin;
|
41
front/MyINPulse-front/src/ApiClasses/UserEntrepreneur.ts
Normal file
41
front/MyINPulse-front/src/ApiClasses/UserEntrepreneur.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// user-entrepreneur.ts
|
||||||
|
import User from "./User";
|
||||||
|
|
||||||
|
class UserEntrepreneur extends User {
|
||||||
|
private _school?: string;
|
||||||
|
private _course?: string;
|
||||||
|
private _sneeStatus?: boolean;
|
||||||
|
|
||||||
|
constructor(data: Partial<UserEntrepreneur> = {}) {
|
||||||
|
super(data);
|
||||||
|
this._school = data.school;
|
||||||
|
this._course = data.course;
|
||||||
|
this._sneeStatus = data.sneeStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
get school(): string | undefined {
|
||||||
|
return this._school;
|
||||||
|
}
|
||||||
|
|
||||||
|
set school(value: string | undefined) {
|
||||||
|
this._school = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get course(): string | undefined {
|
||||||
|
return this._course;
|
||||||
|
}
|
||||||
|
|
||||||
|
set course(value: string | undefined) {
|
||||||
|
this._course = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get sneeStatus(): boolean | undefined {
|
||||||
|
return this._sneeStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
set sneeStatus(value: boolean | undefined) {
|
||||||
|
this._sneeStatus = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UserEntrepreneur;
|
Loading…
x
Reference in New Issue
Block a user