@bmstravel/nvp-plop-templates 0.0.6 → 0.0.9

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
- async function {{camelCase methodName}}(payload: any) {
4
- const $this: I{{pascalCase serviceName}}Service = this as any;
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');
@@ -0,0 +1,2 @@
1
+ /* MOL_IMPORT_MIXIN */
2
+ export * from "./{{camelCase mixinName}}.mixin"
@@ -0,0 +1,15 @@
1
+ import { Service, ServiceSchema } from "moleculer"
2
+ import {
3
+ {{camelCase mixinMethod}}Params
4
+ } from "./interfaces/{{pascalCase mixinName}}.type"
5
+ import { RedisCacher } from "@bmstravel/nvp-cacher"
6
+
7
+ export const {{pascalCase mixinName}}Mixin: () => Partial<ServiceSchema> = () => {
8
+ const methods = {
9
+ /* MOL_METHOD_MIXIN */
10
+ }
11
+ return {
12
+ // mixins: [],
13
+ methods,
14
+ }
15
+ }
@@ -0,0 +1,2 @@
1
+ /* MOL_METHOD_MIXIN */
2
+
@@ -1,20 +1,17 @@
1
1
  import { Options } from '@bmstravel/nvp-decorator';
2
2
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
3
  import { ServiceActionsSchema } from "moleculer";
4
- import { DbServiceSettings } from 'moleculer-db';
5
4
  import {
6
5
  IBaseService,
7
6
  IBaseServiceActions,
8
7
  IBaseServiceMethods,
9
8
  } from "./db.service-interface";
10
9
 
11
- export interface {{pascalCase serviceName}}ServiceSettingsOptions extends Omit<DbServiceSettings, "fields"> {
10
+ export interface {{pascalCase serviceName}}ServiceSettingsOptions {
12
11
  /**
13
12
  * if implements will replace /v1/{{camelCase serviceName}}/* to /{{camelCase serviceName}}/*
14
13
  */
15
14
  rest?: "/{{camelCase serviceName}}";
16
- fields?: (keyof Required<any>)[];
17
- populates?: any;
18
15
  [x: string]: any;
19
16
  }
20
17
 
@@ -0,0 +1,52 @@
1
+ import { Options } from '@bmstravel/nvp-decorator';
2
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
+ import { ServiceActionsSchema } from "moleculer";
4
+ import { DbServiceSettings } from 'moleculer-db';
5
+ import {
6
+ IBaseService,
7
+ IBaseServiceActions,
8
+ IBaseServiceMethods,
9
+ } from "./db.service-interface";
10
+
11
+ export interface {{pascalCase serviceName}}ServiceSettingsOptions extends Omit<DbServiceSettings, "fields"> {
12
+ /**
13
+ * if implements will replace /v1/{{camelCase serviceName}}/* to /{{camelCase serviceName}}/*
14
+ */
15
+ rest?: "/{{camelCase serviceName}}";
16
+ fields?: (keyof Required<any>)[];
17
+ populates?: any;
18
+ [x: string]: any;
19
+ }
20
+
21
+ export interface {{pascalCase serviceName}}ServiceOptions extends Options {
22
+ name: '{{camelCase serviceName}}';
23
+ settings: {{pascalCase serviceName}}ServiceSettingsOptions;
24
+ }
25
+
26
+ export enum {{pascalCase serviceName}}Action {
27
+ // DELETED = 'user.deleted'
28
+ }
29
+
30
+ export enum {{pascalCase serviceName}}Event {
31
+ // DELETED = 'user.deleted'
32
+ }
33
+
34
+ export enum {{pascalCase serviceName}}RouterAlias {
35
+ // {{constantCase serviceName}} = "v1.{{pascalCase serviceName}}",
36
+ }
37
+
38
+ export interface I{{pascalCase serviceName}}Actions extends IBaseServiceActions {
39
+ /* MOL_ACTION */
40
+ {{#if hasHelloAction}}
41
+ hello: ServiceActionsSchema;
42
+ {{/if}}
43
+ }
44
+
45
+ export interface I{{pascalCase serviceName}}Methods extends IBaseServiceMethods {
46
+ /* MOL_METHOD */
47
+ }
48
+
49
+ export interface I{{pascalCase serviceName}}Service extends IBaseService<I{{pascalCase serviceName}}Actions, I{{pascalCase serviceName}}Methods>, I{{pascalCase serviceName}}Methods {
50
+ actions: I{{pascalCase serviceName}}Actions;
51
+ methods: I{{pascalCase serviceName}}Methods;
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bmstravel/nvp-plop-templates",
3
- "version": "0.0.6",
3
+ "version": "0.0.9",
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": "c5c074227eee5a84dfd178ad31324a4ba452f0dd"
18
+ "gitHead": "77d403877854f9d62d2d748e8d28778653626281"
19
19
  }