@nest-yalc-2/field-middleware 2.0.0 → 2.1.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.
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultDateTransformer = exports.enumTransformer = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const date_helper_1 = require("@node-yalc/utils/date.helper");
|
|
5
|
+
const enum_helper_1 = require("@node-yalc/utils/enum.helper");
|
|
6
6
|
const enumTransformer = (enumName) => {
|
|
7
7
|
const transformer = (value) => {
|
|
8
|
-
return (0,
|
|
8
|
+
return (0, enum_helper_1.belongsToEnum)(enumName, value) ? value : null;
|
|
9
9
|
};
|
|
10
10
|
return {
|
|
11
11
|
to: (value) => value,
|
|
@@ -16,7 +16,7 @@ exports.enumTransformer = enumTransformer;
|
|
|
16
16
|
const defaultDateTransformer = () => {
|
|
17
17
|
const transform = (value) => {
|
|
18
18
|
if (!value) {
|
|
19
|
-
return
|
|
19
|
+
return date_helper_1.DateHelper.dateToSQLDateTime(new Date());
|
|
20
20
|
}
|
|
21
21
|
return value;
|
|
22
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeorm-transformer.helper.js","sourceRoot":"","sources":["typeorm-transformer.helper.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"typeorm-transformer.helper.js","sourceRoot":"","sources":["typeorm-transformer.helper.ts"],"names":[],"mappings":";;;AAAA,8DAA0D;AAC1D,8DAA6D;AAQtD,MAAM,eAAe,GAAG,CAC7B,QAAW,EACO,EAAE;IACpB,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;QAC7C,OAAO,IAAA,2BAAa,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACvD,CAAC,CAAC;IAEF,OAAO;QACL,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;QACpB,IAAI,EAAE,WAAW;KAClB,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,eAAe,mBAW1B;AAEK,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,MAAM,SAAS,GAAG,CAAC,KAAY,EAAE,EAAE;QACjC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,wBAAU,CAAC,iBAAiB,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,CAAC,KAAW,EAAE,EAAE,CAAC,KAAK;QAC5B,EAAE,EAAE,SAAS;KACd,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,sBAAsB,0BAajC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DateHelper } from '@node-yalc/utils/date.helper
|
|
2
|
-
import { belongsToEnum } from '@node-yalc/utils/enum.helper
|
|
1
|
+
import { DateHelper } from '@node-yalc/utils/date.helper';
|
|
2
|
+
import { belongsToEnum } from '@node-yalc/utils/enum.helper';
|
|
3
3
|
import { ValueTransformer } from 'typeorm';
|
|
4
4
|
|
|
5
5
|
/**
|