@bmstravel/nvp-plop-templates 0.2.64 → 0.2.65
Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,7 @@ export interface I{{pascalCase name}} {
|
|
20
20
|
// END addition here
|
21
21
|
{{#if hasId}}
|
22
22
|
status: STATUS
|
23
|
+
creator?: string
|
23
24
|
createdBy?: any
|
24
25
|
updatedBy?: any
|
25
26
|
deleteBy?: any
|
@@ -57,6 +58,10 @@ const {{pascalCase name}}Model: ISequelizeModel<I{{pascalCase name}}> = {
|
|
57
58
|
values: Object.values(STATUS),
|
58
59
|
defaultValue: STATUS.ACTIVE,
|
59
60
|
},
|
61
|
+
creator: {
|
62
|
+
type: DataTypes.STRING,
|
63
|
+
allowNull: true,
|
64
|
+
},
|
60
65
|
createdBy: {
|
61
66
|
type: DataTypes.STRING(15),
|
62
67
|
allowNull: true,
|
@@ -77,15 +82,30 @@ const {{pascalCase name}}Model: ISequelizeModel<I{{pascalCase name}}> = {
|
|
77
82
|
createdAt: {
|
78
83
|
type: DataTypes.BIGINT,
|
79
84
|
allowNull: false,
|
80
|
-
|
81
|
-
return
|
82
|
-
},
|
85
|
+
defaultValue: function () {
|
86
|
+
return new Date().getTime()
|
87
|
+
},
|
88
|
+
set(value: any) {
|
89
|
+
// const curVal = this.getDataValue("createdAt")
|
90
|
+
if (value == null || typeof value == "undefined") {
|
91
|
+
this.setDataValue("createdAt", new Date().getTime())
|
92
|
+
} else {
|
93
|
+
this.setDataValue("createdAt", value)
|
94
|
+
}
|
95
|
+
},
|
83
96
|
},
|
84
97
|
updatedAt: {
|
85
98
|
type: DataTypes.BIGINT,
|
86
99
|
allowNull: false,
|
87
100
|
defaultValue: function () {
|
88
|
-
return
|
101
|
+
return new Date().getTime()
|
102
|
+
},
|
103
|
+
set(value: any) {
|
104
|
+
if (value == null || typeof value == "undefined") {
|
105
|
+
this.setDataValue("updatedAt", new Date().getTime())
|
106
|
+
} else {
|
107
|
+
this.setDataValue("updatedAt", value)
|
108
|
+
}
|
89
109
|
},
|
90
110
|
},
|
91
111
|
deletedAt: { type: DataTypes.BIGINT },
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bmstravel/nvp-plop-templates",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.65",
|
4
4
|
"description": "🏆 Using for plop templates",
|
5
5
|
"license": "MIT",
|
6
6
|
"main": "lib/index.js",
|
@@ -15,5 +15,5 @@
|
|
15
15
|
"phongnv86 <phongnguyenvan86@gmail.com>",
|
16
16
|
"phongnv86 <phongnv@media-one.vn>"
|
17
17
|
],
|
18
|
-
"gitHead": "
|
18
|
+
"gitHead": "c01878afc3b49fe4d74de8665708ae673ba811de"
|
19
19
|
}
|