@silexpert/core 1.3.204-2 → 1.3.204-update-0

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.
Files changed (86) hide show
  1. package/dist/cjs/api/resources/Transaction.d.ts +1 -0
  2. package/dist/cjs/api/resources/Transaction.d.ts.map +1 -1
  3. package/dist/cjs/api/resources/Transaction.js +3 -0
  4. package/dist/cjs/api/resources/Transaction.js.map +1 -1
  5. package/dist/cjs/api/resources/User.d.ts +8 -4
  6. package/dist/cjs/api/resources/User.d.ts.map +1 -1
  7. package/dist/cjs/api/resources/User.js +57 -2
  8. package/dist/cjs/api/resources/User.js.map +1 -1
  9. package/dist/cjs/api/resources/WorkingSchedule.d.ts +2 -1
  10. package/dist/cjs/api/resources/WorkingSchedule.d.ts.map +1 -1
  11. package/dist/cjs/api/resources/WorkingSchedule.js +3 -0
  12. package/dist/cjs/api/resources/WorkingSchedule.js.map +1 -1
  13. package/dist/cjs/types/Enum/BalanceSheet.js +2 -2
  14. package/dist/cjs/types/Enum/BalanceSheet.js.map +1 -1
  15. package/dist/cjs/types/Enum/EquipmentType.d.ts +15 -0
  16. package/dist/cjs/types/Enum/EquipmentType.d.ts.map +1 -1
  17. package/dist/cjs/types/Enum/EquipmentType.js +15 -0
  18. package/dist/cjs/types/Enum/EquipmentType.js.map +1 -1
  19. package/dist/cjs/types/Enum/SocietyApproval.js +6 -6
  20. package/dist/cjs/types/Enum/SocietyApproval.js.map +1 -1
  21. package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts +13 -0
  22. package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts.map +1 -1
  23. package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js +14 -1
  24. package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js.map +1 -1
  25. package/dist/cjs/types/Interface/api/user/CreateCoworker.d.ts.map +1 -1
  26. package/dist/cjs/types/Interface/api/user/CreateCoworker.js +11 -0
  27. package/dist/cjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
  28. package/dist/cjs/types/Interface/models/IUser.d.ts +1 -0
  29. package/dist/cjs/types/Interface/models/IUser.d.ts.map +1 -1
  30. package/dist/cjs/types/Interface/models/IUser.js.map +1 -1
  31. package/dist/cjs/utils/societyApproval.d.ts.map +1 -1
  32. package/dist/cjs/utils/societyApproval.js +22 -19
  33. package/dist/cjs/utils/societyApproval.js.map +1 -1
  34. package/dist/cjs/utils/transforms/number.transform.d.ts +3 -0
  35. package/dist/cjs/utils/transforms/number.transform.d.ts.map +1 -0
  36. package/dist/cjs/utils/transforms/number.transform.js +36 -0
  37. package/dist/cjs/utils/transforms/number.transform.js.map +1 -0
  38. package/dist/mjs/api/resources/Transaction.d.ts +1 -0
  39. package/dist/mjs/api/resources/Transaction.d.ts.map +1 -1
  40. package/dist/mjs/api/resources/Transaction.js +3 -0
  41. package/dist/mjs/api/resources/Transaction.js.map +1 -1
  42. package/dist/mjs/api/resources/User.d.ts +8 -4
  43. package/dist/mjs/api/resources/User.d.ts.map +1 -1
  44. package/dist/mjs/api/resources/User.js +57 -2
  45. package/dist/mjs/api/resources/User.js.map +1 -1
  46. package/dist/mjs/api/resources/WorkingSchedule.d.ts +2 -1
  47. package/dist/mjs/api/resources/WorkingSchedule.d.ts.map +1 -1
  48. package/dist/mjs/api/resources/WorkingSchedule.js +3 -0
  49. package/dist/mjs/api/resources/WorkingSchedule.js.map +1 -1
  50. package/dist/mjs/types/Enum/BalanceSheet.js +2 -2
  51. package/dist/mjs/types/Enum/BalanceSheet.js.map +1 -1
  52. package/dist/mjs/types/Enum/EquipmentType.d.ts +15 -0
  53. package/dist/mjs/types/Enum/EquipmentType.d.ts.map +1 -1
  54. package/dist/mjs/types/Enum/EquipmentType.js +15 -0
  55. package/dist/mjs/types/Enum/EquipmentType.js.map +1 -1
  56. package/dist/mjs/types/Enum/SocietyApproval.js +6 -6
  57. package/dist/mjs/types/Enum/SocietyApproval.js.map +1 -1
  58. package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts +13 -0
  59. package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts.map +1 -1
  60. package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js +16 -2
  61. package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js.map +1 -1
  62. package/dist/mjs/types/Interface/api/user/CreateCoworker.d.ts.map +1 -1
  63. package/dist/mjs/types/Interface/api/user/CreateCoworker.js +11 -0
  64. package/dist/mjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
  65. package/dist/mjs/types/Interface/models/IUser.d.ts +1 -0
  66. package/dist/mjs/types/Interface/models/IUser.d.ts.map +1 -1
  67. package/dist/mjs/types/Interface/models/IUser.js.map +1 -1
  68. package/dist/mjs/utils/societyApproval.d.ts.map +1 -1
  69. package/dist/mjs/utils/societyApproval.js +6 -3
  70. package/dist/mjs/utils/societyApproval.js.map +1 -1
  71. package/dist/mjs/utils/transforms/number.transform.d.ts +3 -0
  72. package/dist/mjs/utils/transforms/number.transform.d.ts.map +1 -0
  73. package/dist/mjs/utils/transforms/number.transform.js +33 -0
  74. package/dist/mjs/utils/transforms/number.transform.js.map +1 -0
  75. package/package.json +11 -11
  76. package/ts/api/resources/Transaction.ts +3 -0
  77. package/ts/api/resources/User.ts +63 -2
  78. package/ts/api/resources/WorkingSchedule.ts +5 -0
  79. package/ts/types/Enum/BalanceSheet.ts +2 -2
  80. package/ts/types/Enum/EquipmentType.ts +15 -0
  81. package/ts/types/Enum/SocietyApproval.ts +6 -6
  82. package/ts/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.ts +18 -2
  83. package/ts/types/Interface/api/user/CreateCoworker.ts +11 -0
  84. package/ts/types/Interface/models/IUser.ts +1 -0
  85. package/ts/utils/societyApproval.ts +10 -3
  86. package/ts/utils/transforms/number.transform.ts +38 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.3.204-2",
3
+ "version": "1.3.204-update-0",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "dist/cjs/index.js",
@@ -32,11 +32,11 @@
32
32
  "author": "Silex",
33
33
  "license": "ISC",
34
34
  "devDependencies": {
35
- "@babel/cli": "^7.28.3",
36
- "@babel/core": "^7.28.5",
37
- "@babel/plugin-transform-runtime": "^7.28.5",
38
- "@babel/preset-env": "^7.28.5",
39
- "@babel/runtime": "^7.28.4",
35
+ "@babel/cli": "^7.28.6",
36
+ "@babel/core": "^7.29.0",
37
+ "@babel/plugin-transform-runtime": "^7.29.0",
38
+ "@babel/preset-env": "^7.29.0",
39
+ "@babel/runtime": "^7.28.6",
40
40
  "@types/bluebird": "^3.5.34",
41
41
  "@types/browser-or-node": "^1.3.0",
42
42
  "@types/ejs": "^3.0.6",
@@ -48,13 +48,13 @@
48
48
  "eslint-config-airbnb-typescript": "^18.0.0",
49
49
  "eslint-config-prettier": "^9.1.0",
50
50
  "husky": "^9.1.7",
51
- "prettier": "^3.7.3",
51
+ "prettier": "^3.8.1",
52
52
  "reflect-metadata": "^0.2.2",
53
- "rimraf": "^6.1.2",
53
+ "rimraf": "^6.1.3",
54
54
  "standard-version": "^9.3.0",
55
55
  "ts-node": "^10.9.2",
56
56
  "typescript": "5.9.3",
57
- "typescript-eslint": "^8.48.1"
57
+ "typescript-eslint": "^8.56.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@babel/runtime": "^7.6.3",
@@ -71,8 +71,8 @@
71
71
  "class-validator": "^0.14.3",
72
72
  "dayjs": "^1.11.11",
73
73
  "ejs": "^3.1.9",
74
- "libphonenumber-js": "^1.12.30",
75
- "mailparser": "^3.4.0",
74
+ "libphonenumber-js": "^1.12.37",
75
+ "mailparser": "^3.9.3",
76
76
  "rxjs": "^7.8.2",
77
77
  "sms-segments-calculator": "^1.2.0",
78
78
  "stripe": "18.1.1",
@@ -77,6 +77,9 @@ export class Transaction extends Resource {
77
77
  annotate(id: number, data: UpdateAccountingTransaction): Promise<ReadFormattedAccountingTransaction> {
78
78
  return this.axios.$put(`/transactions/${id}`, data);
79
79
  }
80
+ annotateAll(ids: number[], data: UpdateAccountingTransaction): Promise<ReadFormattedAccountingTransaction> {
81
+ return this.axios.$put('/transactions/annotate-all', { ids, data });
82
+ }
80
83
  delete(idSociety: number, id: number): Promise<number> {
81
84
  return this.axios.$delete(`/society/${idSociety}/transaction/${id}`);
82
85
  }
@@ -23,6 +23,9 @@ import {
23
23
  BasePaginate,
24
24
  QueryGetAllUsersPaginated,
25
25
  QueryUpdatePassword,
26
+ CreateCollaboraterDetail,
27
+ IWorkingSchedule,
28
+ ICollaboraterDetail,
26
29
  } from '../../types';
27
30
 
28
31
  export class User extends Resource {
@@ -38,6 +41,28 @@ export class User extends Resource {
38
41
  coworker(data: CreateCoworker): Promise<IUser> {
39
42
  return this.axios.$post('user/coworker', data);
40
43
  }
44
+
45
+ createCompletCoworker(data: CreateCoworker, file?: File): Promise<IUser> {
46
+ const formData = new FormData();
47
+ Object.entries(data).forEach(([key, value]) => {
48
+ if (value !== undefined && value !== null) {
49
+ if (Array.isArray(value)) {
50
+ value.forEach((v) => {
51
+ formData.append(`${key}[]`, `${v}`);
52
+ });
53
+ } else {
54
+ formData.append(key, `${value}`);
55
+ }
56
+ }
57
+ });
58
+ if (file){
59
+ formData.append('file', file);
60
+ }
61
+ return this.axios.$post('user/coworker/complete', formData, {
62
+ headers: { 'Content-Type': 'multipart/form-data' },
63
+ });
64
+ }
65
+
41
66
  updateCoworker(idUser: number, params: UpdateCorworker): Promise<IUser> {
42
67
  const formData = new FormData();
43
68
  Object.entries(params).forEach(([key, value]) => {
@@ -56,6 +81,26 @@ export class User extends Resource {
56
81
  });
57
82
  }
58
83
 
84
+ updateCompletCoworker(idUser: number, data: UpdateCorworker, file?: File): Promise<IUser> {
85
+ const formData = new FormData();
86
+ Object.entries(data).forEach(([key, value]) => {
87
+ if (value || value === false || value === 0) {
88
+ if (Array.isArray(value)) {
89
+ value.forEach((v: number | string) => {
90
+ formData.append(`${key}[]`, `${v}`);
91
+ });
92
+ } else if (key === 'file') formData.append('file', value);
93
+ else formData.append(key, `${value}`);
94
+ }
95
+ });
96
+ if (file){
97
+ formData.append('file', file);
98
+ }
99
+ return this.axios.$put(`/user/coworker/complete/${idUser}`, formData, {
100
+ headers: { 'Content-Type': 'multipart/form-data' },
101
+ });
102
+ }
103
+
59
104
  sendNewCode(id: number): Promise<IUser> {
60
105
  return this.axios.$put(`user/${id}/sendNewSmsCode`);
61
106
  }
@@ -145,7 +190,23 @@ export class User extends Resource {
145
190
  return this.axios.$post('users/prospect', body);
146
191
  }
147
192
 
148
- exists(params: { email: string }): Promise<IUser | null> {
149
- return this.axios.$get('users/exists', { params });
193
+ updateCoworkerWorkingSchedules(idUser: number, workingSchedules: IWorkingSchedule[]): Promise<IWorkingSchedule[]> {
194
+ return this.axios.$post(`users/coworker/${idUser}/working-schedules`, workingSchedules);
195
+ }
196
+
197
+ createCoworkerWorkingSchedules(idUser: number, workingSchedules: Omit<IWorkingSchedule, 'id'>[]): Promise<IWorkingSchedule[]> {
198
+ return this.axios.$post(`users/coworker/${idUser}/working-schedules`, workingSchedules);
199
+ }
200
+
201
+ createCollaboraterDetail(params: CreateCollaboraterDetail): Promise<ICollaboraterDetail> {
202
+ return this.axios.$post('collaboraters-details', params);
203
+ }
204
+
205
+ getCollaboraterDetail(idUser: number): Promise<ICollaboraterDetail> {
206
+ return this.axios.$get(`collaboraters-details/user/${idUser}`);
207
+ }
208
+
209
+ updateCollaboraterDetail(id: number, params: Partial<ICollaboraterDetail>): Promise<ICollaboraterDetail> {
210
+ return this.axios.$put(`collaboraters-details/${id}`, params);
150
211
  }
151
212
  }
@@ -6,6 +6,7 @@ import {
6
6
  ReadWorkingSchedule,
7
7
  SpecialHours,
8
8
  TimeSlots,
9
+ IWorkingSchedule
9
10
  } from '../..';
10
11
 
11
12
  export class WorkingSchedule extends Resource {
@@ -40,6 +41,10 @@ export class WorkingSchedule extends Resource {
40
41
  return this.axios.$get('workingSchedule/all');
41
42
  }
42
43
 
44
+ deleteAndCreate(idUser: number, workingSchedules: Omit<IWorkingSchedule, 'id'>[]): Promise<WorkingSchedule[]> {
45
+ return this.axios.$post(`workingSchedule/delete-and-create/${idUser}`, workingSchedules);
46
+ }
47
+
43
48
  getAvailableTimeSlots(params: QueryAvailableTimeSlot): Promise<TimeSlots[]> {
44
49
  return this.axios.$get('workingSchedule/available-time-slots', {
45
50
  params,
@@ -939,10 +939,10 @@ export const BALANCE_SHEET_LIST_PASSIVE: BalanceSheetList = [
939
939
  {
940
940
  name: BalanceSheetPassiveLabel.AVANCES_ET_ACOMPTES_RECUES,
941
941
  key: 'advancesAndDepositsReceived',
942
- accounts: ['4191'],
942
+ accounts: ['4191'], // WARN: Géré manuellement dans les liasses
943
943
  isSubcategory: true,
944
944
  total: 0,
945
- // type: 'passive', Demandé par Angelo
945
+ // type: 'passive', // Suppression demandée par Angelo
946
946
  accountsDescription: [],
947
947
  },
948
948
  {
@@ -20,61 +20,76 @@ export const EquipmentTypeDetail = [
20
20
  {
21
21
  id: EquipmentType.LAPTOP,
22
22
  label: 'Ordinateur portable',
23
+ icon: 'i-lucide-laptop'
23
24
  },
24
25
  {
25
26
  id: EquipmentType.PRINTER,
26
27
  label: 'Imprimante',
28
+ icon: 'i-lucide-printer'
27
29
  },
28
30
  {
29
31
  id: EquipmentType.PHONE,
30
32
  label: 'Téléphone',
33
+ icon: 'i-lucide-smartphone'
31
34
  },
32
35
  {
33
36
  id: EquipmentType.KEYBOARD,
34
37
  label: 'Clavier',
38
+ icon: 'i-lucide-keyboard'
35
39
  },
36
40
  {
37
41
  id: EquipmentType.MOUSE,
38
42
  label: 'Souris',
43
+ icon: 'i-lucide-mouse'
39
44
  },
40
45
  {
41
46
  id: EquipmentType.SCREEN,
42
47
  label: 'Écran',
48
+ icon: 'i-lucide-monitor'
43
49
  },
44
50
  {
45
51
  id: EquipmentType.HEADPHONE,
46
52
  label: 'Casque',
53
+ icon: 'i-lucide-headphones'
47
54
  },
48
55
  {
49
56
  id: EquipmentType.ADAPTER,
50
57
  label: 'Adaptateur',
58
+ icon: 'i-lucide-box'
51
59
  },
52
60
  {
53
61
  id: EquipmentType.WIRELESS_HEADPHONE,
54
62
  label: 'Casque sans fil',
63
+ icon: 'i-lucide-headphones'
55
64
  },
56
65
  {
57
66
  id: EquipmentType.POCKET,
58
67
  label: 'Pochette',
68
+ icon: 'i-lucide-box'
59
69
  },
60
70
  {
61
71
  id: EquipmentType.BADGE,
62
72
  label: 'Badge',
73
+ icon: 'i-lucide-badge'
63
74
  },
64
75
  {
65
76
  id: EquipmentType.CALCULATOR,
66
77
  label: 'Calculatrice',
78
+ icon: 'i-lucide-calculator'
67
79
  },
68
80
  {
69
81
  id: EquipmentType.USB_HUB,
70
82
  label: 'Hub USB',
83
+ icon: 'i-lucide-box'
71
84
  },
72
85
  {
73
86
  id: EquipmentType.NUMPAD,
74
87
  label: 'Pavé numérique',
88
+ icon: 'i-lucide-box'
75
89
  },
76
90
  {
77
91
  id: EquipmentType.EXTERN_SUPPORT,
78
92
  label: 'Support externe',
93
+ icon: 'i-lucide-box'
79
94
  },
80
95
  ] as const;
@@ -41,25 +41,25 @@ export const RegulatedConventions: RegulatedConvention[] = [
41
41
  },
42
42
  {
43
43
  id: RegulatedConventionType.CURRENT_ACCOUNT_CREDITOR,
44
- label: 'Existence d\'un compte courant créditeur',
44
+ label: "Existence d'un compte courant créditeur",
45
45
  templateName: 'CONVENTION_CURRENT_ACCOUNT_CREDITOR',
46
46
  applicableTo: [LegalFormTypeEnum.EURL, LegalFormTypeEnum.SASU],
47
47
  },
48
48
  {
49
49
  id: RegulatedConventionType.CURRENT_ACCOUNT_DEBTOR,
50
- label: 'Existence d\'un compte courant débiteur',
50
+ label: "Existence d'un compte courant débiteur",
51
51
  templateName: 'CONVENTION_CURRENT_ACCOUNT_DEBTOR',
52
52
  applicableTo: [LegalFormTypeEnum.EURL, LegalFormTypeEnum.SASU],
53
53
  },
54
54
  {
55
55
  id: RegulatedConventionType.CURRENT_ACCOUNT_WAIVER,
56
- label: 'Convention d\'abandon de compte courant sous réserve de retour à meilleure fortune',
56
+ label: "Convention d'abandon de compte courant sous réserve de retour à meilleure fortune",
57
57
  templateName: 'CONVENTION_CURRENT_ACCOUNT_WAIVER',
58
58
  applicableTo: [LegalFormTypeEnum.EURL, LegalFormTypeEnum.SASU],
59
59
  },
60
60
  {
61
61
  id: RegulatedConventionType.EMPLOYMENT_CONTRACT,
62
- label: 'Existence d\'un contrat de travail',
62
+ label: "Existence d'un contrat de travail",
63
63
  templateName: 'CONVENTION_EMPLOYMENT_CONTRACT',
64
64
  applicableTo: [LegalFormTypeEnum.EURL, LegalFormTypeEnum.SASU],
65
65
  },
@@ -71,13 +71,13 @@ export const RegulatedConventions: RegulatedConvention[] = [
71
71
  },
72
72
  {
73
73
  id: RegulatedConventionType.COMMERCIAL_LEASE,
74
- label: 'Existence d\'un bail commercial',
74
+ label: "Existence d'un bail commercial",
75
75
  templateName: 'CONVENTION_COMMERCIAL_LEASE',
76
76
  applicableTo: [LegalFormTypeEnum.EURL, LegalFormTypeEnum.SASU],
77
77
  },
78
78
  {
79
79
  id: RegulatedConventionType.RENT_SHARING,
80
- label: 'Prise en charge d\'une quote part du loyer',
80
+ label: "Prise en charge d'une quote part du loyer",
81
81
  templateName: 'CONVENTION_RENT_SHARING',
82
82
  applicableTo: [LegalFormTypeEnum.EURL, LegalFormTypeEnum.SASU],
83
83
  },
@@ -1,7 +1,7 @@
1
- import { IsBoolean, IsNumber, IsOptional } from 'class-validator';
1
+ import { IsArray, IsBoolean, IsInt, IsNumber, IsOptional } from 'class-validator';
2
2
  import { IAccountingTransaction, IImmobilization } from '../../..';
3
3
  import { IThirdParty } from '../../models/IThirdParty';
4
- import { ApiPropertyOptional } from '../../../../utils';
4
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
5
5
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
6
6
 
7
7
  export type FormImmobilization = IImmobilization;
@@ -58,6 +58,22 @@ export class UpdateAccountingTransaction {
58
58
  idAccountant?: number;
59
59
  }
60
60
 
61
+ export class UpdateAllAccountingTransaction {
62
+ @ApiProperty()
63
+ @IsArray()
64
+ @IsInt({ each: true })
65
+ ids: number[];
66
+
67
+ @ApiProperty()
68
+ data: UpdateAccountingTransaction;
69
+ }
70
+
71
+ export interface UpdatedAccountingTransactions {
72
+ processed: number;
73
+ errors: Array<{ id: number; message: string; code: string }>;
74
+ updatedTransactions: ReadFormattedAccountingTransaction[];
75
+ }
76
+
61
77
  export interface UploadedAccountingFileInfos {
62
78
  location: string;
63
79
  idFile: number;
@@ -11,8 +11,10 @@ import {
11
11
  IsPhoneNumber,
12
12
  IsString,
13
13
  } from 'class-validator';
14
+ import { Transform } from 'class-transformer';
14
15
  import { ApiProperty, ApiPropertyOptional } from '../../../../utils/decorators';
15
16
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
17
+ import { ToNumber } from '../../../../utils/transforms/number.transform';
16
18
  import { EntityType } from '../../../Enum/EntityType';
17
19
 
18
20
  export class CreateCoworker {
@@ -49,6 +51,7 @@ export class CreateCoworker {
49
51
  @ApiPropertyOptional()
50
52
  @IsOptional()
51
53
  @IsNumber()
54
+ @ToNumber()
52
55
  idCivility?: number;
53
56
 
54
57
  @ApiProperty({ default: true })
@@ -101,17 +104,25 @@ export class CreateCoworker {
101
104
  @ApiProperty()
102
105
  @IsDefined()
103
106
  @IsInt()
107
+ @ToNumber()
104
108
  idOffice: number;
105
109
 
106
110
  @ApiProperty()
107
111
  @IsDefined()
108
112
  @IsEnum(EntityType)
113
+ @ToNumber()
109
114
  entity: EntityType;
110
115
 
111
116
  @ApiPropertyOptional()
112
117
  @IsOptional()
113
118
  @IsArray()
114
119
  @IsInt({ each: true })
120
+ @Transform(({ value }: { value: any }) => {
121
+ if (Array.isArray(value)) {
122
+ return value.map((v) => Number(v));
123
+ }
124
+ return value as number;
125
+ })
115
126
  idRoles?: number[];
116
127
 
117
128
  @ApiPropertyOptional()
@@ -80,6 +80,7 @@ export interface IUser {
80
80
  idProspectIsWith?: number | null;
81
81
  apprentice?: boolean;
82
82
  flexitime?: boolean;
83
+ idOffice?: number | null;
83
84
  /**
84
85
  * @deprecated
85
86
  */
@@ -81,8 +81,15 @@ export function getApprovalDocumentInfos(
81
81
  * @returns L'objet de données formaté pour le template
82
82
  */
83
83
  export function buildApprovalTemplateData(existingApproval: ISocietyApproval, style: string): Record<string, any> {
84
- const yearInText = convertNumberToLetter(+dayjs().format('YYYY')).toLowerCase();
85
- const dayAndMonthInText = `${convertNumberToLetter(+dayjs().format('D'))} ${dayjs().locale('fr').format('MMMM').toLowerCase()}`;
84
+ const yearInText = convertNumberToLetter(
85
+ +dayjs(existingApproval?.generatingDatas?.approvalDate || null).format('YYYY'),
86
+ ).toLowerCase();
87
+ const dayAndMonthInText = `${convertNumberToLetter(+dayjs(existingApproval?.generatingDatas?.approvalDate || null).format('D'))} ${dayjs(
88
+ existingApproval?.generatingDatas?.approvalDate || null,
89
+ )
90
+ .locale('fr')
91
+ .format('MMMM')
92
+ .toLowerCase()}`;
86
93
  const brand = getBrand();
87
94
  return {
88
95
  // Variables globales
@@ -131,7 +138,7 @@ export function buildApprovalTemplateData(existingApproval: ISocietyApproval, st
131
138
  ...existingApproval?.exercice?.society,
132
139
  cityOfGreffe: getCityOfGreffeName(existingApproval?.exercice?.society?.idCityOfGreffe).toUpperCase(),
133
140
  siren: existingApproval?.exercice?.society?.siret
134
- ? siretToSiren(existingApproval.exercice.society.siret)
141
+ ? siretToSiren(existingApproval.exercice.society.siret)?.replace(/(\d{3})(\d{3})(\d{3})/, '$1 $2 $3') ?? null
135
142
  : null,
136
143
  },
137
144
  endDate: dayjs(existingApproval?.exercice?.endDate).locale('fr').format('DD MMMM YYYY').toLowerCase(),
@@ -0,0 +1,38 @@
1
+ import { Transform } from 'class-transformer';
2
+
3
+ const valueToNumber = (value: any) => {
4
+ if (value === null || value === undefined || value === '') {
5
+ return undefined;
6
+ }
7
+ if (typeof value === 'number') {
8
+ return value;
9
+ }
10
+ if (typeof value === 'string') {
11
+ const num = Number(value);
12
+ if (isNaN(num)) {
13
+ return undefined;
14
+ }
15
+ return num;
16
+ }
17
+ return undefined;
18
+ };
19
+
20
+ const ToNumber = () => {
21
+ const toPlain = Transform(
22
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
23
+ ({ value }) => value,
24
+ {
25
+ toPlainOnly: true,
26
+ },
27
+ );
28
+ const toClass = (target: any, key: string) =>
29
+ Transform(({ obj }) => valueToNumber(obj[key]), {
30
+ toClassOnly: true,
31
+ })(target, key);
32
+ return (target: any, key: string) => {
33
+ toPlain(target, key);
34
+ toClass(target, key);
35
+ };
36
+ };
37
+
38
+ export { ToNumber };