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
|
|
|
@Entity() |
13
|
|
|
export class UserAdministrative { |
14
|
|
|
@PrimaryGeneratedColumn('uuid') |
15
|
|
|
private id: string; |
16
|
|
|
|
17
|
|
|
@Column({type: 'date', nullable: false}) |
18
|
|
|
private joiningDate: string; |
19
|
|
|
|
20
|
|
|
@Column({type: 'date', nullable: true}) |
21
|
|
|
private leavingDate: string; |
22
|
|
|
|
23
|
|
|
@Column({type: 'integer', nullable: false}) |
24
|
|
|
private annualEarnings: number; |
25
|
|
|
|
26
|
|
|
@Column({type: 'integer', default: 0, nullable: true}) |
27
|
|
|
private transportFee: number; |
28
|
|
|
|
29
|
|
|
@Column({type: 'boolean', nullable: false}) |
30
|
|
|
private healthInsurance: boolean; |
31
|
|
|
|
32
|
|
|
@Column({type: 'boolean', nullable: false}) |
33
|
|
|
private executivePosition: boolean; |
34
|
|
|
|
35
|
|
|
@Column('enum', {enum: ContractType, nullable: false}) |
36
|
|
|
private contract: ContractType; |
37
|
|
|
|
38
|
|
|
@OneToOne(type => User, user => user.userAdministrative) |
39
|
|
|
public user: User; |
40
|
|
|
|
41
|
|
|
constructor( |
42
|
|
|
annualEarnings: number, |
43
|
|
|
healthInsurance: boolean, |
44
|
|
|
executivePosition: boolean, |
45
|
|
|
contract: ContractType, |
46
|
|
|
joiningDate: string, |
47
|
|
|
leavingDate?: string, |
48
|
|
|
transportFee?: number |
49
|
|
|
) { |
50
|
|
|
this.annualEarnings = annualEarnings; |
51
|
|
|
this.healthInsurance = healthInsurance; |
52
|
|
|
this.executivePosition = executivePosition; |
53
|
|
|
this.contract = contract; |
54
|
|
|
this.joiningDate = joiningDate; |
55
|
|
|
this.leavingDate = leavingDate; |
56
|
|
|
this.transportFee = transportFee; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public getId(): string { |
60
|
|
|
return this.id; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public getJoiningDate(): string { |
64
|
|
|
return this.joiningDate; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public getLeavingDate(): string { |
68
|
|
|
return this.leavingDate; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public getAnnualEarnings(): number { |
72
|
|
|
return this.annualEarnings; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public getTransportFee(): number { |
76
|
|
|
return this.transportFee; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public haveHealthInsurance(): boolean { |
80
|
|
|
return this.healthInsurance; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public isExecutivePosition(): boolean { |
84
|
|
|
return this.executivePosition; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public getContract(): ContractType { |
88
|
|
|
return this.contract; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public update( |
92
|
|
|
annualEarnings: number, |
93
|
|
|
contract: ContractType, |
94
|
|
|
executivePosition: boolean, |
95
|
|
|
healthInsurance: boolean, |
96
|
|
|
joiningDate: string, |
97
|
|
|
leavingDate: string, |
98
|
|
|
transportFee: number |
99
|
|
|
): void { |
100
|
|
|
this.annualEarnings = annualEarnings; |
101
|
|
|
this.contract = contract; |
102
|
|
|
this.executivePosition = executivePosition; |
103
|
|
|
this.healthInsurance = healthInsurance; |
104
|
|
|
this.joiningDate = joiningDate; |
105
|
|
|
this.leavingDate = leavingDate; |
106
|
|
|
this.transportFee = transportFee; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|