@devstroupe/devkit-cli 1.1.16 → 1.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/boilerplates/angular-template/src/app/core/services/auth.service.ts +1 -1
- package/dist/boilerplates/angular-template/src/app/services/role.service.ts +1 -1
- package/dist/boilerplates/angular-template/src/app/services/user.service.ts +1 -1
- package/dist/boilerplates/nest-template/.dockerignore +8 -0
- package/dist/boilerplates/nest-template/package.json +13 -15
- package/dist/boilerplates/nest-template/src/app.module.ts +7 -10
- package/dist/boilerplates/nest-template/src/database/data-source.ts +4 -1
- package/dist/boilerplates/nest-template/src/database/migrations/1600000000000-create-roles.ts +2 -1
- package/dist/boilerplates/nest-template/src/database/migrations/1700000000000-create-users.ts +2 -2
- package/dist/boilerplates/nest-template/src/modules/auth/auth.controller.ts +1 -1
- package/dist/boilerplates/nest-template/src/modules/auth/auth.module.ts +2 -7
- package/dist/boilerplates/nest-template/src/modules/auth/auth.service.ts +13 -11
- package/dist/boilerplates/nest-template/src/modules/auth/jwt-auth.guard.ts +5 -6
- package/dist/boilerplates/nest-template/src/modules/core/core.module.ts +9 -0
- package/dist/boilerplates/nest-template/src/modules/role/infra/database/role.orm-entity.ts +4 -1
- package/dist/boilerplates/nest-template/src/modules/role/infra/database/role.repository.adapter.ts +2 -2
- package/dist/boilerplates/nest-template/src/modules/role/infra/http/role.controller.ts +1 -1
- package/dist/boilerplates/nest-template/src/modules/storage/infra/http/storage.controller.ts +1 -1
- package/dist/boilerplates/nest-template/src/modules/user/infra/database/user.orm-entity.ts +4 -1
- package/dist/boilerplates/nest-template/src/modules/user/infra/database/user.repository.adapter.ts +2 -2
- package/dist/boilerplates/nest-template/src/modules/user/infra/http/user.controller.ts +1 -1
- package/dist/boilerplates/nest-template/src/modules/user/service/user.service.ts +6 -3
- package/dist/boilerplates/nest-template/src/platform/security/security.module.ts +20 -0
- package/dist/boilerplates/nest-template/src/platform/security/security.tokens.ts +4 -0
- package/dist/boilerplates/nest-template/src/platform/security/token-verification.module.ts +22 -0
- package/dist/boilerplates/nest-template/tsconfig.json +1 -1
- package/dist/generation/backend-generator.integration.test.d.ts +1 -0
- package/dist/generation/backend-generator.integration.test.js +232 -0
- package/dist/generation/backend-layout.d.ts +15 -0
- package/dist/generation/backend-layout.js +77 -0
- package/dist/generation/backend-layout.test.d.ts +1 -0
- package/dist/generation/backend-layout.test.js +48 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +364 -205
- package/dist/migrations/entity-module-move.d.ts +16 -0
- package/dist/migrations/entity-module-move.js +98 -0
- package/dist/migrations/entity-module-move.test.d.ts +1 -0
- package/dist/migrations/entity-module-move.test.js +30 -0
- package/dist/rules/linter-rules.js +252 -22
- package/dist/rules/linter-rules.test.js +125 -0
- package/dist/templates/angular/service.template.d.ts +1 -1
- package/dist/templates/angular/service.template.js +2 -2
- package/dist/templates/generator-characterization.test.d.ts +1 -0
- package/dist/templates/generator-characterization.test.js +42 -0
- package/dist/templates/nest/crud.templates.d.ts +3 -3
- package/dist/templates/nest/crud.templates.js +20 -13
- package/dist/templates/nest/functional-module.templates.d.ts +10 -0
- package/dist/templates/nest/functional-module.templates.js +261 -0
- package/dist/templates/nest/index.d.ts +1 -1
- package/dist/templates/nest/index.js +1 -1
- package/dist/templates/nest/migration.template.js +6 -3
- package/dist/templates/relationship-templates.test.js +0 -4
- package/package.json +4 -4
- package/dist/boilerplates/angular-template/node_modules/.bin/acorn +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/browserslist +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/eslint +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/jiti +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/js-yaml +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/lessc +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/ng +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/ng-xi18n +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/ngc +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/nx +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/nx-cloud +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/sass +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/terser +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/tsc +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/tsserver +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/vite +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/vitest +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/webpack +0 -21
- package/dist/boilerplates/angular-template/node_modules/.bin/yaml +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/acorn +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/nest +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/prettier +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node-cwd +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node-esm +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node-script +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node-transpile-only +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-script +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/tsc +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/tsserver +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/typeorm +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/typeorm-ts-node-commonjs +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/typeorm-ts-node-esm +0 -21
- package/dist/boilerplates/nest-template/node_modules/.bin/webpack +0 -21
- package/dist/templates/nest/microservice.templates.d.ts +0 -4
- package/dist/templates/nest/microservice.templates.js +0 -157
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../typescript/bin/tsserver" "$@"
|
|
21
|
-
fi
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules/typeorm/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules/typeorm/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../typeorm/cli.js" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../typeorm/cli.js" "$@"
|
|
21
|
-
fi
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules/typeorm/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules/typeorm/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../typeorm/cli-ts-node-commonjs.js" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../typeorm/cli-ts-node-commonjs.js" "$@"
|
|
21
|
-
fi
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules/typeorm/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules/typeorm/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/typeorm@0.3.30_babel-plugin-macros@3.1.0_mysql2@3.22.5_@types+node@20.19.43__ts-node@10_90b76765576173e08b071ce27852c9cf/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../typeorm/cli-ts-node-esm.js" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../typeorm/cli-ts-node-esm.js" "$@"
|
|
21
|
-
fi
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/webpack@5.106.2/node_modules/webpack/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/webpack@5.106.2/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/webpack@5.106.2/node_modules/webpack/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/webpack@5.106.2/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/webpack@5.106.2/node_modules/webpack/bin/webpack.js" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../../../../node_modules/.pnpm/webpack@5.106.2/node_modules/webpack/bin/webpack.js" "$@"
|
|
21
|
-
fi
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function nestGatewayControllerTemplate(name: string): string;
|
|
2
|
-
export declare function nestGatewayModuleTemplate(name: string, defaultPort: number): string;
|
|
3
|
-
export declare function nestMsControllerTemplate(name: string): string;
|
|
4
|
-
export declare function nestMsModuleTemplate(name: string): string;
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nestGatewayControllerTemplate = nestGatewayControllerTemplate;
|
|
4
|
-
exports.nestGatewayModuleTemplate = nestGatewayModuleTemplate;
|
|
5
|
-
exports.nestMsControllerTemplate = nestMsControllerTemplate;
|
|
6
|
-
exports.nestMsModuleTemplate = nestMsModuleTemplate;
|
|
7
|
-
const names_1 = require("../shared/names");
|
|
8
|
-
function nestGatewayControllerTemplate(name) {
|
|
9
|
-
const pascalName = (0, names_1.kebabToPascal)(name);
|
|
10
|
-
const serviceToken = `${name.toUpperCase()}_SERVICE`;
|
|
11
|
-
return `import { Controller, Get, Post, Put, Delete, Body, Param, Query, Inject, UseGuards, Headers } from '@nestjs/common';
|
|
12
|
-
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
|
13
|
-
import { ClientProxy } from '@nestjs/microservices';
|
|
14
|
-
import { firstValueFrom } from 'rxjs';
|
|
15
|
-
import { Create${pascalName}Dto, Update${pascalName}Dto, Filter${pascalName}Dto } from './${name}.dto';
|
|
16
|
-
import { JwtAuthGuard } from '../../../auth/jwt-auth.guard';
|
|
17
|
-
|
|
18
|
-
@Controller('${name}')
|
|
19
|
-
@ApiTags('${name}')
|
|
20
|
-
@ApiBearerAuth()
|
|
21
|
-
@UseGuards(JwtAuthGuard)
|
|
22
|
-
export class ${pascalName}GatewayController {
|
|
23
|
-
constructor(
|
|
24
|
-
@Inject('${serviceToken}') private readonly client: ClientProxy
|
|
25
|
-
) {}
|
|
26
|
-
|
|
27
|
-
@Post()
|
|
28
|
-
async create(
|
|
29
|
-
@Body() dto: Create${pascalName}Dto,
|
|
30
|
-
@Headers('x-tenant-id') tenantId: string
|
|
31
|
-
) {
|
|
32
|
-
return firstValueFrom(this.client.send({ cmd: 'create_${name}' }, { data: dto, tenantId }));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Put(':id')
|
|
36
|
-
async update(
|
|
37
|
-
@Param('id') id: string,
|
|
38
|
-
@Body() dto: Update${pascalName}Dto,
|
|
39
|
-
@Headers('x-tenant-id') tenantId: string
|
|
40
|
-
) {
|
|
41
|
-
return firstValueFrom(this.client.send({ cmd: 'update_${name}' }, { id: Number(id), dto, tenantId }));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@Get()
|
|
45
|
-
async findMany(
|
|
46
|
-
@Query() filter: Filter${pascalName}Dto,
|
|
47
|
-
@Headers('x-tenant-id') tenantId: string
|
|
48
|
-
) {
|
|
49
|
-
return firstValueFrom(this.client.send({ cmd: 'find_many_${name}' }, { filter, tenantId }));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@Get(':id')
|
|
53
|
-
async findOne(
|
|
54
|
-
@Param('id') id: string,
|
|
55
|
-
@Headers('x-tenant-id') tenantId: string
|
|
56
|
-
) {
|
|
57
|
-
return firstValueFrom(this.client.send({ cmd: 'find_one_${name}' }, { id: Number(id), tenantId }));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@Delete(':id')
|
|
61
|
-
async delete(
|
|
62
|
-
@Param('id') id: string,
|
|
63
|
-
@Headers('x-tenant-id') tenantId: string
|
|
64
|
-
) {
|
|
65
|
-
return firstValueFrom(this.client.send({ cmd: 'delete_${name}' }, { id: Number(id), tenantId }));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
69
|
-
}
|
|
70
|
-
function nestGatewayModuleTemplate(name, defaultPort) {
|
|
71
|
-
const pascalName = (0, names_1.kebabToPascal)(name);
|
|
72
|
-
const serviceToken = `${name.toUpperCase()}_SERVICE`;
|
|
73
|
-
return `import { Module } from '@nestjs/common';
|
|
74
|
-
import { ClientsModule, Transport } from '@nestjs/microservices';
|
|
75
|
-
import { ${pascalName}GatewayController } from './infra/http/${name}.controller';
|
|
76
|
-
|
|
77
|
-
@Module({
|
|
78
|
-
imports: [
|
|
79
|
-
ClientsModule.register([
|
|
80
|
-
{
|
|
81
|
-
name: '${serviceToken}',
|
|
82
|
-
transport: Transport.TCP,
|
|
83
|
-
options: {
|
|
84
|
-
host: process.env.${name.toUpperCase()}_SERVICE_HOST || 'localhost',
|
|
85
|
-
port: Number(process.env.${name.toUpperCase()}_SERVICE_PORT) || ${defaultPort},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
]),
|
|
89
|
-
],
|
|
90
|
-
controllers: [${pascalName}GatewayController],
|
|
91
|
-
})
|
|
92
|
-
export class ${pascalName}GatewayModule {}
|
|
93
|
-
`;
|
|
94
|
-
}
|
|
95
|
-
function nestMsControllerTemplate(name) {
|
|
96
|
-
const pascalName = (0, names_1.kebabToPascal)(name);
|
|
97
|
-
const camelName = (0, names_1.kebabToCamel)(name);
|
|
98
|
-
return `import { Controller } from '@nestjs/common';
|
|
99
|
-
import { MessagePattern } from '@nestjs/microservices';
|
|
100
|
-
import { ${pascalName}Service } from '../../service/${name}.service';
|
|
101
|
-
import { Create${pascalName}Dto, Update${pascalName}Dto, Filter${pascalName}Dto } from './${name}.dto';
|
|
102
|
-
|
|
103
|
-
@Controller()
|
|
104
|
-
export class ${pascalName}MsController {
|
|
105
|
-
constructor(private readonly ${camelName}Service: ${pascalName}Service) {}
|
|
106
|
-
|
|
107
|
-
@MessagePattern({ cmd: 'create_${name}' })
|
|
108
|
-
async create(payload: { data: Create${pascalName}Dto, tenantId: string }) {
|
|
109
|
-
return this.${camelName}Service.create(payload.data);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
@MessagePattern({ cmd: 'update_${name}' })
|
|
113
|
-
async update(payload: { id: number, dto: Update${pascalName}Dto, tenantId: string }) {
|
|
114
|
-
return this.${camelName}Service.update(payload.id, payload.dto);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
@MessagePattern({ cmd: 'find_one_${name}' })
|
|
118
|
-
async findOne(payload: { id: number, tenantId: string }) {
|
|
119
|
-
return this.${camelName}Service.findOne(payload.id);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@MessagePattern({ cmd: 'find_many_${name}' })
|
|
123
|
-
async findMany(payload: { filter: Filter${pascalName}Dto, tenantId: string }) {
|
|
124
|
-
return this.${camelName}Service.findMany(payload.filter);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
@MessagePattern({ cmd: 'delete_${name}' })
|
|
128
|
-
async delete(payload: { id: number, tenantId: string }) {
|
|
129
|
-
return this.${camelName}Service.delete(payload.id);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
`;
|
|
133
|
-
}
|
|
134
|
-
function nestMsModuleTemplate(name) {
|
|
135
|
-
const pascalName = (0, names_1.kebabToPascal)(name);
|
|
136
|
-
return `import { Module } from '@nestjs/common';
|
|
137
|
-
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
138
|
-
import { ${pascalName}OrmEntity } from './infra/database/${name}.orm-entity';
|
|
139
|
-
import { ${pascalName}RepositoryAdapter } from './infra/database/${name}.repository';
|
|
140
|
-
import { ${pascalName}Service } from './service/${name}.service';
|
|
141
|
-
import { ${pascalName}MsController } from './infra/http/${name}.ms.controller';
|
|
142
|
-
|
|
143
|
-
@Module({
|
|
144
|
-
imports: [TypeOrmModule.forFeature([${pascalName}OrmEntity])],
|
|
145
|
-
controllers: [${pascalName}MsController],
|
|
146
|
-
providers: [
|
|
147
|
-
${pascalName}Service,
|
|
148
|
-
{
|
|
149
|
-
provide: 'I${pascalName}Repository',
|
|
150
|
-
useClass: ${pascalName}RepositoryAdapter,
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
exports: [${pascalName}Service],
|
|
154
|
-
})
|
|
155
|
-
export class ${pascalName}Module {}
|
|
156
|
-
`;
|
|
157
|
-
}
|