@bmstravel/nvp-plop-templates 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,69 @@
|
|
1
|
-
import {
|
1
|
+
import { IBaseService, IBaseAction, Event } from "@src/types"
|
2
2
|
import {
|
3
3
|
/* MOL_METHODTYPE_MIXIN */
|
4
|
+
{{#if mixinMethod}}
|
5
|
+
{{pascalCase mixinMethod}}Params,
|
6
|
+
{{/if}}
|
7
|
+
{{#if mixinAction}}
|
8
|
+
{{pascalCase mixinAction}}Params,
|
9
|
+
{{/if}}
|
10
|
+
{{#if mixinEvent}}
|
11
|
+
{{pascalCase mixinEvent}}Params,
|
12
|
+
{{/if}}
|
4
13
|
} from "./interfaces/{{camelCase mixinName}}.type"
|
5
|
-
import { RedisCacher } from "@bmstravel/nvp-cacher"
|
6
14
|
|
7
15
|
export const {{pascalCase mixinName}}Mixin = () => {
|
16
|
+
{{#if mixinMethod}}
|
8
17
|
const methods = {
|
9
18
|
/* MOL_METHOD_MIXIN */
|
19
|
+
async {{camelCase mixinMethod}}({ }: {{pascalCase mixinMethod}}Params) {
|
20
|
+
const $this: IBaseService<any, any> = this
|
21
|
+
const $cacher = $this.broker.cacher as RedisCacher
|
22
|
+
return {}
|
23
|
+
},
|
10
24
|
}
|
25
|
+
{{/if}}
|
26
|
+
{{#if mixinAction}}
|
27
|
+
const actions: { [x: string]: IBaseAction } = {
|
28
|
+
/* MOL_ACTION_MIXIN */
|
29
|
+
async {{camelCase mixinAction}}({ }: {{pascalCase mixinAction}}Params) {
|
30
|
+
const $this: IBaseService<any, any> = this
|
31
|
+
return {
|
32
|
+
code: 0,
|
33
|
+
data: {}
|
34
|
+
}
|
35
|
+
},
|
36
|
+
}
|
37
|
+
{{/if}}
|
38
|
+
{{#if mixinEvent}}
|
39
|
+
const events: { [x: string]: Event } = {
|
40
|
+
/* MOL_EVENT_MIXIN */
|
41
|
+
"{{camelCase mixinEvent}}": {
|
42
|
+
params: {},
|
43
|
+
handler(ctx: Context<{{pascalCase mixinEvent}}Params, any>) {
|
44
|
+
const $this: IBaseService<any, any> = this
|
45
|
+
$this.logger.info("Event received, parameters OK!", ctx.params);
|
46
|
+
return {
|
47
|
+
code: 0,
|
48
|
+
data: {}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
{{/if}}
|
11
54
|
return {
|
12
|
-
|
55
|
+
{{#if mixinMixin}}
|
56
|
+
mixins: [],
|
57
|
+
{{/if}}
|
58
|
+
{{#if mixinMethod}}
|
13
59
|
methods,
|
60
|
+
{{/if}}
|
61
|
+
{{#if mixinAction}}
|
62
|
+
actions,
|
63
|
+
{{/if}}
|
64
|
+
{{#if mixinEvent}}
|
65
|
+
events,
|
66
|
+
{{/if}}
|
14
67
|
}
|
15
68
|
}
|
16
69
|
|
@@ -1,2 +1,11 @@
|
|
1
1
|
/* MOL_METHOD_MIXIN */
|
2
|
+
{{#if mixinMethod}}
|
3
|
+
export type {{pascalCase mixinMethod}}Params = {}
|
4
|
+
{{/if}}
|
5
|
+
{{#if mixinAction}}
|
6
|
+
export type {{pascalCase mixinAction}}Params = {}
|
7
|
+
{{/if}}
|
8
|
+
{{#if mixinEvent}}
|
9
|
+
export type {{pascalCase mixinEvent}}Params = {}
|
10
|
+
{{/if}}
|
2
11
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bmstravel/nvp-plop-templates",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.7",
|
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": "5994e445edb1297724a87a732e6cadbd698999ce"
|
19
19
|
}
|