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