@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.
- package/dist/cjs/api/resources/Transaction.d.ts +1 -0
- package/dist/cjs/api/resources/Transaction.d.ts.map +1 -1
- package/dist/cjs/api/resources/Transaction.js +3 -0
- package/dist/cjs/api/resources/Transaction.js.map +1 -1
- package/dist/cjs/api/resources/User.d.ts +8 -1
- package/dist/cjs/api/resources/User.d.ts.map +1 -1
- package/dist/cjs/api/resources/User.js +58 -0
- package/dist/cjs/api/resources/User.js.map +1 -1
- package/dist/cjs/api/resources/WorkingSchedule.d.ts +2 -1
- package/dist/cjs/api/resources/WorkingSchedule.d.ts.map +1 -1
- package/dist/cjs/api/resources/WorkingSchedule.js +3 -0
- package/dist/cjs/api/resources/WorkingSchedule.js.map +1 -1
- package/dist/cjs/types/Enum/BalanceSheet.js +2 -2
- package/dist/cjs/types/Enum/BalanceSheet.js.map +1 -1
- package/dist/cjs/types/Enum/EquipmentType.d.ts +15 -0
- package/dist/cjs/types/Enum/EquipmentType.d.ts.map +1 -1
- package/dist/cjs/types/Enum/EquipmentType.js +15 -0
- package/dist/cjs/types/Enum/EquipmentType.js.map +1 -1
- package/dist/cjs/types/Enum/PrestationType.d.ts +11 -0
- package/dist/cjs/types/Enum/PrestationType.d.ts.map +1 -1
- package/dist/cjs/types/Enum/PrestationType.js +84 -68
- package/dist/cjs/types/Enum/PrestationType.js.map +1 -1
- package/dist/cjs/types/Enum/SocietyApproval.js +6 -6
- package/dist/cjs/types/Enum/SocietyApproval.js.map +1 -1
- package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts +13 -0
- package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js +14 -1
- package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js.map +1 -1
- package/dist/cjs/types/Interface/api/user/CreateCoworker.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/user/CreateCoworker.js +11 -0
- package/dist/cjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
- package/dist/cjs/types/Interface/models/IUser.d.ts +1 -0
- package/dist/cjs/types/Interface/models/IUser.d.ts.map +1 -1
- package/dist/cjs/types/Interface/models/IUser.js.map +1 -1
- package/dist/cjs/utils/societyApproval.d.ts.map +1 -1
- package/dist/cjs/utils/societyApproval.js +22 -19
- package/dist/cjs/utils/societyApproval.js.map +1 -1
- package/dist/cjs/utils/transforms/number.transform.d.ts +3 -0
- package/dist/cjs/utils/transforms/number.transform.d.ts.map +1 -0
- package/dist/cjs/utils/transforms/number.transform.js +36 -0
- package/dist/cjs/utils/transforms/number.transform.js.map +1 -0
- package/dist/mjs/api/resources/Transaction.d.ts +1 -0
- package/dist/mjs/api/resources/Transaction.d.ts.map +1 -1
- package/dist/mjs/api/resources/Transaction.js +3 -0
- package/dist/mjs/api/resources/Transaction.js.map +1 -1
- package/dist/mjs/api/resources/User.d.ts +8 -1
- package/dist/mjs/api/resources/User.d.ts.map +1 -1
- package/dist/mjs/api/resources/User.js +58 -0
- package/dist/mjs/api/resources/User.js.map +1 -1
- package/dist/mjs/api/resources/WorkingSchedule.d.ts +2 -1
- package/dist/mjs/api/resources/WorkingSchedule.d.ts.map +1 -1
- package/dist/mjs/api/resources/WorkingSchedule.js +3 -0
- package/dist/mjs/api/resources/WorkingSchedule.js.map +1 -1
- package/dist/mjs/types/Enum/BalanceSheet.js +2 -2
- package/dist/mjs/types/Enum/BalanceSheet.js.map +1 -1
- package/dist/mjs/types/Enum/EquipmentType.d.ts +15 -0
- package/dist/mjs/types/Enum/EquipmentType.d.ts.map +1 -1
- package/dist/mjs/types/Enum/EquipmentType.js +15 -0
- package/dist/mjs/types/Enum/EquipmentType.js.map +1 -1
- package/dist/mjs/types/Enum/PrestationType.d.ts +11 -0
- package/dist/mjs/types/Enum/PrestationType.d.ts.map +1 -1
- package/dist/mjs/types/Enum/PrestationType.js +83 -67
- package/dist/mjs/types/Enum/PrestationType.js.map +1 -1
- package/dist/mjs/types/Enum/SocietyApproval.js +6 -6
- package/dist/mjs/types/Enum/SocietyApproval.js.map +1 -1
- package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts +13 -0
- package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js +16 -2
- package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js.map +1 -1
- package/dist/mjs/types/Interface/api/user/CreateCoworker.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/user/CreateCoworker.js +11 -0
- package/dist/mjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
- package/dist/mjs/types/Interface/models/IUser.d.ts +1 -0
- package/dist/mjs/types/Interface/models/IUser.d.ts.map +1 -1
- package/dist/mjs/types/Interface/models/IUser.js.map +1 -1
- package/dist/mjs/utils/societyApproval.d.ts.map +1 -1
- package/dist/mjs/utils/societyApproval.js +6 -3
- package/dist/mjs/utils/societyApproval.js.map +1 -1
- package/dist/mjs/utils/transforms/number.transform.d.ts +3 -0
- package/dist/mjs/utils/transforms/number.transform.d.ts.map +1 -0
- package/dist/mjs/utils/transforms/number.transform.js +33 -0
- package/dist/mjs/utils/transforms/number.transform.js.map +1 -0
- package/package.json +1 -1
- package/ts/api/resources/Transaction.ts +3 -0
- package/ts/api/resources/User.ts +65 -0
- package/ts/api/resources/WorkingSchedule.ts +5 -0
- package/ts/types/Enum/BalanceSheet.ts +2 -2
- package/ts/types/Enum/EquipmentType.ts +15 -0
- package/ts/types/Enum/PrestationType.ts +84 -67
- package/ts/types/Enum/SocietyApproval.ts +6 -6
- package/ts/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.ts +18 -2
- package/ts/types/Interface/api/user/CreateCoworker.ts +11 -0
- package/ts/types/Interface/models/IUser.ts +1 -0
- package/ts/utils/societyApproval.ts +10 -3
- 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()
|
|
@@ -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(
|
|
85
|
-
|
|
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 };
|