@silexpert/core 1.3.204-update-3 → 1.3.205-1
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 +0 -1
- package/dist/cjs/api/resources/Transaction.d.ts.map +1 -1
- package/dist/cjs/api/resources/Transaction.js +0 -3
- package/dist/cjs/api/resources/Transaction.js.map +1 -1
- package/dist/cjs/api/resources/User.d.ts +1 -8
- package/dist/cjs/api/resources/User.d.ts.map +1 -1
- package/dist/cjs/api/resources/User.js +0 -58
- package/dist/cjs/api/resources/User.js.map +1 -1
- package/dist/cjs/api/resources/UsersHistory.d.ts +11 -0
- package/dist/cjs/api/resources/UsersHistory.d.ts.map +1 -0
- package/dist/cjs/api/resources/UsersHistory.js +26 -0
- package/dist/cjs/api/resources/UsersHistory.js.map +1 -0
- package/dist/cjs/api/resources/WorkingSchedule.d.ts +1 -2
- package/dist/cjs/api/resources/WorkingSchedule.d.ts.map +1 -1
- package/dist/cjs/api/resources/WorkingSchedule.js +0 -3
- package/dist/cjs/api/resources/WorkingSchedule.js.map +1 -1
- package/dist/cjs/api/resources.d.ts +2 -0
- package/dist/cjs/api/resources.d.ts.map +1 -1
- package/dist/cjs/api/resources.js +2 -0
- package/dist/cjs/api/resources.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 +0 -15
- package/dist/cjs/types/Enum/EquipmentType.d.ts.map +1 -1
- package/dist/cjs/types/Enum/EquipmentType.js +0 -15
- package/dist/cjs/types/Enum/EquipmentType.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/Enum/UsersHistory.d.ts +16 -0
- package/dist/cjs/types/Enum/UsersHistory.d.ts.map +1 -0
- package/dist/cjs/types/Enum/UsersHistory.js +38 -0
- package/dist/cjs/types/Enum/UsersHistory.js.map +1 -0
- package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts +0 -13
- package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js +1 -14
- 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 +0 -11
- package/dist/cjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
- package/dist/cjs/types/Interface/api/usersHistory/Create.d.ts +8 -0
- package/dist/cjs/types/Interface/api/usersHistory/Create.d.ts.map +1 -0
- package/dist/cjs/types/Interface/api/usersHistory/Create.js +35 -0
- package/dist/cjs/types/Interface/api/usersHistory/Create.js.map +1 -0
- package/dist/cjs/types/Interface/api/usersHistory/Update.d.ts +7 -0
- package/dist/cjs/types/Interface/api/usersHistory/Update.d.ts.map +1 -0
- package/dist/cjs/types/Interface/api/usersHistory/Update.js +31 -0
- package/dist/cjs/types/Interface/api/usersHistory/Update.js.map +1 -0
- package/dist/cjs/types/Interface/api/webmail/CreateMailFromLambda.d.ts +7 -6
- package/dist/cjs/types/Interface/api/webmail/CreateMailFromLambda.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/webmail/CreateMailFromLambda.js +1 -2
- package/dist/cjs/types/Interface/api/webmail/CreateMailFromLambda.js.map +1 -1
- package/dist/cjs/types/Interface/models/IUser.d.ts +0 -1
- 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/types/Interface/models/IUsersHistory.d.ts +14 -0
- package/dist/cjs/types/Interface/models/IUsersHistory.d.ts.map +1 -0
- package/dist/cjs/types/Interface/models/IUsersHistory.js +3 -0
- package/dist/cjs/types/Interface/models/IUsersHistory.js.map +1 -0
- package/dist/cjs/types/index.d.ts +4 -0
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js +4 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/utils/societyApproval.d.ts.map +1 -1
- package/dist/cjs/utils/societyApproval.js +19 -22
- package/dist/cjs/utils/societyApproval.js.map +1 -1
- package/dist/mjs/api/resources/Transaction.d.ts +0 -1
- package/dist/mjs/api/resources/Transaction.d.ts.map +1 -1
- package/dist/mjs/api/resources/Transaction.js +0 -3
- package/dist/mjs/api/resources/Transaction.js.map +1 -1
- package/dist/mjs/api/resources/User.d.ts +1 -8
- package/dist/mjs/api/resources/User.d.ts.map +1 -1
- package/dist/mjs/api/resources/User.js +0 -58
- package/dist/mjs/api/resources/User.js.map +1 -1
- package/dist/mjs/api/resources/UsersHistory.d.ts +11 -0
- package/dist/mjs/api/resources/UsersHistory.d.ts.map +1 -0
- package/dist/mjs/api/resources/UsersHistory.js +28 -0
- package/dist/mjs/api/resources/UsersHistory.js.map +1 -0
- package/dist/mjs/api/resources/WorkingSchedule.d.ts +1 -2
- package/dist/mjs/api/resources/WorkingSchedule.d.ts.map +1 -1
- package/dist/mjs/api/resources/WorkingSchedule.js +0 -3
- package/dist/mjs/api/resources/WorkingSchedule.js.map +1 -1
- package/dist/mjs/api/resources.d.ts +2 -0
- package/dist/mjs/api/resources.d.ts.map +1 -1
- package/dist/mjs/api/resources.js +2 -0
- package/dist/mjs/api/resources.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 +0 -15
- package/dist/mjs/types/Enum/EquipmentType.d.ts.map +1 -1
- package/dist/mjs/types/Enum/EquipmentType.js +0 -15
- package/dist/mjs/types/Enum/EquipmentType.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/Enum/UsersHistory.d.ts +16 -0
- package/dist/mjs/types/Enum/UsersHistory.d.ts.map +1 -0
- package/dist/mjs/types/Enum/UsersHistory.js +35 -0
- package/dist/mjs/types/Enum/UsersHistory.js.map +1 -0
- package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts +0 -13
- package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.js +2 -16
- 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 +0 -11
- package/dist/mjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
- package/dist/mjs/types/Interface/api/usersHistory/Create.d.ts +8 -0
- package/dist/mjs/types/Interface/api/usersHistory/Create.d.ts.map +1 -0
- package/dist/mjs/types/Interface/api/usersHistory/Create.js +34 -0
- package/dist/mjs/types/Interface/api/usersHistory/Create.js.map +1 -0
- package/dist/mjs/types/Interface/api/usersHistory/Update.d.ts +7 -0
- package/dist/mjs/types/Interface/api/usersHistory/Update.d.ts.map +1 -0
- package/dist/mjs/types/Interface/api/usersHistory/Update.js +29 -0
- package/dist/mjs/types/Interface/api/usersHistory/Update.js.map +1 -0
- package/dist/mjs/types/Interface/api/webmail/CreateMailFromLambda.d.ts +7 -6
- package/dist/mjs/types/Interface/api/webmail/CreateMailFromLambda.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/webmail/CreateMailFromLambda.js +7 -8
- package/dist/mjs/types/Interface/api/webmail/CreateMailFromLambda.js.map +1 -1
- package/dist/mjs/types/Interface/models/IUser.d.ts +0 -1
- 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/types/Interface/models/IUsersHistory.d.ts +14 -0
- package/dist/mjs/types/Interface/models/IUsersHistory.d.ts.map +1 -0
- package/dist/mjs/types/Interface/models/IUsersHistory.js +2 -0
- package/dist/mjs/types/Interface/models/IUsersHistory.js.map +1 -0
- package/dist/mjs/types/index.d.ts +4 -0
- package/dist/mjs/types/index.d.ts.map +1 -1
- package/dist/mjs/types/index.js +4 -0
- package/dist/mjs/types/index.js.map +1 -1
- package/dist/mjs/utils/societyApproval.d.ts.map +1 -1
- package/dist/mjs/utils/societyApproval.js +3 -6
- package/dist/mjs/utils/societyApproval.js.map +1 -1
- package/package.json +12 -10
- package/ts/api/resources/Transaction.ts +0 -3
- package/ts/api/resources/User.ts +0 -65
- package/ts/api/resources/UsersHistory.ts +35 -0
- package/ts/api/resources/WorkingSchedule.ts +0 -5
- package/ts/api/resources.ts +2 -0
- package/ts/types/Enum/BalanceSheet.ts +2 -2
- package/ts/types/Enum/EquipmentType.ts +0 -15
- package/ts/types/Enum/SocietyApproval.ts +6 -6
- package/ts/types/Enum/UsersHistory.ts +38 -0
- package/ts/types/Interface/api/accountingEntry/AnnotateAccountingTransaction.ts +2 -18
- package/ts/types/Interface/api/user/CreateCoworker.ts +0 -11
- package/ts/types/Interface/api/usersHistory/Create.ts +21 -0
- package/ts/types/Interface/api/usersHistory/Update.ts +17 -0
- package/ts/types/Interface/api/webmail/CreateMailFromLambda.ts +8 -7
- package/ts/types/Interface/models/IUser.ts +0 -1
- package/ts/types/Interface/models/IUsersHistory.ts +17 -0
- package/ts/types/index.ts +5 -0
- package/ts/utils/societyApproval.ts +3 -10
- package/dist/cjs/utils/transforms/number.transform.d.ts +0 -3
- package/dist/cjs/utils/transforms/number.transform.d.ts.map +0 -1
- package/dist/cjs/utils/transforms/number.transform.js +0 -36
- package/dist/cjs/utils/transforms/number.transform.js.map +0 -1
- package/dist/mjs/utils/transforms/number.transform.d.ts +0 -3
- package/dist/mjs/utils/transforms/number.transform.d.ts.map +0 -1
- package/dist/mjs/utils/transforms/number.transform.js +0 -33
- package/dist/mjs/utils/transforms/number.transform.js.map +0 -1
- package/ts/utils/transforms/number.transform.ts +0 -38
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IUser } from './IUser';
|
|
2
|
+
import { TypeUserHistory } from '../../Enum/UsersHistory';
|
|
3
|
+
|
|
4
|
+
export interface IUsersHistory {
|
|
5
|
+
id?: number;
|
|
6
|
+
idUser: number;
|
|
7
|
+
idAuthor?: number | null;
|
|
8
|
+
comment?: string | null;
|
|
9
|
+
actionType: TypeUserHistory;
|
|
10
|
+
createdAt?: Date | null;
|
|
11
|
+
updatedAt?: Date | null;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
// Relations
|
|
15
|
+
user?: IUser;
|
|
16
|
+
author?: IUser;
|
|
17
|
+
}
|
package/ts/types/index.ts
CHANGED
|
@@ -329,6 +329,7 @@ export * from './Interface/models/IDocumentRequest';
|
|
|
329
329
|
export * from './Interface/models/IInformationRequest';
|
|
330
330
|
export * from './Interface/models/IRevenueMovement';
|
|
331
331
|
export * from './Interface/models/IRevenueSnapshot';
|
|
332
|
+
export * from './Interface/models/IUsersHistory';
|
|
332
333
|
|
|
333
334
|
// Schemas
|
|
334
335
|
export * from './Interface/schemas/IRegistrationDetail';
|
|
@@ -568,6 +569,7 @@ export * from './Enum/InformationRequestType';
|
|
|
568
569
|
export * from './Enum/InformationRequestState';
|
|
569
570
|
export * from './Enum/Revenue';
|
|
570
571
|
export * from './Enum/EbookIntention';
|
|
572
|
+
export * from './Enum/UsersHistory';
|
|
571
573
|
|
|
572
574
|
// Interfaces API
|
|
573
575
|
export * from './Interface/api/authentification/AuthenticationResponse';
|
|
@@ -792,6 +794,9 @@ export * from './Interface/api/constitutionHistory/QueryPaginatedConstitutionHis
|
|
|
792
794
|
export * from './Interface/api/userSpecialDay/BodyUserSpecialDay';
|
|
793
795
|
export * from './Interface/api/userSpecialDay/QueryUserSpecialDay';
|
|
794
796
|
export * from './Interface/api/oldExportInfo/OldExpertInfos';
|
|
797
|
+
export * from './Interface/api/usersHistory/Create';
|
|
798
|
+
export * from './Interface/api/usersHistory/Update';
|
|
799
|
+
|
|
795
800
|
|
|
796
801
|
// export * from './Interface/api/survey/QuerySurvey';
|
|
797
802
|
export * from './Interface/api/survey/ReadSurvey';
|
|
@@ -81,15 +81,8 @@ 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
|
-
|
|
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()}`;
|
|
84
|
+
const yearInText = convertNumberToLetter(+dayjs().format('YYYY')).toLowerCase();
|
|
85
|
+
const dayAndMonthInText = `${convertNumberToLetter(+dayjs().format('D'))} ${dayjs().locale('fr').format('MMMM').toLowerCase()}`;
|
|
93
86
|
const brand = getBrand();
|
|
94
87
|
return {
|
|
95
88
|
// Variables globales
|
|
@@ -138,7 +131,7 @@ export function buildApprovalTemplateData(existingApproval: ISocietyApproval, st
|
|
|
138
131
|
...existingApproval?.exercice?.society,
|
|
139
132
|
cityOfGreffe: getCityOfGreffeName(existingApproval?.exercice?.society?.idCityOfGreffe).toUpperCase(),
|
|
140
133
|
siren: existingApproval?.exercice?.society?.siret
|
|
141
|
-
? siretToSiren(existingApproval.exercice.society.siret)
|
|
134
|
+
? siretToSiren(existingApproval.exercice.society.siret)
|
|
142
135
|
: null,
|
|
143
136
|
},
|
|
144
137
|
endDate: dayjs(existingApproval?.exercice?.endDate).locale('fr').format('DD MMMM YYYY').toLowerCase(),
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.transform.d.ts","sourceRoot":"","sources":["../../../../ts/utils/transforms/number.transform.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,QAAQ,SAYJ,QAAQ,GAAG,EAAE,KAAK,MAAM,SAIjC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToNumber = void 0;
|
|
4
|
-
const class_transformer_1 = require("class-transformer");
|
|
5
|
-
const valueToNumber = (value) => {
|
|
6
|
-
if (value === null || value === undefined || value === '') {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
if (typeof value === 'number') {
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
if (typeof value === 'string') {
|
|
13
|
-
const num = Number(value);
|
|
14
|
-
if (isNaN(num)) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
return num;
|
|
18
|
-
}
|
|
19
|
-
return undefined;
|
|
20
|
-
};
|
|
21
|
-
const ToNumber = () => {
|
|
22
|
-
const toPlain = (0, class_transformer_1.Transform)(
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
24
|
-
({ value }) => value, {
|
|
25
|
-
toPlainOnly: true,
|
|
26
|
-
});
|
|
27
|
-
const toClass = (target, key) => (0, class_transformer_1.Transform)(({ obj }) => valueToNumber(obj[key]), {
|
|
28
|
-
toClassOnly: true,
|
|
29
|
-
})(target, key);
|
|
30
|
-
return (target, key) => {
|
|
31
|
-
toPlain(target, key);
|
|
32
|
-
toClass(target, key);
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
exports.ToNumber = ToNumber;
|
|
36
|
-
//# sourceMappingURL=number.transform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.transform.js","sourceRoot":"","sources":["../../../../ts/utils/transforms/number.transform.ts"],"names":[],"mappings":";;;AAAA,yDAA8C;AAE9C,MAAM,aAAa,GAAG,CAAC,KAAU,EAAE,EAAE;IACnC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC1D,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,GAAG,EAAE;IACpB,MAAM,OAAO,GAAG,IAAA,6BAAS;IACvB,+DAA+D;IAC/D,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,EACpB;QACE,WAAW,EAAE,IAAI;KAClB,CACF,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,MAAW,EAAE,GAAW,EAAE,EAAE,CAC3C,IAAA,6BAAS,EAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;QAC9C,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClB,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,EAAE;QAClC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACrB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC,CAAC;AAEO,4BAAQ","sourcesContent":["import { Transform } from 'class-transformer';\n\nconst valueToNumber = (value: any) => {\n if (value === null || value === undefined || value === '') {\n return undefined;\n }\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'string') {\n const num = Number(value);\n if (isNaN(num)) {\n return undefined;\n }\n return num;\n }\n return undefined;\n};\n\nconst ToNumber = () => {\n const toPlain = Transform(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n ({ value }) => value,\n {\n toPlainOnly: true,\n },\n );\n const toClass = (target: any, key: string) =>\n Transform(({ obj }) => valueToNumber(obj[key]), {\n toClassOnly: true,\n })(target, key);\n return (target: any, key: string) => {\n toPlain(target, key);\n toClass(target, key);\n };\n};\n\nexport { ToNumber };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.transform.d.ts","sourceRoot":"","sources":["../../../../ts/utils/transforms/number.transform.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,QAAQ,SAYJ,QAAQ,GAAG,EAAE,KAAK,MAAM,SAIjC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Transform } from 'class-transformer';
|
|
2
|
-
const valueToNumber = (value) => {
|
|
3
|
-
if (value === null || value === undefined || value === '') {
|
|
4
|
-
return undefined;
|
|
5
|
-
}
|
|
6
|
-
if (typeof value === 'number') {
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
if (typeof value === 'string') {
|
|
10
|
-
const num = Number(value);
|
|
11
|
-
if (isNaN(num)) {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
return num;
|
|
15
|
-
}
|
|
16
|
-
return undefined;
|
|
17
|
-
};
|
|
18
|
-
const ToNumber = () => {
|
|
19
|
-
const toPlain = Transform(
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
21
|
-
({ value }) => value, {
|
|
22
|
-
toPlainOnly: true,
|
|
23
|
-
});
|
|
24
|
-
const toClass = (target, key) => Transform(({ obj }) => valueToNumber(obj[key]), {
|
|
25
|
-
toClassOnly: true,
|
|
26
|
-
})(target, key);
|
|
27
|
-
return (target, key) => {
|
|
28
|
-
toPlain(target, key);
|
|
29
|
-
toClass(target, key);
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export { ToNumber };
|
|
33
|
-
//# sourceMappingURL=number.transform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.transform.js","sourceRoot":"","sources":["../../../../ts/utils/transforms/number.transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,aAAa,GAAG,CAAC,KAAU,EAAE,EAAE;IACnC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC1D,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,GAAG,EAAE;IACpB,MAAM,OAAO,GAAG,SAAS;IACvB,+DAA+D;IAC/D,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,EACpB;QACE,WAAW,EAAE,IAAI;KAClB,CACF,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,MAAW,EAAE,GAAW,EAAE,EAAE,CAC3C,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;QAC9C,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClB,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,EAAE;QAClC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACrB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import { Transform } from 'class-transformer';\n\nconst valueToNumber = (value: any) => {\n if (value === null || value === undefined || value === '') {\n return undefined;\n }\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'string') {\n const num = Number(value);\n if (isNaN(num)) {\n return undefined;\n }\n return num;\n }\n return undefined;\n};\n\nconst ToNumber = () => {\n const toPlain = Transform(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n ({ value }) => value,\n {\n toPlainOnly: true,\n },\n );\n const toClass = (target: any, key: string) =>\n Transform(({ obj }) => valueToNumber(obj[key]), {\n toClassOnly: true,\n })(target, key);\n return (target: any, key: string) => {\n toPlain(target, key);\n toClass(target, key);\n };\n};\n\nexport { ToNumber };\n"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
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 };
|