@bmstravel/nvp-plop-templates 0.2.6 → 0.2.62

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,11 +19,24 @@ async function handler(ctx: Context<{{pascalCase actionName}}Params, UserAuthMet
19
19
 
20
20
  return {
21
21
  code: 0,
22
+ message: `Thành công`,
22
23
  data: {},
23
24
  };
24
25
  } catch(err) {
26
+ if (err instanceof MoleculerRegularError) {
27
+ throw new MoleculerRegularError({
28
+ message: err.message || i18next.t("ERR_SYSTEM", ERR_SYSTEM.message),
29
+ code: err.code || ERR_SYSTEM.code,
30
+ type: err.type || ERR_SYSTEM.type,
31
+ data: err.data || {
32
+ error: err.message,
33
+ stack: err.stack,
34
+ },
35
+ error: err,
36
+ })
37
+ }
25
38
  throw new MoleculerRegularError({
26
- message: i18next.t('ERR_SYSTEM', ERR_SYSTEM.message),
39
+ message: i18next.t("ERR_SYSTEM", ERR_SYSTEM.message),
27
40
  code: ERR_SYSTEM.code,
28
41
  type: ERR_SYSTEM.type,
29
42
  data: {
@@ -31,7 +44,7 @@ async function handler(ctx: Context<{{pascalCase actionName}}Params, UserAuthMet
31
44
  stack: err.stack,
32
45
  },
33
46
  error: err,
34
- });
47
+ })
35
48
  }
36
49
  }
37
50
 
@@ -77,12 +77,16 @@ const {{pascalCase name}}Model: ISequelizeModel<I{{pascalCase name}}> = {
77
77
  createdAt: {
78
78
  type: DataTypes.BIGINT,
79
79
  allowNull: false,
80
- defaultValue: dayjs().valueOf(),
80
+ {{!-- defaultValue: function () {
81
+ return dayjs().valueOf()
82
+ }, --}}
81
83
  },
82
84
  updatedAt: {
83
85
  type: DataTypes.BIGINT,
84
86
  allowNull: false,
85
- defaultValue: dayjs().valueOf(),
87
+ defaultValue: function () {
88
+ return dayjs().valueOf()
89
+ },
86
90
  },
87
91
  deletedAt: { type: DataTypes.BIGINT },
88
92
  {{/if}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bmstravel/nvp-plop-templates",
3
- "version": "0.2.6",
3
+ "version": "0.2.62",
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": "8e2aefd89cbc161e10838a2a479f7182e4bc41b1"
18
+ "gitHead": "3044907dc6a3153fdf475399917155bc61656fbd"
19
19
  }