@bmstravel/nvp-plop-templates 0.2.61 → 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,9 +77,9 @@ const {{pascalCase name}}Model: ISequelizeModel<I{{pascalCase name}}> = {
77
77
  createdAt: {
78
78
  type: DataTypes.BIGINT,
79
79
  allowNull: false,
80
- defaultValue: function () {
80
+ {{!-- defaultValue: function () {
81
81
  return dayjs().valueOf()
82
- },
82
+ }, --}}
83
83
  },
84
84
  updatedAt: {
85
85
  type: DataTypes.BIGINT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bmstravel/nvp-plop-templates",
3
- "version": "0.2.61",
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": "6acafa3c6719a21132e6aaf8705830092afc7052"
18
+ "gitHead": "3044907dc6a3153fdf475399917155bc61656fbd"
19
19
  }