test-entity-library-asm 3.3.4 → 3.3.6
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/entities/RequestLocal.d.ts +2 -1
- package/dist/entities/RequestLocal.js +16 -4
- package/dist/transformers/dateTransformer.d.ts +2 -2
- package/dist/transformers/dateTransformer.js +4 -5
- package/package.json +1 -1
- package/src/entities/RequestLocal.ts +16 -4
- package/src/transformers/dateTransformer.ts +10 -11
|
@@ -41,12 +41,24 @@ var RequestLocal = /** @class */ (function () {
|
|
|
41
41
|
], RequestLocal.prototype, "local", void 0);
|
|
42
42
|
__decorate([
|
|
43
43
|
(0, typeorm_1.Column)({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
type: "decimal",
|
|
45
|
+
precision: 10,
|
|
46
|
+
scale: 8,
|
|
47
|
+
comment: "Costo total del pedido.",
|
|
47
48
|
}),
|
|
48
|
-
__metadata("design:type",
|
|
49
|
+
__metadata("design:type", Number)
|
|
49
50
|
], RequestLocal.prototype, "total_cost", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({
|
|
53
|
+
type: "decimal",
|
|
54
|
+
nullable: true,
|
|
55
|
+
default: null,
|
|
56
|
+
precision: 10,
|
|
57
|
+
scale: 8,
|
|
58
|
+
comment: "Columna creada para saber cuánto es la cantidad que nos falta para pagar por completo el pedido.",
|
|
59
|
+
}),
|
|
60
|
+
__metadata("design:type", Number)
|
|
61
|
+
], RequestLocal.prototype, "remaining_amount", void 0);
|
|
50
62
|
__decorate([
|
|
51
63
|
(0, typeorm_1.Column)({
|
|
52
64
|
default: 1,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ValueTransformer } from
|
|
1
|
+
import { ValueTransformer } from "typeorm";
|
|
2
2
|
export declare class DateTransformer implements ValueTransformer {
|
|
3
3
|
to(value: Date | string): string;
|
|
4
|
-
from(value: string): string;
|
|
4
|
+
from(value: string): Date | null | string;
|
|
5
5
|
}
|
|
@@ -7,14 +7,13 @@ var DateTransformer = /** @class */ (function () {
|
|
|
7
7
|
function DateTransformer() {
|
|
8
8
|
}
|
|
9
9
|
DateTransformer.prototype.to = function (value) {
|
|
10
|
-
var result = moment(value).format(
|
|
10
|
+
var result = moment(value).format("YYYY-MM-DD HH:mm:ss");
|
|
11
11
|
return result;
|
|
12
12
|
};
|
|
13
13
|
DateTransformer.prototype.from = function (value) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.format('YYYY-MM-DD HH:mm:ss');
|
|
14
|
+
if (value === null)
|
|
15
|
+
return null;
|
|
16
|
+
var result = moment.utc(value).tz((0, __1.getTimeZone)()).toDate();
|
|
18
17
|
return result;
|
|
19
18
|
};
|
|
20
19
|
return DateTransformer;
|
package/package.json
CHANGED
|
@@ -35,11 +35,23 @@ export class RequestLocal {
|
|
|
35
35
|
local: Local;
|
|
36
36
|
|
|
37
37
|
@Column({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
type: "decimal",
|
|
39
|
+
precision: 10,
|
|
40
|
+
scale: 8,
|
|
41
|
+
comment: "Costo total del pedido.",
|
|
42
|
+
})
|
|
43
|
+
total_cost: number;
|
|
44
|
+
|
|
45
|
+
@Column({
|
|
46
|
+
type: "decimal",
|
|
47
|
+
nullable: true,
|
|
48
|
+
default: null,
|
|
49
|
+
precision: 10,
|
|
50
|
+
scale: 8,
|
|
51
|
+
comment:
|
|
52
|
+
"Columna creada para saber cuánto es la cantidad que nos falta para pagar por completo el pedido.",
|
|
41
53
|
})
|
|
42
|
-
|
|
54
|
+
remaining_amount: number;
|
|
43
55
|
|
|
44
56
|
@Column({
|
|
45
57
|
default: 1,
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { ValueTransformer } from
|
|
2
|
-
import * as moment from
|
|
3
|
-
import { getTimeZone } from
|
|
1
|
+
import { ValueTransformer } from "typeorm";
|
|
2
|
+
import * as moment from "moment-timezone";
|
|
3
|
+
import { getTimeZone } from "..";
|
|
4
4
|
|
|
5
5
|
export class DateTransformer implements ValueTransformer {
|
|
6
6
|
to(value: Date | string): string {
|
|
7
|
-
const result = moment(value).format(
|
|
8
|
-
return result
|
|
7
|
+
const result = moment(value).format("YYYY-MM-DD HH:mm:ss");
|
|
8
|
+
return result;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
from(value: string): string {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return result
|
|
11
|
+
from(value: string): Date | null | string {
|
|
12
|
+
if (value === null) return null;
|
|
13
|
+
|
|
14
|
+
const result = moment.utc(value).tz(getTimeZone()).toDate();
|
|
15
|
+
return result;
|
|
17
16
|
}
|
|
18
17
|
}
|