-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathUserAdministrative.entity.ts
More file actions
149 lines (122 loc) · 3.64 KB
/
Copy pathUserAdministrative.entity.ts
File metadata and controls
149 lines (122 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import { Entity, Column, PrimaryGeneratedColumn, OneToOne } from 'typeorm';
import { User } from './User.entity';
export enum ContractType {
CDI = 'cdi',
CDD = 'cdd',
CTT = 'ctt',
APPRENTICESHIP = 'apprenticeship',
PROFESSIONALIZATION = 'professionalization'
}
export enum WorkingTimeType {
FULL_TIME = 'full_time',
PART_TIME = 'part_time'
}
@Entity()
export class UserAdministrative {
@PrimaryGeneratedColumn('uuid')
private id: string;
@Column({ type: 'date', nullable: false })
private joiningDate: string;
@Column({ type: 'date', nullable: true })
private leavingDate: string;
@Column({ type: 'integer', nullable: false })
private annualEarnings: number;
@Column({ type: 'integer', default: 0, nullable: true })
private transportFee: number;
@Column({ type: 'integer', default: 0, nullable: true })
private sustainableMobilityFee: number;
@Column({ type: 'integer', default: 0, nullable: true })
private sportsPassFee: number;
@Column({ type: 'boolean', nullable: false })
private healthInsurance: boolean;
@Column({ type: 'boolean', nullable: false })
private executivePosition: boolean;
@Column('enum', { enum: ContractType, nullable: false })
private contract: ContractType;
@Column('enum', { enum: WorkingTimeType, nullable: false })
private workingTime: WorkingTimeType;
@OneToOne(
type => User,
user => user.userAdministrative
)
public user: User;
constructor(
annualEarnings: number,
healthInsurance: boolean,
executivePosition: boolean,
contract: ContractType,
workingTime: WorkingTimeType,
joiningDate: string,
leavingDate?: string,
transportFee?: number,
sustainableMobilityFee?: number,
sportsPassFee?: number
) {
this.annualEarnings = annualEarnings;
this.healthInsurance = healthInsurance;
this.executivePosition = executivePosition;
this.contract = contract;
this.workingTime = workingTime;
this.joiningDate = joiningDate;
this.leavingDate = leavingDate;
this.transportFee = transportFee;
this.sustainableMobilityFee = sustainableMobilityFee;
this.sportsPassFee = sportsPassFee;
}
public getId(): string {
return this.id;
}
public getJoiningDate(): string {
return this.joiningDate;
}
public getLeavingDate(): string {
return this.leavingDate;
}
public getAnnualEarnings(): number {
return this.annualEarnings;
}
public getTransportFee(): number {
return this.transportFee;
}
public getSustainableMobilityFee(): number {
return this.sustainableMobilityFee;
}
public getSportsPassFee(): number {
return this.sportsPassFee;
}
public haveHealthInsurance(): boolean {
return this.healthInsurance;
}
public isExecutivePosition(): boolean {
return this.executivePosition;
}
public getContract(): ContractType {
return this.contract;
}
public getWorkingTime(): WorkingTimeType {
return this.workingTime;
}
public update(
annualEarnings: number,
contract: ContractType,
workingTime: WorkingTimeType,
executivePosition: boolean,
healthInsurance: boolean,
joiningDate: string,
leavingDate: string | null,
transportFee: number,
sustainableMobilityFee: number,
sportsPassFee: number
): void {
this.annualEarnings = annualEarnings;
this.contract = contract;
this.workingTime = workingTime;
this.executivePosition = executivePosition;
this.healthInsurance = healthInsurance;
this.joiningDate = joiningDate;
this.leavingDate = leavingDate;
this.transportFee = transportFee;
this.sustainableMobilityFee = sustainableMobilityFee;
this.sportsPassFee = sportsPassFee;
}
}