@devstroupe/devkit-cli 1.0.0 → 1.1.0
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/dist/boilerplates/angular-template/node_modules/.bin/acorn +21 -0
- package/dist/boilerplates/angular-template/node_modules/.bin/eslint +21 -0
- package/dist/boilerplates/angular-template/node_modules/.bin/js-yaml +21 -0
- package/dist/boilerplates/angular-template/node_modules/.bin/ng +2 -2
- package/dist/boilerplates/angular-template/node_modules/.bin/nx +21 -0
- package/dist/boilerplates/angular-template/node_modules/.bin/nx-cloud +21 -0
- package/dist/boilerplates/angular-template/node_modules/.bin/sass +4 -4
- package/dist/boilerplates/angular-template/node_modules/.bin/vite +4 -4
- package/dist/boilerplates/angular-template/node_modules/.bin/webpack +21 -0
- package/dist/boilerplates/angular-template/package.json +1 -1
- package/dist/boilerplates/angular-template/src/app/app.config.ts +3 -0
- package/dist/boilerplates/angular-template/src/app/app.routes.ts +7 -0
- package/dist/boilerplates/angular-template/src/app/modules/role/role-permissions.component.css +38 -0
- package/dist/boilerplates/angular-template/src/app/modules/role/role-permissions.component.html +175 -0
- package/dist/boilerplates/angular-template/src/app/modules/role/role-permissions.component.ts +134 -0
- package/dist/boilerplates/angular-template/src/app/services/role.service.ts +12 -0
- package/dist/boilerplates/angular-template/src/app/services/user.service.ts +12 -0
- package/dist/boilerplates/angular-template/src/app/shared/components/unauthorized/unauthorized.component.css +4 -0
- package/dist/boilerplates/angular-template/src/app/shared/components/unauthorized/unauthorized.component.html +18 -0
- package/dist/boilerplates/angular-template/src/app/shared/components/unauthorized/unauthorized.component.ts +18 -0
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node +21 -0
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node-cwd +21 -0
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node-esm +21 -0
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node-script +21 -0
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-node-transpile-only +21 -0
- package/dist/boilerplates/nest-template/node_modules/.bin/ts-script +21 -0
- package/dist/boilerplates/nest-template/node_modules/.bin/typeorm +2 -2
- package/dist/boilerplates/nest-template/node_modules/.bin/typeorm-ts-node-commonjs +2 -2
- package/dist/boilerplates/nest-template/node_modules/.bin/typeorm-ts-node-esm +2 -2
- package/dist/boilerplates/nest-template/package.json +1 -1
- package/dist/boilerplates/nest-template/src/app.module.ts +25 -0
- package/dist/boilerplates/nest-template/src/database/migrations/1600000000000-create-roles.ts +20 -0
- package/dist/boilerplates/nest-template/src/database/migrations/1700000000000-create-users.ts +13 -2
- package/dist/boilerplates/nest-template/src/modules/auth/auth.controller.ts +16 -0
- package/dist/boilerplates/nest-template/src/modules/auth/auth.module.ts +2 -0
- package/dist/boilerplates/nest-template/src/modules/auth/auth.service.ts +54 -8
- package/dist/boilerplates/nest-template/src/modules/role/domain/role.repository.ts +10 -0
- package/dist/boilerplates/nest-template/src/modules/role/domain/role.ts +5 -0
- package/dist/boilerplates/nest-template/src/modules/role/infra/database/role.orm-entity.ts +13 -0
- package/dist/boilerplates/nest-template/src/modules/role/infra/database/role.repository.adapter.ts +54 -0
- package/dist/boilerplates/nest-template/src/modules/role/infra/http/role.controller.ts +51 -0
- package/dist/boilerplates/nest-template/src/modules/role/infra/http/role.dto.ts +17 -0
- package/dist/boilerplates/nest-template/src/modules/role/role.module.ts +20 -0
- package/dist/boilerplates/nest-template/src/modules/role/service/role.service.ts +39 -0
- package/dist/boilerplates/nest-template/src/modules/storage/infra/http/storage-download.controller.ts +38 -0
- package/dist/boilerplates/nest-template/src/modules/storage/storage.module.ts +7 -0
- package/dist/boilerplates/nest-template/src/modules/user/database-seed.service.ts +59 -18
- package/dist/boilerplates/nest-template/src/modules/user/domain/user.repository.ts +1 -0
- package/dist/boilerplates/nest-template/src/modules/user/domain/user.ts +4 -1
- package/dist/boilerplates/nest-template/src/modules/user/infra/database/user.orm-entity.ts +8 -3
- package/dist/boilerplates/nest-template/src/modules/user/infra/database/user.repository.adapter.ts +6 -0
- package/dist/boilerplates/nest-template/src/modules/user/infra/http/user.controller.ts +56 -0
- package/dist/boilerplates/nest-template/src/modules/user/service/user.service.ts +4 -0
- package/dist/boilerplates/nest-template/src/modules/user/user.module.ts +7 -1
- package/dist/index.js +24 -3
- package/dist/templates/angular/form.template.js +85 -9
- package/dist/templates/angular/list.template.js +27 -5
- package/dist/templates/nest/crud.templates.d.ts +16 -2
- package/dist/templates/nest/crud.templates.js +175 -13
- package/dist/templates/nest/migration.template.js +82 -6
- package/dist/templates/shared/relationships.js +7 -4
- package/dist/templates/ui/components/index.d.ts +1 -0
- package/dist/templates/ui/components/index.js +1 -0
- package/dist/templates/ui/components/input.template.js +17 -9
- package/dist/templates/ui/components/textarea.template.d.ts +4 -0
- package/dist/templates/ui/components/textarea.template.js +76 -0
- package/dist/templates/ui/shared/profile-component.template.js +3 -3
- package/package.json +3 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<div class="flex items-center justify-center min-height-screen p-8">
|
|
2
|
+
<div class="text-center max-w-md bg-card border border-border rounded-xl p-10 shadow-sm">
|
|
3
|
+
<div class="flex items-center justify-center mx-auto mb-6 w-16 h-16 bg-destructive/10 text-destructive rounded-full">
|
|
4
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-8 h-8">
|
|
5
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z" />
|
|
6
|
+
</svg>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<h1 class="text-2xl font-bold text-foreground mb-3">Acesso Restrito</h1>
|
|
10
|
+
<p class="text-sm text-muted-foreground leading-relaxed mb-8">
|
|
11
|
+
Desculpe, você não possui as permissões necessárias para visualizar esta página ou recurso. Se você acha que isso é um engano, por favor contate o suporte.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<button hlmBtn variant="outline" (click)="goHome()">
|
|
15
|
+
Voltar para o Início
|
|
16
|
+
</button>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component, inject } from '@angular/core';
|
|
2
|
+
import { Router } from '@angular/router';
|
|
3
|
+
import { HlmButton } from '@spartan-ng/helm/button';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-unauthorized',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [HlmButton],
|
|
9
|
+
templateUrl: './unauthorized.component.html',
|
|
10
|
+
styleUrl: './unauthorized.component.css'
|
|
11
|
+
})
|
|
12
|
+
export class UnauthorizedComponent {
|
|
13
|
+
private router = inject(Router);
|
|
14
|
+
|
|
15
|
+
goHome(): void {
|
|
16
|
+
this.router.navigate(['/']);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/../ts-node/dist/bin.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../ts-node/dist/bin.js" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/../ts-node/dist/bin-cwd.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../ts-node/dist/bin-cwd.js" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/../ts-node/dist/bin-esm.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../ts-node/dist/bin-esm.js" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/../ts-node/dist/bin-script.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../ts-node/dist/bin-script.js" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/../ts-node/dist/bin-transpile.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../ts-node/dist/bin-transpile.js" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/ts-node@10.9.2_@types+node@20.19.43_typescript@5.9.3/node_modules/ts-node/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.43_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/../ts-node/dist/bin-script-deprecated.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../ts-node/dist/bin-script-deprecated.js" "$@"
|
|
21
|
+
fi
|
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
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.
|
|
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
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.
|
|
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
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../typeorm/cli.js" "$@"
|
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
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.
|
|
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
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.
|
|
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
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../typeorm/cli-ts-node-commonjs.js" "$@"
|
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
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.
|
|
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
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.
|
|
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
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../typeorm/cli-ts-node-esm.js" "$@"
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Module } from '@nestjs/common';
|
|
2
2
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
3
|
+
import { StorageModule } from '@devstroupe/devkit-nest';
|
|
3
4
|
import { UserModule } from './modules/user/user.module';
|
|
4
5
|
import { AuthModule } from './modules/auth/auth.module';
|
|
6
|
+
import { RoleModule } from './modules/role/role.module';
|
|
7
|
+
import { StorageDownloadModule } from './modules/storage/storage.module';
|
|
5
8
|
|
|
6
9
|
@Module({
|
|
7
10
|
imports: [
|
|
@@ -15,8 +18,30 @@ import { AuthModule } from './modules/auth/auth.module';
|
|
|
15
18
|
autoLoadEntities: true,
|
|
16
19
|
synchronize: false,
|
|
17
20
|
}),
|
|
21
|
+
(StorageModule as any).registerAsync({
|
|
22
|
+
useFactory: () => ({
|
|
23
|
+
driver: (process.env.STORAGE_DRIVER || 'local') as 'local' | 's3' | 'r2',
|
|
24
|
+
local: {
|
|
25
|
+
storagePath: process.env.STORAGE_LOCAL_PATH || './storage',
|
|
26
|
+
},
|
|
27
|
+
s3: {
|
|
28
|
+
bucket: process.env.S3_BUCKET || 'my-bucket',
|
|
29
|
+
region: process.env.SRegion || 'us-east-1',
|
|
30
|
+
accessKeyId: process.env.S3_ACCESS_KEY || '',
|
|
31
|
+
secretAccessKey: process.env.S3_SECRET_KEY || '',
|
|
32
|
+
},
|
|
33
|
+
r2: {
|
|
34
|
+
bucket: process.env.R2_BUCKET || 'my-bucket',
|
|
35
|
+
accountId: process.env.R2_ACCOUNT_ID || '',
|
|
36
|
+
accessKeyId: process.env.R2_ACCESS_KEY || '',
|
|
37
|
+
secretAccessKey: process.env.R2_SECRET_KEY || '',
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
}),
|
|
18
41
|
UserModule,
|
|
19
42
|
AuthModule,
|
|
43
|
+
RoleModule,
|
|
44
|
+
StorageDownloadModule,
|
|
20
45
|
],
|
|
21
46
|
controllers: [],
|
|
22
47
|
providers: [],
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
export class CreateRoles1600000000000 implements MigrationInterface {
|
|
4
|
+
name = 'CreateRoles1600000000000';
|
|
5
|
+
|
|
6
|
+
async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.createTable(new Table({
|
|
8
|
+
name: 'roles',
|
|
9
|
+
columns: [
|
|
10
|
+
{ name: 'id', type: 'int', isPrimary: true, isGenerated: true, generationStrategy: 'increment' },
|
|
11
|
+
{ name: 'name', type: 'varchar', length: '255', isUnique: true },
|
|
12
|
+
{ name: 'permissions', type: 'text', isNullable: true }
|
|
13
|
+
]
|
|
14
|
+
}), true);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async down(queryRunner: QueryRunner): Promise<void> {
|
|
18
|
+
await queryRunner.dropTable('roles', true);
|
|
19
|
+
}
|
|
20
|
+
}
|
package/dist/boilerplates/nest-template/src/database/migrations/1700000000000-create-users.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
|
1
|
+
import { MigrationInterface, QueryRunner, Table, TableForeignKey } from 'typeorm';
|
|
2
2
|
|
|
3
3
|
export class CreateUsers1700000000000 implements MigrationInterface {
|
|
4
4
|
name = 'CreateUsers1700000000000';
|
|
@@ -11,16 +11,27 @@ export class CreateUsers1700000000000 implements MigrationInterface {
|
|
|
11
11
|
{ name: 'name', type: 'varchar', length: '255' },
|
|
12
12
|
{ name: 'email', type: 'varchar', length: '255', isUnique: true },
|
|
13
13
|
{ name: 'password', type: 'varchar', length: '255' },
|
|
14
|
-
{ name: '
|
|
14
|
+
{ name: 'role_id', type: 'int' },
|
|
15
|
+
{ name: 'current_refresh_token', type: 'varchar', length: '500', isNullable: true },
|
|
15
16
|
{ name: 'tenant_id', type: 'varchar', length: '255', isNullable: true },
|
|
16
17
|
{ name: 'is_active', type: 'boolean', default: "'1'" },
|
|
17
18
|
{ name: 'created_at', type: 'datetime', default: 'CURRENT_TIMESTAMP' },
|
|
18
19
|
{ name: 'updated_at', type: 'datetime', default: 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP' }
|
|
19
20
|
]
|
|
20
21
|
}), true);
|
|
22
|
+
|
|
23
|
+
await queryRunner.createForeignKey('users', new TableForeignKey({
|
|
24
|
+
name: 'FK_users_role_id',
|
|
25
|
+
columnNames: ['role_id'],
|
|
26
|
+
referencedColumnNames: ['id'],
|
|
27
|
+
referencedTableName: 'roles',
|
|
28
|
+
onDelete: 'RESTRICT'
|
|
29
|
+
}));
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
async down(queryRunner: QueryRunner): Promise<void> {
|
|
33
|
+
await queryRunner.dropForeignKey('users', 'FK_users_role_id');
|
|
24
34
|
await queryRunner.dropTable('users', true);
|
|
25
35
|
}
|
|
26
36
|
}
|
|
37
|
+
|
|
@@ -16,6 +16,22 @@ export class AuthController {
|
|
|
16
16
|
return this.authService.login(body.email, body.password);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
@Post('refresh')
|
|
20
|
+
@ApiOperation({ summary: 'Atualiza o access token a partir do refresh token' })
|
|
21
|
+
@ApiResponse({ status: 200, description: 'Tokens atualizados com sucesso.' })
|
|
22
|
+
async refresh(@Body() body: any) {
|
|
23
|
+
return this.authService.refresh(body.email, body.refreshToken);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@Post('logout')
|
|
27
|
+
@UseGuards(JwtAuthGuard)
|
|
28
|
+
@ApiBearerAuth()
|
|
29
|
+
@ApiOperation({ summary: 'Efetua logout e revoga a sessão do usuário' })
|
|
30
|
+
@ApiResponse({ status: 200, description: 'Logout efetuado com sucesso.' })
|
|
31
|
+
async logout(@CurrentUser() user: any) {
|
|
32
|
+
return this.authService.logout(user.sub);
|
|
33
|
+
}
|
|
34
|
+
|
|
19
35
|
@Post('register')
|
|
20
36
|
@ApiOperation({ summary: 'Auto-cadastro de novos usuários' })
|
|
21
37
|
@ApiResponse({ status: 201, description: 'Usuário cadastrado com sucesso.' })
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Module } from '@nestjs/common';
|
|
2
2
|
import { JwtModule } from '@nestjs/jwt';
|
|
3
3
|
import { UserModule } from '../user/user.module';
|
|
4
|
+
import { RoleModule } from '../role/role.module';
|
|
4
5
|
import { AuthService } from './auth.service';
|
|
5
6
|
import { AuthController } from './auth.controller';
|
|
6
7
|
import { JwtAuthGuard } from './jwt-auth.guard';
|
|
@@ -9,6 +10,7 @@ import { RolesGuard } from './roles.guard';
|
|
|
9
10
|
@Module({
|
|
10
11
|
imports: [
|
|
11
12
|
UserModule,
|
|
13
|
+
RoleModule,
|
|
12
14
|
JwtModule.register({
|
|
13
15
|
global: true,
|
|
14
16
|
secret: process.env.JWT_SECRET || 'devstroupe-secret-key-12345',
|
|
@@ -3,23 +3,29 @@ import { JwtService } from '@nestjs/jwt';
|
|
|
3
3
|
import * as bcrypt from 'bcryptjs';
|
|
4
4
|
import { UserService } from '../user/service/user.service';
|
|
5
5
|
import { User } from '../user/domain/user';
|
|
6
|
+
import { RoleService } from '../role/service/role.service';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class AuthService {
|
|
9
10
|
constructor(
|
|
10
11
|
private readonly userService: UserService,
|
|
11
12
|
private readonly jwtService: JwtService,
|
|
13
|
+
private readonly roleService: RoleService,
|
|
12
14
|
) {}
|
|
13
15
|
|
|
14
16
|
async register(data: Omit<User, 'id' | 'role' | 'isActive'>): Promise<User> {
|
|
17
|
+
const userRole = await this.roleService.findByName('Usuário Comum');
|
|
18
|
+
if (!userRole) {
|
|
19
|
+
throw new Error('Default role "Usuário Comum" not found');
|
|
20
|
+
}
|
|
15
21
|
return this.userService.create({
|
|
16
22
|
...data,
|
|
17
|
-
role:
|
|
23
|
+
role: userRole,
|
|
18
24
|
isActive: true,
|
|
19
25
|
});
|
|
20
26
|
}
|
|
21
27
|
|
|
22
|
-
async login(email: string, pass: string): Promise<{ accessToken: string; user: Omit<User, 'password'> }> {
|
|
28
|
+
async login(email: string, pass: string): Promise<{ accessToken: string; refreshToken: string; user: Omit<User, 'password' | 'currentRefreshToken'> }> {
|
|
23
29
|
const user = await this.userService.findByEmail(email);
|
|
24
30
|
if (!user) {
|
|
25
31
|
throw new UnauthorizedException('Invalid credentials');
|
|
@@ -34,24 +40,64 @@ export class AuthService {
|
|
|
34
40
|
throw new UnauthorizedException('User is inactive');
|
|
35
41
|
}
|
|
36
42
|
|
|
43
|
+
return this.generateTokensForUser(user);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async refresh(email: string, refreshToken: string): Promise<{ accessToken: string; refreshToken: string; user: Omit<User, 'password' | 'currentRefreshToken'> }> {
|
|
47
|
+
try {
|
|
48
|
+
const payload = await this.jwtService.verifyAsync(refreshToken);
|
|
49
|
+
if (payload.email !== email) {
|
|
50
|
+
throw new UnauthorizedException('Invalid refresh token');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const user = await this.userService.findByEmail(email);
|
|
54
|
+
if (!user || !user.currentRefreshToken || !user.isActive) {
|
|
55
|
+
throw new UnauthorizedException('Session expired or user inactive');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const isMatch = await bcrypt.compare(refreshToken, user.currentRefreshToken);
|
|
59
|
+
if (!isMatch) {
|
|
60
|
+
throw new UnauthorizedException('Invalid session');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return this.generateTokensForUser(user);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
throw new UnauthorizedException('Invalid or expired refresh token');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async logout(userId: number): Promise<void> {
|
|
70
|
+
await this.userService.update(userId, { currentRefreshToken: undefined } as any);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private async generateTokensForUser(user: User) {
|
|
37
74
|
const payload = {
|
|
38
75
|
sub: user.id,
|
|
39
76
|
email: user.email,
|
|
40
|
-
role: user.role,
|
|
41
|
-
tenantId: user.tenantId
|
|
77
|
+
role: user.role?.name,
|
|
78
|
+
tenantId: user.tenantId,
|
|
79
|
+
permissions: user.role?.permissions || []
|
|
42
80
|
};
|
|
43
81
|
|
|
44
|
-
const
|
|
82
|
+
const accessToken = await this.jwtService.signAsync(payload, { expiresIn: '15m' });
|
|
83
|
+
const refreshToken = await this.jwtService.signAsync({ email: user.email }, { expiresIn: '7d' });
|
|
84
|
+
|
|
85
|
+
const salt = await bcrypt.genSalt(10);
|
|
86
|
+
const hashedRefreshToken = await bcrypt.hash(refreshToken, salt);
|
|
87
|
+
await this.userService.update(user.id, { currentRefreshToken: hashedRefreshToken } as any);
|
|
88
|
+
|
|
89
|
+
const { password, currentRefreshToken, ...result } = user;
|
|
45
90
|
return {
|
|
46
|
-
accessToken
|
|
91
|
+
accessToken,
|
|
92
|
+
refreshToken,
|
|
47
93
|
user: result,
|
|
48
94
|
};
|
|
49
95
|
}
|
|
50
96
|
|
|
51
|
-
async validateUserById(id: number): Promise<Omit<User, 'password'> | null> {
|
|
97
|
+
async validateUserById(id: number): Promise<Omit<User, 'password' | 'currentRefreshToken'> | null> {
|
|
52
98
|
const user = await this.userService.findById(id);
|
|
53
99
|
if (!user) return null;
|
|
54
|
-
const { password, ...result } = user;
|
|
100
|
+
const { password, currentRefreshToken, ...result } = user;
|
|
55
101
|
return result;
|
|
56
102
|
}
|
|
57
103
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Role } from './role';
|
|
2
|
+
|
|
3
|
+
export interface IRoleRepository {
|
|
4
|
+
create(role: Omit<Role, 'id'>): Promise<Role>;
|
|
5
|
+
update(id: number, role: Partial<Role>): Promise<Role>;
|
|
6
|
+
findById(id: number): Promise<Role | null>;
|
|
7
|
+
findByName(name: string): Promise<Role | null>;
|
|
8
|
+
findAll(): Promise<Role[]>;
|
|
9
|
+
delete(id: number): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity('roles')
|
|
4
|
+
export class RoleOrmEntity {
|
|
5
|
+
@PrimaryGeneratedColumn()
|
|
6
|
+
id!: number;
|
|
7
|
+
|
|
8
|
+
@Column({ type: 'varchar', length: 255, unique: true })
|
|
9
|
+
name!: string;
|
|
10
|
+
|
|
11
|
+
@Column({ type: 'simple-array', nullable: true })
|
|
12
|
+
permissions!: string[];
|
|
13
|
+
}
|
package/dist/boilerplates/nest-template/src/modules/role/infra/database/role.repository.adapter.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
+
import { Repository } from 'typeorm';
|
|
4
|
+
import { IRoleRepository } from '../../domain/role.repository';
|
|
5
|
+
import { Role } from '../../domain/role';
|
|
6
|
+
import { RoleOrmEntity } from './role.orm-entity';
|
|
7
|
+
|
|
8
|
+
@Injectable()
|
|
9
|
+
export class RoleRepositoryAdapter implements IRoleRepository {
|
|
10
|
+
constructor(
|
|
11
|
+
@InjectRepository(RoleOrmEntity)
|
|
12
|
+
private readonly repo: Repository<RoleOrmEntity>,
|
|
13
|
+
) {}
|
|
14
|
+
|
|
15
|
+
private toDomain(orm: RoleOrmEntity): Role {
|
|
16
|
+
return {
|
|
17
|
+
id: orm.id,
|
|
18
|
+
name: orm.name,
|
|
19
|
+
permissions: orm.permissions || [],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async create(role: Omit<Role, 'id'>): Promise<Role> {
|
|
24
|
+
const created = this.repo.create(role);
|
|
25
|
+
const saved = await this.repo.save(created);
|
|
26
|
+
return this.toDomain(saved);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async update(id: number, role: Partial<Role>): Promise<Role> {
|
|
30
|
+
await this.repo.update(id, role);
|
|
31
|
+
const updated = await this.findById(id);
|
|
32
|
+
if (!updated) throw new Error('Role not found after update');
|
|
33
|
+
return updated;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async findById(id: number): Promise<Role | null> {
|
|
37
|
+
const found = await this.repo.findOne({ where: { id } });
|
|
38
|
+
return found ? this.toDomain(found) : null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async findByName(name: string): Promise<Role | null> {
|
|
42
|
+
const found = await this.repo.findOne({ where: { name } });
|
|
43
|
+
return found ? this.toDomain(found) : null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async findAll(): Promise<Role[]> {
|
|
47
|
+
const found = await this.repo.find();
|
|
48
|
+
return found.map(orm => this.toDomain(orm));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async delete(id: number): Promise<void> {
|
|
52
|
+
await this.repo.delete(id);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Controller, UseGuards, Post, Body, Put, Param, Get, Query, Delete } from '@nestjs/common';
|
|
2
|
+
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
|
3
|
+
import { BaseCrudController, PermissionsGuard, Permissions } from '@devstroupe/devkit-nest';
|
|
4
|
+
import { RoleService } from '../../service/role.service';
|
|
5
|
+
import { Role } from '../../domain/role';
|
|
6
|
+
import { CreateRoleDto, UpdateRoleDto } from './role.dto';
|
|
7
|
+
import { JwtAuthGuard } from '../../../auth/jwt-auth.guard';
|
|
8
|
+
|
|
9
|
+
@UseGuards(JwtAuthGuard, PermissionsGuard)
|
|
10
|
+
@Controller('role')
|
|
11
|
+
@ApiTags('role')
|
|
12
|
+
export class RoleController extends BaseCrudController<Role> {
|
|
13
|
+
constructor(private readonly roleService: RoleService) {
|
|
14
|
+
super(roleService);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@Post()
|
|
18
|
+
@Permissions('create:role')
|
|
19
|
+
@ApiOperation({ summary: 'Criar novo perfil de acesso' })
|
|
20
|
+
override async create(@Body() dto: CreateRoleDto): Promise<Role> {
|
|
21
|
+
return super.create(dto);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Put(':id')
|
|
25
|
+
@Permissions('update:role')
|
|
26
|
+
@ApiOperation({ summary: 'Atualizar perfil de acesso' })
|
|
27
|
+
override async update(@Param('id') id: string, @Body() dto: UpdateRoleDto): Promise<Role> {
|
|
28
|
+
return super.update(id, dto);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Get()
|
|
32
|
+
@Permissions('read:role')
|
|
33
|
+
@ApiOperation({ summary: 'Listar perfis de acesso' })
|
|
34
|
+
override async findMany(@Query() query: any): Promise<any> {
|
|
35
|
+
return super.findMany(query);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@Get(':id')
|
|
39
|
+
@Permissions('read:role')
|
|
40
|
+
@ApiOperation({ summary: 'Obter perfil de acesso por ID' })
|
|
41
|
+
override async findById(@Param('id') id: string): Promise<Role> {
|
|
42
|
+
return super.findById(id);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@Delete(':id')
|
|
46
|
+
@Permissions('delete:role')
|
|
47
|
+
@ApiOperation({ summary: 'Excluir perfil de acesso' })
|
|
48
|
+
override async delete(@Param('id') id: string): Promise<void> {
|
|
49
|
+
return super.delete(id);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
|
|
3
|
+
export class CreateRoleDto {
|
|
4
|
+
@ApiProperty({ description: 'Nome do Perfil de Acesso' })
|
|
5
|
+
name!: string;
|
|
6
|
+
|
|
7
|
+
@ApiProperty({ description: 'Lista de permissões do perfil', type: [String] })
|
|
8
|
+
permissions!: string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class UpdateRoleDto {
|
|
12
|
+
@ApiProperty({ description: 'Nome do Perfil de Acesso', required: false })
|
|
13
|
+
name?: string;
|
|
14
|
+
|
|
15
|
+
@ApiProperty({ description: 'Lista de permissões do perfil', type: [String], required: false })
|
|
16
|
+
permissions?: string[];
|
|
17
|
+
}
|