@bmstravel/nvp-plop-templates 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IBaseAction, IBaseAdapter, I{{pascalCase serviceName}}Service,
|
1
|
+
import { IBaseAction, IBaseAdapter, I{{pascalCase serviceName}}Service, UserAuthMeta } from "@src/types";
|
2
2
|
import { Context } from "moleculer";
|
3
3
|
import { VISIBILITY, ERR_SYSTEM } from "@src/common";
|
4
4
|
import { MoleculerRegularError } from "@src/errors";
|
@@ -89,7 +89,7 @@ const {{pascalCase actionName}}Action: IBaseAction = {
|
|
89
89
|
{{/eq}}
|
90
90
|
params: {
|
91
91
|
},
|
92
|
-
async handler(ctx: Context<{{pascalCase actionName}}Params,
|
92
|
+
async handler(ctx: Context<{{pascalCase actionName}}Params, UserAuthMeta>) {
|
93
93
|
const $this: I{{pascalCase serviceName}}Service = this;
|
94
94
|
const $adapter: IBaseAdapter = $this.adapter;
|
95
95
|
const i18next = ctx.broker.i18next
|
@@ -4,6 +4,7 @@ import dayjs from "dayjs";
|
|
4
4
|
import { generateUuid } from '@bmstravel/nvp-utils'
|
5
5
|
{{/eq}}
|
6
6
|
import { ISequelizeModel } from '@src/types'
|
7
|
+
import { STATUS } from "@src/common"
|
7
8
|
|
8
9
|
export interface I{{pascalCase name}} {
|
9
10
|
{{#if hasId}}
|
@@ -13,9 +14,14 @@ export interface I{{pascalCase name}} {
|
|
13
14
|
|
14
15
|
// END addition here
|
15
16
|
{{#if hasId}}
|
17
|
+
status: STATUS
|
18
|
+
createdBy?: any
|
19
|
+
updatedBy?: any
|
20
|
+
deleteBy?: any
|
21
|
+
isDelete?: boolean
|
16
22
|
createdAt: number;
|
17
23
|
updatedAt: number;
|
18
|
-
deletedAt
|
24
|
+
deletedAt?: number;
|
19
25
|
{{/if}}
|
20
26
|
}
|
21
27
|
|
@@ -39,6 +45,28 @@ const {{pascalCase name}}Model: ISequelizeModel<I{{pascalCase name}}> = {
|
|
39
45
|
|
40
46
|
// END addition here
|
41
47
|
{{#if hasCrudDate}}
|
48
|
+
status: {
|
49
|
+
type: DataTypes.STRING(20),
|
50
|
+
values: Object.values(STATUS),
|
51
|
+
defaultValue: STATUS.ACTIVE,
|
52
|
+
},
|
53
|
+
createdBy: {
|
54
|
+
type: DataTypes.STRING(15),
|
55
|
+
allowNull: true,
|
56
|
+
},
|
57
|
+
updatedBy: {
|
58
|
+
type: DataTypes.STRING(15),
|
59
|
+
allowNull: true,
|
60
|
+
},
|
61
|
+
deleteBy: {
|
62
|
+
type: DataTypes.STRING(15),
|
63
|
+
allowNull: true,
|
64
|
+
},
|
65
|
+
isDelete: {
|
66
|
+
type: DataTypes.BOOLEAN,
|
67
|
+
allowNull: true,
|
68
|
+
defaultValue: false,
|
69
|
+
},
|
42
70
|
createdAt: {
|
43
71
|
type: DataTypes.BIGINT,
|
44
72
|
allowNull: false,
|
@@ -1,11 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import moleculer, { Errors } from "moleculer";
|
4
|
-
import { Service, Action, Method } from "@decorator";
|
4
|
+
import { Service, Action, Method, ActionService, MethodService, HookService, EventService } from "@bmstravel/nvp-decorator";
|
5
5
|
import { VERSION, Config, VISIBILITY } from "@src/common";
|
6
|
-
import { ActionService, MethodService, HookService, EventService } from "@packages/nv-decorator";
|
7
6
|
|
8
|
-
const serviceName = {{camelCase serviceName}}
|
7
|
+
const serviceName = "{{camelCase serviceName}}"
|
9
8
|
@Service({
|
10
9
|
name: serviceName,
|
11
10
|
version: VERSION.v1,
|
package/package.json
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bmstravel/nvp-plop-templates",
|
3
|
-
"version": "0.0.
|
4
|
-
"description": "🏆
|
3
|
+
"version": "0.0.4",
|
4
|
+
"description": "🏆 Using for plop templates",
|
5
5
|
"license": "MIT",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"files": [
|
8
8
|
"/lib"
|
9
9
|
],
|
10
10
|
"scripts": {},
|
11
|
+
"dependencies": {
|
12
|
+
"sequelize": "6.21.0"
|
13
|
+
},
|
11
14
|
"publishConfig": {
|
12
15
|
"access": "public"
|
13
16
|
},
|
@@ -15,5 +18,5 @@
|
|
15
18
|
"phongnv86 <phongnguyenvan86@gmail.com>",
|
16
19
|
"phongnv86 <phongnv@media-one.vn>"
|
17
20
|
],
|
18
|
-
"gitHead": "
|
21
|
+
"gitHead": "754eeaf826bbf3d3cfaa05629cf3672ab0e29aff"
|
19
22
|
}
|