@bmstravel/nvp-plop-templates 0.0.4 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,13 @@
|
|
1
|
-
import { I{{pascalCase serviceName}}Service } from "@src/types";
|
1
|
+
import { I{{pascalCase serviceName}}Service, IBaseAdapter } from "@src/types";
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
export type {{pascalCase methodName}}Params = {
|
4
|
+
|
5
|
+
}
|
6
|
+
|
7
|
+
async function {{camelCase methodName}}(payload: {{pascalCase methodName}}Params) {
|
8
|
+
const $this: I{{pascalCase serviceName}}Service = this;
|
9
|
+
const $adapter: IBaseAdapter = $this.adapter
|
10
|
+
const $cacher = $this.broker.cacher
|
5
11
|
return new $this.Promise((resolve, _reject) => {
|
6
12
|
$this.logger.info("{{pascalCase methodName}} :", payload);
|
7
13
|
resolve('ok');
|
@@ -8,7 +8,12 @@ import { STATUS } from "@src/common"
|
|
8
8
|
|
9
9
|
export interface I{{pascalCase name}} {
|
10
10
|
{{#if hasId}}
|
11
|
+
{{#eq dataTypeId "integer"}}
|
11
12
|
id: number;
|
13
|
+
{{/eq}}
|
14
|
+
{{#eq dataTypeId "uuid"}}
|
15
|
+
id: string;
|
16
|
+
{{/eq}}
|
12
17
|
{{/if}}
|
13
18
|
// BEGIN addition here
|
14
19
|
|
@@ -36,7 +41,9 @@ const {{pascalCase name}}Model: ISequelizeModel<I{{pascalCase name}}> = {
|
|
36
41
|
{{/eq}}
|
37
42
|
{{#eq dataTypeId "uuid"}}
|
38
43
|
type: DataTypes.STRING,
|
39
|
-
defaultValue:
|
44
|
+
defaultValue: function () {
|
45
|
+
return generateUuid({ _prefix: '{{truncate (camelCase name) 4}}', length: 19, replaceDash: true })
|
46
|
+
},
|
40
47
|
{{/eq}}
|
41
48
|
primaryKey: true,
|
42
49
|
},
|
@@ -32,6 +32,7 @@ const serviceName = '{{camelCase serviceName}}'
|
|
32
32
|
new DbServiceMixin("{{camelCase model}}", {
|
33
33
|
adapter: {
|
34
34
|
model: {{camelCase model}}Model,
|
35
|
+
logging: false,
|
35
36
|
// dbUri: Config.SEQUELIZE_URI,
|
36
37
|
// dbType: "mysql",
|
37
38
|
// dbHost: Config.DB_HOST,
|
@@ -67,19 +68,7 @@ const serviceName = '{{camelCase serviceName}}'
|
|
67
68
|
name: "string|min:3",
|
68
69
|
price: "number|positive",
|
69
70
|
}, */
|
70
|
-
}
|
71
|
-
hooks: {
|
72
|
-
before: {
|
73
|
-
/**
|
74
|
-
* Register a before hook for the `create` action.
|
75
|
-
*
|
76
|
-
* @param {Context} ctx
|
77
|
-
*/
|
78
|
-
create: (_ctx: moleculer.Context<any, any>) => {
|
79
|
-
// ctx.params.quantity = 0;
|
80
|
-
},
|
81
|
-
},
|
82
|
-
},
|
71
|
+
}
|
83
72
|
})
|
84
73
|
@ActionService({ serviceName })
|
85
74
|
@MethodService({ serviceName })
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bmstravel/nvp-plop-templates",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.7",
|
4
4
|
"description": "🏆 Using for plop templates",
|
5
5
|
"license": "MIT",
|
6
6
|
"main": "lib/index.js",
|
@@ -8,9 +8,6 @@
|
|
8
8
|
"/lib"
|
9
9
|
],
|
10
10
|
"scripts": {},
|
11
|
-
"dependencies": {
|
12
|
-
"sequelize": "6.21.0"
|
13
|
-
},
|
14
11
|
"publishConfig": {
|
15
12
|
"access": "public"
|
16
13
|
},
|
@@ -18,5 +15,5 @@
|
|
18
15
|
"phongnv86 <phongnguyenvan86@gmail.com>",
|
19
16
|
"phongnv86 <phongnv@media-one.vn>"
|
20
17
|
],
|
21
|
-
"gitHead": "
|
18
|
+
"gitHead": "4b89a461aa8662200dfab904b7735324b6e7912d"
|
22
19
|
}
|