@movalib/movalib-commons 1.64.2 → 1.64.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,104 +1,104 @@
1
1
  import { Gender, RoleType } from "../helpers/Enums";
2
- import Address from './Address';
2
+ import Address from "./Address";
3
3
  import Garage from "./Garage";
4
4
  import Role from "./Role";
5
5
  import Vehicle from "./Vehicle";
6
6
 
7
7
  export default class User {
8
-
9
- // Properties
10
- id: string;
11
- roles: Role[];
12
- firstname: string;
13
- lastname: string;
14
- avatar: string;
15
- password: string;
16
- created: Date;
17
- email?: string;
18
- gender?: Gender;
19
- birthDate?: Date;
20
- addresses? : Address[]
21
- phoneNumber?: string;
22
- vehicles?: Vehicle[];
23
- isActive?: Boolean;
24
- hasPassword?: Boolean;
25
- garages?: Garage[];
26
-
27
- constructor(
28
- id: string,
29
- roles: Role[],
30
- firstname: string = '',
31
- lastname: string = '',
32
- avatar: string = '',
33
- password: string = '',
34
- created: Date = new Date(),
35
- email?: string,
36
- gender?: Gender,
37
- birthDate?: Date,
38
- addresses?: Address[],
39
- phoneNumber?: string ,
40
- vehicles?: Vehicle[],
41
- isActive?: Boolean,
42
- hasPassword?: Boolean,
43
- garages?: Garage[]
44
- ) {
45
- this.id = id;
46
- this.roles = roles;
47
- this.firstname = firstname;
48
- this.lastname = lastname;
49
- this.avatar = avatar;
50
- this.email = email;
51
- this.password = password;
52
- this.created = created;
53
- this.gender = gender;
54
- this.birthDate = birthDate;
55
- this.addresses = addresses;
56
- this.phoneNumber = phoneNumber;
57
- this.vehicles = vehicles;
58
- this.isActive = isActive;
59
- this.hasPassword = hasPassword;
60
- this.garages = garages;
61
- }
62
-
63
- static getFirstLetter = (user: User) : string => {
64
-
65
- const firstLetter = user.lastname[0].toUpperCase();
66
- return /[0-9]/.test(firstLetter) ? '0-9' : firstLetter;
67
- }
68
-
69
- static isGarageCustomer = (user: User) : boolean => {
70
- if(!user || !user.roles) return false;
71
-
72
- return Boolean(user.roles.find(r => r.name === RoleType.GARAGE_CUSTOMER));
73
- }
74
-
75
- static isGarageTechnician = (user: User) : boolean => {
76
- if(!user || !user.roles) return false;
77
-
78
- return Boolean(user.roles.find(r => r.name === RoleType.GARAGE_TECHNICIAN));
79
- }
80
-
81
- static isGarageAdmin = (user: User) : boolean => {
82
- if(!user || !user.roles) return false;
83
-
84
- return Boolean(user.roles.find(r => r.name === RoleType.GARAGE_ADMIN));
85
- }
86
-
87
- static isSales = (user: User) : boolean => {
88
- if(!user || !user.roles) return false;
89
-
90
- return Boolean(user.roles.find(r => r.name === RoleType.SALES));
91
- }
92
-
93
- static isCsM = (user: User) : boolean => {
94
- if(!user || !user.roles) return false;
95
-
96
- return Boolean(user.roles.find(r => r.name === RoleType.CSM));
97
- }
98
-
99
- static isSuperAdmin = (user: User) : boolean => {
100
- if(!user || !user.roles) return false;
101
-
102
- return Boolean(user.roles.find(r => r.name === RoleType.SUPER_ADMIN));
103
- }
104
- }
8
+ // Properties
9
+ id: string;
10
+ roles: Role[];
11
+ firstname: string;
12
+ lastname: string;
13
+ avatar: string;
14
+ password: string;
15
+ created: Date;
16
+ billingAddress?: Address;
17
+ email?: string;
18
+ gender?: Gender;
19
+ birthDate?: Date;
20
+ phoneNumber?: string;
21
+ vehicles?: Vehicle[];
22
+ isActive?: Boolean;
23
+ hasPassword?: Boolean;
24
+ garages?: Garage[];
25
+
26
+ constructor(
27
+ id: string,
28
+ roles: Role[],
29
+ firstname: string = "",
30
+ lastname: string = "",
31
+ avatar: string = "",
32
+ password: string = "",
33
+ created: Date = new Date(),
34
+ billingAddress?: Address,
35
+ email?: string,
36
+ gender?: Gender,
37
+ birthDate?: Date,
38
+ phoneNumber?: string,
39
+ vehicles?: Vehicle[],
40
+ isActive?: Boolean,
41
+ hasPassword?: Boolean,
42
+ garages?: Garage[]
43
+ ) {
44
+ this.id = id;
45
+ this.roles = roles;
46
+ this.firstname = firstname;
47
+ this.lastname = lastname;
48
+ this.avatar = avatar;
49
+ this.email = email;
50
+ this.password = password;
51
+ this.created = created;
52
+ this.gender = gender;
53
+ this.birthDate = birthDate;
54
+ this.billingAddress = billingAddress;
55
+ this.phoneNumber = phoneNumber;
56
+ this.vehicles = vehicles;
57
+ this.isActive = isActive;
58
+ this.hasPassword = hasPassword;
59
+ this.garages = garages;
60
+ }
61
+
62
+ static getFirstLetter = (user: User): string => {
63
+ const firstLetter = user.lastname[0].toUpperCase();
64
+ return /[0-9]/.test(firstLetter) ? "0-9" : firstLetter;
65
+ };
66
+
67
+ static isGarageCustomer = (user: User): boolean => {
68
+ if (!user || !user.roles) return false;
69
+
70
+ return Boolean(user.roles.find((r) => r.name === RoleType.GARAGE_CUSTOMER));
71
+ };
72
+
73
+ static isGarageTechnician = (user: User): boolean => {
74
+ if (!user || !user.roles) return false;
75
+
76
+ return Boolean(
77
+ user.roles.find((r) => r.name === RoleType.GARAGE_TECHNICIAN)
78
+ );
79
+ };
80
+
81
+ static isGarageAdmin = (user: User): boolean => {
82
+ if (!user || !user.roles) return false;
83
+
84
+ return Boolean(user.roles.find((r) => r.name === RoleType.GARAGE_ADMIN));
85
+ };
86
+
87
+ static isSales = (user: User): boolean => {
88
+ if (!user || !user.roles) return false;
89
+
90
+ return Boolean(user.roles.find((r) => r.name === RoleType.SALES));
91
+ };
92
+
93
+ static isCsM = (user: User): boolean => {
94
+ if (!user || !user.roles) return false;
95
+
96
+ return Boolean(user.roles.find((r) => r.name === RoleType.CSM));
97
+ };
98
+
99
+ static isSuperAdmin = (user: User): boolean => {
100
+ if (!user || !user.roles) return false;
101
+
102
+ return Boolean(user.roles.find((r) => r.name === RoleType.SUPER_ADMIN));
103
+ };
104
+ }
@@ -38,6 +38,11 @@ export default class Vehicle {
38
38
  foreignPlate: boolean;
39
39
  tireBrand?: string;
40
40
  tireProfile?: string;
41
+ secondaryTireDiameter: string;
42
+ secondaryTireHeight: string;
43
+ secondaryTireSpeedIndex: string;
44
+ secondaryTireWidth: string;
45
+ secondaryTireSize: VehicleTire;
41
46
 
42
47
  constructor(
43
48
  id: number,
@@ -61,6 +66,11 @@ export default class Vehicle {
61
66
  lastInspectionDate: Date,
62
67
  lastMaintenanceDate: Date,
63
68
  foreignPlate: boolean,
69
+ secondaryTireDiameter: string,
70
+ secondaryTireHeight: string,
71
+ secondaryTireSpeedIndex: string,
72
+ secondaryTireWidth: string,
73
+ secondaryTireSize: VehicleTire,
64
74
  tireBrand?: string,
65
75
  tireProfile?: string
66
76
  ) {
@@ -87,6 +97,11 @@ export default class Vehicle {
87
97
  this.foreignPlate = foreignPlate;
88
98
  this.tireBrand = tireBrand;
89
99
  this.tireProfile = tireProfile;
100
+ this.secondaryTireDiameter = secondaryTireDiameter;
101
+ this.secondaryTireHeight = secondaryTireHeight;
102
+ this.secondaryTireSpeedIndex = secondaryTireSpeedIndex;
103
+ this.secondaryTireWidth = secondaryTireWidth;
104
+ this.secondaryTireSize = secondaryTireSize;
90
105
  }
91
106
 
92
107
  getVehicleLabel() {
@@ -1,32 +1,36 @@
1
1
  export type AddCustomerVehicleParams = {
2
- /** L'identifiant unique du garage */
3
- garageId: string;
4
- /** L'identifiant unique du client */
5
- customerId: string;
6
- /** La plaque d'immat du véhicule */
7
- plate: string;
8
- /** Le nombre de km au compteur */
9
- currentMileage?: number;
10
- /** Le nombre moyen de km par an */
11
- averageMileagePerYear?: number;
2
+ /** L'identifiant unique du garage */
3
+ garageId: string;
4
+ /** L'identifiant unique du client */
5
+ customerId: string;
6
+ /** La plaque d'immat du véhicule */
7
+ plate: string;
8
+ /** Le nombre de km au compteur */
9
+ currentMileage?: number;
10
+ /** Le nombre moyen de km par an */
11
+ averageMileagePerYear?: number;
12
12
 
13
- /** Identification du pneu (XXX XX RXX XXX) */
14
- tireWidth?: string;
15
- tireHeight?: string;
16
- tireDiameter?: string;
17
- tireSpeedIndex?: string;
18
- lastMaintenanceDate?: string;
19
- lastInspectionDate?: string;
20
- isForeignPlate?: boolean;
21
- model?: string
22
- }
13
+ /** Identification du pneu (XXX XX RXX XXX) */
14
+ tireWidth?: string;
15
+ tireHeight?: string;
16
+ tireDiameter?: string;
17
+ tireSpeedIndex?: string;
18
+ secondaryTireWidth?: string;
19
+ secondaryTireHeight?: string;
20
+ secondaryTireDiameter?: string;
21
+ secondaryTireSpeedIndex?: string;
22
+ lastMaintenanceDate?: string;
23
+ lastInspectionDate?: string;
23
24
 
25
+ isForeignPlate?: boolean;
26
+ model?: string;
27
+ };
24
28
 
25
29
  export type DeleteCustomerVehicleParams = {
26
- /** L'identifiant unique du garage */
27
- garageId: string;
28
- /** L'identifiant unique du client */
29
- customerId: string;
30
- /** L'identifiant unique du véhicule */
31
- vehicleId: string;
32
- }
30
+ /** L'identifiant unique du garage */
31
+ garageId: string;
32
+ /** L'identifiant unique du client */
33
+ customerId: string;
34
+ /** L'identifiant unique du véhicule */
35
+ vehicleId: string;
36
+ };