@silexpert/core 1.3.205-1 → 1.3.205-3

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 (95) 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 -1
  6. package/dist/cjs/api/resources/User.d.ts.map +1 -1
  7. package/dist/cjs/api/resources/User.js +58 -0
  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/PrestationType.d.ts +11 -0
  20. package/dist/cjs/types/Enum/PrestationType.d.ts.map +1 -1
  21. package/dist/cjs/types/Enum/PrestationType.js +84 -68
  22. package/dist/cjs/types/Enum/PrestationType.js.map +1 -1
  23. package/dist/cjs/types/Enum/SocietyApproval.js +6 -6
  24. package/dist/cjs/types/Enum/SocietyApproval.js.map +1 -1
  25. package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts +13 -0
  26. package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts.map +1 -1
  27. package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js +14 -1
  28. package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js.map +1 -1
  29. package/dist/cjs/types/Interface/api/user/CreateCoworker.d.ts.map +1 -1
  30. package/dist/cjs/types/Interface/api/user/CreateCoworker.js +11 -0
  31. package/dist/cjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
  32. package/dist/cjs/types/Interface/models/IUser.d.ts +1 -0
  33. package/dist/cjs/types/Interface/models/IUser.d.ts.map +1 -1
  34. package/dist/cjs/types/Interface/models/IUser.js.map +1 -1
  35. package/dist/cjs/utils/societyApproval.d.ts.map +1 -1
  36. package/dist/cjs/utils/societyApproval.js +22 -19
  37. package/dist/cjs/utils/societyApproval.js.map +1 -1
  38. package/dist/cjs/utils/transforms/number.transform.d.ts +3 -0
  39. package/dist/cjs/utils/transforms/number.transform.d.ts.map +1 -0
  40. package/dist/cjs/utils/transforms/number.transform.js +36 -0
  41. package/dist/cjs/utils/transforms/number.transform.js.map +1 -0
  42. package/dist/mjs/api/resources/Transaction.d.ts +1 -0
  43. package/dist/mjs/api/resources/Transaction.d.ts.map +1 -1
  44. package/dist/mjs/api/resources/Transaction.js +3 -0
  45. package/dist/mjs/api/resources/Transaction.js.map +1 -1
  46. package/dist/mjs/api/resources/User.d.ts +8 -1
  47. package/dist/mjs/api/resources/User.d.ts.map +1 -1
  48. package/dist/mjs/api/resources/User.js +58 -0
  49. package/dist/mjs/api/resources/User.js.map +1 -1
  50. package/dist/mjs/api/resources/WorkingSchedule.d.ts +2 -1
  51. package/dist/mjs/api/resources/WorkingSchedule.d.ts.map +1 -1
  52. package/dist/mjs/api/resources/WorkingSchedule.js +3 -0
  53. package/dist/mjs/api/resources/WorkingSchedule.js.map +1 -1
  54. package/dist/mjs/types/Enum/BalanceSheet.js +2 -2
  55. package/dist/mjs/types/Enum/BalanceSheet.js.map +1 -1
  56. package/dist/mjs/types/Enum/EquipmentType.d.ts +15 -0
  57. package/dist/mjs/types/Enum/EquipmentType.d.ts.map +1 -1
  58. package/dist/mjs/types/Enum/EquipmentType.js +15 -0
  59. package/dist/mjs/types/Enum/EquipmentType.js.map +1 -1
  60. package/dist/mjs/types/Enum/PrestationType.d.ts +11 -0
  61. package/dist/mjs/types/Enum/PrestationType.d.ts.map +1 -1
  62. package/dist/mjs/types/Enum/PrestationType.js +83 -67
  63. package/dist/mjs/types/Enum/PrestationType.js.map +1 -1
  64. package/dist/mjs/types/Enum/SocietyApproval.js +6 -6
  65. package/dist/mjs/types/Enum/SocietyApproval.js.map +1 -1
  66. package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts +13 -0
  67. package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts.map +1 -1
  68. package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js +16 -2
  69. package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js.map +1 -1
  70. package/dist/mjs/types/Interface/api/user/CreateCoworker.d.ts.map +1 -1
  71. package/dist/mjs/types/Interface/api/user/CreateCoworker.js +11 -0
  72. package/dist/mjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
  73. package/dist/mjs/types/Interface/models/IUser.d.ts +1 -0
  74. package/dist/mjs/types/Interface/models/IUser.d.ts.map +1 -1
  75. package/dist/mjs/types/Interface/models/IUser.js.map +1 -1
  76. package/dist/mjs/utils/societyApproval.d.ts.map +1 -1
  77. package/dist/mjs/utils/societyApproval.js +6 -3
  78. package/dist/mjs/utils/societyApproval.js.map +1 -1
  79. package/dist/mjs/utils/transforms/number.transform.d.ts +3 -0
  80. package/dist/mjs/utils/transforms/number.transform.d.ts.map +1 -0
  81. package/dist/mjs/utils/transforms/number.transform.js +33 -0
  82. package/dist/mjs/utils/transforms/number.transform.js.map +1 -0
  83. package/package.json +1 -1
  84. package/ts/api/resources/Transaction.ts +3 -0
  85. package/ts/api/resources/User.ts +65 -0
  86. package/ts/api/resources/WorkingSchedule.ts +5 -0
  87. package/ts/types/Enum/BalanceSheet.ts +2 -2
  88. package/ts/types/Enum/EquipmentType.ts +15 -0
  89. package/ts/types/Enum/PrestationType.ts +84 -67
  90. package/ts/types/Enum/SocietyApproval.ts +6 -6
  91. package/ts/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.ts +18 -2
  92. package/ts/types/Interface/api/user/CreateCoworker.ts +11 -0
  93. package/ts/types/Interface/models/IUser.ts +1 -0
  94. package/ts/utils/societyApproval.ts +10 -3
  95. package/ts/utils/transforms/number.transform.ts +38 -0
@@ -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 };