@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,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/acorn@8.17.0/node_modules/acorn/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/acorn@8.17.0/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/acorn@8.17.0/node_modules/acorn/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/acorn@8.17.0/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/acorn@8.17.0/node_modules/acorn/bin/acorn" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../node_modules/.pnpm/acorn@8.17.0/node_modules/acorn/bin/acorn" "$@"
|
|
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/eslint@10.6.0_jiti@2.7.0/node_modules/eslint/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/eslint@10.6.0_jiti@2.7.0/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/eslint@10.6.0_jiti@2.7.0/node_modules/eslint/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/eslint@10.6.0_jiti@2.7.0/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/eslint@10.6.0_jiti@2.7.0/node_modules/eslint/bin/eslint.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../node_modules/.pnpm/eslint@10.6.0_jiti@2.7.0/node_modules/eslint/bin/eslint.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/@zkochan+js-yaml@0.0.7/node_modules/@zkochan/js-yaml/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/@zkochan+js-yaml@0.0.7/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/@zkochan+js-yaml@0.0.7/node_modules/@zkochan/js-yaml/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/@zkochan+js-yaml@0.0.7/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/@zkochan+js-yaml@0.0.7/node_modules/@zkochan/js-yaml/bin/js-yaml.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../node_modules/.pnpm/@zkochan+js-yaml@0.0.7/node_modules/@zkochan/js-yaml/bin/js-yaml.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/@angular+cli@21.0.6_@types+node@20.19.
|
|
13
|
+
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/@angular+cli@21.0.6_@types+node@20.19.43_chokidar@5.0.0_hono@4.12.27/node_modules/@angular/cli/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/@angular+cli@21.0.6_@types+node@20.19.43_chokidar@5.0.0_hono@4.12.27/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/@angular+cli@21.0.6_@types+node@20.19.
|
|
15
|
+
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/@angular+cli@21.0.6_@types+node@20.19.43_chokidar@5.0.0_hono@4.12.27/node_modules/@angular/cli/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/@angular+cli@21.0.6_@types+node@20.19.43_chokidar@5.0.0_hono@4.12.27/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/../@angular/cli/bin/ng.js" "$@"
|
|
@@ -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/nx@23.0.1/node_modules/nx/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/nx@23.0.1/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/nx@23.0.1/node_modules/nx/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/nx@23.0.1/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/nx@23.0.1/node_modules/nx/dist/bin/nx.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../node_modules/.pnpm/nx@23.0.1/node_modules/nx/dist/bin/nx.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/nx@23.0.1/node_modules/nx/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/nx@23.0.1/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/nx@23.0.1/node_modules/nx/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/nx@23.0.1/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/nx@23.0.1/node_modules/nx/dist/bin/nx-cloud.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../node_modules/.pnpm/nx@23.0.1/node_modules/nx/dist/bin/nx-cloud.js" "$@"
|
|
21
|
+
fi
|
|
@@ -10,12 +10,12 @@ 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/sass@1.
|
|
13
|
+
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/sass@1.100.0/node_modules/sass/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/sass@1.100.0/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/sass@1.
|
|
15
|
+
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/sass@1.100.0/node_modules/sass/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/sass@1.100.0/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
|
-
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/sass@1.
|
|
18
|
+
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/sass@1.100.0/node_modules/sass/sass.js" "$@"
|
|
19
19
|
else
|
|
20
|
-
exec node "$basedir/../../../../node_modules/.pnpm/sass@1.
|
|
20
|
+
exec node "$basedir/../../../../node_modules/.pnpm/sass@1.100.0/node_modules/sass/sass.js" "$@"
|
|
21
21
|
fi
|
|
@@ -10,12 +10,12 @@ 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/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-
|
|
13
|
+
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-embedded_acddd9f13a5ef45c06c677cd51fbc549/node_modules/vite/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-embedded_acddd9f13a5ef45c06c677cd51fbc549/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/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-
|
|
15
|
+
export NODE_PATH="/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-embedded_acddd9f13a5ef45c06c677cd51fbc549/node_modules/vite/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-embedded_acddd9f13a5ef45c06c677cd51fbc549/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
|
-
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-
|
|
18
|
+
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-embedded_acddd9f13a5ef45c06c677cd51fbc549/node_modules/vite/bin/vite.js" "$@"
|
|
19
19
|
else
|
|
20
|
-
exec node "$basedir/../../../../node_modules/.pnpm/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-
|
|
20
|
+
exec node "$basedir/../../../../node_modules/.pnpm/vite@7.3.5_@types+node@20.19.43_jiti@2.7.0_less@4.4.2_lightningcss@1.32.0_sass-embedded_acddd9f13a5ef45c06c677cd51fbc549/node_modules/vite/bin/vite.js" "$@"
|
|
21
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/webpack@5.106.2_lightningcss@1.32.0_postcss@8.5.15/node_modules/webpack/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/webpack@5.106.2_lightningcss@1.32.0_postcss@8.5.15/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_lightningcss@1.32.0_postcss@8.5.15/node_modules/webpack/node_modules:/home/vitor/trabalho/devstroupe/framework/node_modules/.pnpm/webpack@5.106.2_lightningcss@1.32.0_postcss@8.5.15/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_lightningcss@1.32.0_postcss@8.5.15/node_modules/webpack/bin/webpack.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../node_modules/.pnpm/webpack@5.106.2_lightningcss@1.32.0_postcss@8.5.15/node_modules/webpack/bin/webpack.js" "$@"
|
|
21
|
+
fi
|
|
@@ -4,6 +4,8 @@ import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
|
4
4
|
import { provideSpartanHlm } from '@spartan-ng/helm/utils';
|
|
5
5
|
import { routes } from './app.routes';
|
|
6
6
|
import { tenantInterceptor } from './shared/interceptors/tenant.interceptor';
|
|
7
|
+
import { DEVKIT_AUTH_SERVICE } from '@devstroupe/devkit-angular';
|
|
8
|
+
import { AuthService } from './core/services/auth.service';
|
|
7
9
|
|
|
8
10
|
import { provideIcons } from '@ng-icons/core';
|
|
9
11
|
import {
|
|
@@ -32,6 +34,7 @@ export const appConfig: ApplicationConfig = {
|
|
|
32
34
|
provideZoneChangeDetection({ eventCoalescing: true }),
|
|
33
35
|
provideSpartanHlm(),
|
|
34
36
|
provideRouter(routes),
|
|
37
|
+
{ provide: DEVKIT_AUTH_SERVICE, useExisting: AuthService },
|
|
35
38
|
provideHttpClient(
|
|
36
39
|
withInterceptors([tenantInterceptor])
|
|
37
40
|
),
|
|
@@ -5,10 +5,12 @@ import { RegisterComponent } from './modules/auth/register/register.component';
|
|
|
5
5
|
import { DashboardComponent } from './modules/dashboard/dashboard.component';
|
|
6
6
|
import { MainLayoutComponent } from './shared/layouts/main-layout/main-layout.component';
|
|
7
7
|
import { ENTITY_ROUTES } from './app.entity-routes';
|
|
8
|
+
import { devkitPermissionGuard } from '@devstroupe/devkit-angular';
|
|
8
9
|
|
|
9
10
|
export const routes: Routes = [
|
|
10
11
|
{ path: 'login', component: LoginComponent },
|
|
11
12
|
{ path: 'register', component: RegisterComponent },
|
|
13
|
+
{ path: 'unauthorized', loadComponent: () => import('./shared/components/unauthorized/unauthorized.component').then(m => m.UnauthorizedComponent) },
|
|
12
14
|
{
|
|
13
15
|
path: '',
|
|
14
16
|
component: MainLayoutComponent,
|
|
@@ -18,6 +20,11 @@ export const routes: Routes = [
|
|
|
18
20
|
{ path: 'dashboard', component: DashboardComponent },
|
|
19
21
|
{ path: 'profile', loadComponent: () => import('./modules/profile/profile.component').then(m => m.ProfileComponent) },
|
|
20
22
|
{ path: 'playground', loadComponent: () => import('./modules/playground/playground.component').then(m => m.PlaygroundComponent) },
|
|
23
|
+
{
|
|
24
|
+
path: 'role',
|
|
25
|
+
loadComponent: () => import('./modules/role/role-permissions.component').then(m => m.RolePermissionsComponent),
|
|
26
|
+
canActivate: [devkitPermissionGuard('manage:permissions')]
|
|
27
|
+
},
|
|
21
28
|
...ENTITY_ROUTES
|
|
22
29
|
]
|
|
23
30
|
},
|
package/dist/boilerplates/angular-template/src/app/modules/role/role-permissions.component.css
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.role-manager-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 1.5rem;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.role-grid {
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: 320px 1fr;
|
|
10
|
+
gap: 1.5rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (max-width: 768px) {
|
|
14
|
+
.role-grid {
|
|
15
|
+
grid-template-columns: 1fr;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.role-item {
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
align-items: center;
|
|
23
|
+
padding: 0.75rem 1rem;
|
|
24
|
+
border-radius: 0.5rem;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
transition: all 0.2s;
|
|
27
|
+
border: 1px solid transparent;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.role-item:hover {
|
|
31
|
+
background-color: var(--muted, #f4f4f5);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.role-item.active {
|
|
35
|
+
background-color: var(--accent, #f4f4f5);
|
|
36
|
+
border-color: var(--border, #e4e4e7);
|
|
37
|
+
font-weight: 500;
|
|
38
|
+
}
|
package/dist/boilerplates/angular-template/src/app/modules/role/role-permissions.component.html
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<div class="p-6 max-w-7xl mx-auto role-manager-container">
|
|
2
|
+
<!-- Cabeçalho -->
|
|
3
|
+
<div class="flex justify-between items-center mb-4">
|
|
4
|
+
<div>
|
|
5
|
+
<h1 class="text-3xl font-bold text-foreground tracking-tight">Perfis de Acesso</h1>
|
|
6
|
+
<p class="text-sm text-muted-foreground mt-1">Gerencie os papéis de acesso e as permissões granulares dos usuários do sistema.</p>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<!-- Alertas -->
|
|
11
|
+
<div *ngIf="successMessage" class="p-4 mb-4 text-sm text-green-700 bg-green-50 border border-green-200 rounded-lg dark:bg-green-900/10 dark:text-green-400 dark:border-green-800">
|
|
12
|
+
{{ successMessage }}
|
|
13
|
+
</div>
|
|
14
|
+
<div *ngIf="errorMessage" class="p-4 mb-4 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg dark:bg-red-900/10 dark:text-red-400 dark:border-red-800">
|
|
15
|
+
{{ errorMessage }}
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="role-grid">
|
|
19
|
+
<!-- Painel Esquerdo: Lista de Perfis -->
|
|
20
|
+
<div class="bg-card border border-border rounded-xl p-5 shadow-sm flex flex-col gap-4">
|
|
21
|
+
<div class="border-b border-border pb-3">
|
|
22
|
+
<h2 class="font-semibold text-lg text-foreground">Perfis Disponíveis</h2>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class="flex flex-col gap-1 overflow-y-auto max-h-96">
|
|
26
|
+
<div
|
|
27
|
+
*ngFor="let role of roles"
|
|
28
|
+
(click)="selectRole(role)"
|
|
29
|
+
[class.active]="selectedRole?.id === role.id"
|
|
30
|
+
class="role-item transition-all"
|
|
31
|
+
>
|
|
32
|
+
<div class="flex flex-col">
|
|
33
|
+
<span class="text-sm font-medium text-foreground">{{ role.name }}</span>
|
|
34
|
+
<span class="text-xs text-muted-foreground mt-0.5">{{ role.permissions.length }} permissões</span>
|
|
35
|
+
</div>
|
|
36
|
+
<svg *ngIf="selectedRole?.id === role.id" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor" class="w-4 h-4 text-primary">
|
|
37
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
|
|
38
|
+
</svg>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<!-- Criar Nova Role -->
|
|
43
|
+
<div class="border-t border-border pt-4 mt-auto">
|
|
44
|
+
<h3 class="text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-3">Novo Perfil</h3>
|
|
45
|
+
<div class="flex gap-2">
|
|
46
|
+
<input
|
|
47
|
+
type="text"
|
|
48
|
+
[(ngModel)]="newRoleName"
|
|
49
|
+
placeholder="Nome do perfil..."
|
|
50
|
+
class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
|
|
51
|
+
/>
|
|
52
|
+
<button
|
|
53
|
+
hlmBtn
|
|
54
|
+
variant="default"
|
|
55
|
+
size="sm"
|
|
56
|
+
[disabled]="!newRoleName.trim()"
|
|
57
|
+
(click)="createRole()"
|
|
58
|
+
>
|
|
59
|
+
Adicionar
|
|
60
|
+
</button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<!-- Painel Direito: Matriz de Permissões -->
|
|
66
|
+
<div class="bg-card border border-border rounded-xl p-5 shadow-sm flex flex-col gap-4">
|
|
67
|
+
<div class="border-b border-border pb-3 flex justify-between items-center">
|
|
68
|
+
<div>
|
|
69
|
+
<h2 class="font-semibold text-lg text-foreground">Definição de Permissões</h2>
|
|
70
|
+
<p class="text-xs text-muted-foreground mt-0.5" *ngIf="selectedRole">
|
|
71
|
+
Editando permissões para o perfil: <strong class="text-foreground font-semibold">{{ selectedRole.name }}</strong>
|
|
72
|
+
</p>
|
|
73
|
+
</div>
|
|
74
|
+
<button
|
|
75
|
+
hlmBtn
|
|
76
|
+
variant="default"
|
|
77
|
+
[disabled]="!selectedRole || isSaving"
|
|
78
|
+
(click)="savePermissions()"
|
|
79
|
+
>
|
|
80
|
+
<span *ngIf="isSaving">Salvando...</span>
|
|
81
|
+
<span *ngIf="!isSaving">Salvar Permissões</span>
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<!-- Estado Vazio -->
|
|
86
|
+
<div *ngIf="!selectedRole" class="flex flex-col items-center justify-center py-20 text-center">
|
|
87
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12 text-muted-foreground/60 mb-3">
|
|
88
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.03 0 1.9.693 2.166 1.638m-7.377 0A48.536 48.536 0 0112 3m0 0c2.917 0 5.747.294 8.5.862m-21 10.398c0-.552.448-1 1-1h6.25a1 1 0 011 1v3.83a1 1 0 001 1h2.01a1 1 0 001-1v-3.83a1 1 0 011-1H20a1 1 0 011 1v3.83a1 1 0 01-1 1h-6.25a1 1 0 01-1-1v-3.83a1 1 0 00-1-1H9.99a1 1 0 00-1 1v3.83a1 1 0 01-1 1H3a1 1 0 01-1-1v-3.83z" />
|
|
89
|
+
</svg>
|
|
90
|
+
<span class="text-sm font-medium text-foreground">Nenhum Perfil Selecionado</span>
|
|
91
|
+
<p class="text-xs text-muted-foreground mt-1">Selecione um perfil de acesso à esquerda para gerenciar suas permissões.</p>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<!-- Matriz de Checkboxes -->
|
|
95
|
+
<div *ngIf="selectedRole" class="overflow-x-auto">
|
|
96
|
+
<table class="min-w-full divide-y divide-border text-sm">
|
|
97
|
+
<thead>
|
|
98
|
+
<tr class="text-left text-xs font-semibold text-muted-foreground uppercase tracking-wider border-b border-border">
|
|
99
|
+
<th class="py-3 px-4">Recurso / Entidade</th>
|
|
100
|
+
<th class="py-3 px-4 text-center">Visualizar (Read)</th>
|
|
101
|
+
<th class="py-3 px-4 text-center">Cadastrar (Create)</th>
|
|
102
|
+
<th class="py-3 px-4 text-center">Atualizar (Update)</th>
|
|
103
|
+
<th class="py-3 px-4 text-center">Excluir (Delete)</th>
|
|
104
|
+
</tr>
|
|
105
|
+
</thead>
|
|
106
|
+
<tbody class="divide-y divide-border">
|
|
107
|
+
<tr *ngFor="let resource of resources" class="hover:bg-muted/30">
|
|
108
|
+
<td class="py-3.5 px-4 font-medium text-foreground">
|
|
109
|
+
{{ resource.label }}
|
|
110
|
+
<span class="text-xs text-muted-foreground block font-normal mt-0.5">{{ resource.name }}</span>
|
|
111
|
+
</td>
|
|
112
|
+
<!-- Read -->
|
|
113
|
+
<td class="py-3.5 px-4 text-center">
|
|
114
|
+
<input
|
|
115
|
+
type="checkbox"
|
|
116
|
+
[checked]="hasPermission('read', resource.name)"
|
|
117
|
+
(change)="togglePermission('read', resource.name)"
|
|
118
|
+
class="rounded border-border text-primary focus:ring-primary h-4 w-4 transition-colors"
|
|
119
|
+
/>
|
|
120
|
+
</td>
|
|
121
|
+
<!-- Create -->
|
|
122
|
+
<td class="py-3.5 px-4 text-center">
|
|
123
|
+
<input
|
|
124
|
+
type="checkbox"
|
|
125
|
+
[checked]="hasPermission('create', resource.name)"
|
|
126
|
+
(change)="togglePermission('create', resource.name)"
|
|
127
|
+
class="rounded border-border text-primary focus:ring-primary h-4 w-4 transition-colors"
|
|
128
|
+
/>
|
|
129
|
+
</td>
|
|
130
|
+
<!-- Update -->
|
|
131
|
+
<td class="py-3.5 px-4 text-center">
|
|
132
|
+
<input
|
|
133
|
+
type="checkbox"
|
|
134
|
+
[checked]="hasPermission('update', resource.name)"
|
|
135
|
+
(change)="togglePermission('update', resource.name)"
|
|
136
|
+
class="rounded border-border text-primary focus:ring-primary h-4 w-4 transition-colors"
|
|
137
|
+
/>
|
|
138
|
+
</td>
|
|
139
|
+
<!-- Delete -->
|
|
140
|
+
<td class="py-3.5 px-4 text-center">
|
|
141
|
+
<input
|
|
142
|
+
type="checkbox"
|
|
143
|
+
[checked]="hasPermission('delete', resource.name)"
|
|
144
|
+
(change)="togglePermission('delete', resource.name)"
|
|
145
|
+
class="rounded border-border text-primary focus:ring-primary h-4 w-4 transition-colors"
|
|
146
|
+
/>
|
|
147
|
+
</td>
|
|
148
|
+
</tr>
|
|
149
|
+
|
|
150
|
+
<!-- Permissões Especiais do Sistema -->
|
|
151
|
+
<tr class="bg-muted/20">
|
|
152
|
+
<td colspan="5" class="py-2.5 px-4 text-xs font-semibold text-muted-foreground uppercase tracking-wider">
|
|
153
|
+
Permissões Especiais de Negócio
|
|
154
|
+
</td>
|
|
155
|
+
</tr>
|
|
156
|
+
<tr class="hover:bg-muted/30">
|
|
157
|
+
<td class="py-3.5 px-4 font-medium text-foreground" colspan="4">
|
|
158
|
+
Gerenciar Permissões
|
|
159
|
+
<span class="text-xs text-muted-foreground block font-normal mt-0.5">Permite acessar esta tela e alterar configurações do sistema</span>
|
|
160
|
+
</td>
|
|
161
|
+
<td class="py-3.5 px-4 text-center">
|
|
162
|
+
<input
|
|
163
|
+
type="checkbox"
|
|
164
|
+
[checked]="hasSpecialPermission('manage:permissions')"
|
|
165
|
+
(change)="toggleSpecialPermission('manage:permissions')"
|
|
166
|
+
class="rounded border-border text-primary focus:ring-primary h-4 w-4 transition-colors"
|
|
167
|
+
/>
|
|
168
|
+
</td>
|
|
169
|
+
</tr>
|
|
170
|
+
</tbody>
|
|
171
|
+
</table>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { RoleService } from '../../services/role.service';
|
|
5
|
+
import { HlmButton } from '@spartan-ng/helm/button';
|
|
6
|
+
|
|
7
|
+
interface ResourceItem {
|
|
8
|
+
name: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'app-role-permissions',
|
|
14
|
+
standalone: true,
|
|
15
|
+
imports: [CommonModule, FormsModule, HlmButton],
|
|
16
|
+
templateUrl: './role-permissions.component.html',
|
|
17
|
+
styleUrl: './role-permissions.component.css'
|
|
18
|
+
})
|
|
19
|
+
export class RolePermissionsComponent implements OnInit {
|
|
20
|
+
private roleService = inject(RoleService);
|
|
21
|
+
|
|
22
|
+
roles: any[] = [];
|
|
23
|
+
selectedRole: any = null;
|
|
24
|
+
newRoleName = '';
|
|
25
|
+
isSaving = false;
|
|
26
|
+
successMessage = '';
|
|
27
|
+
errorMessage = '';
|
|
28
|
+
|
|
29
|
+
resources: ResourceItem[] = [
|
|
30
|
+
{ name: 'cabin', label: 'Cabines' },
|
|
31
|
+
{ name: 'company', label: 'Empresas' },
|
|
32
|
+
{ name: 'role', label: 'Perfis de Acesso' }
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
ngOnInit(): void {
|
|
36
|
+
this.loadRoles();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
loadRoles(): void {
|
|
40
|
+
this.roleService.list({}).subscribe({
|
|
41
|
+
next: (res: any) => {
|
|
42
|
+
this.roles = res?.items || [];
|
|
43
|
+
if (this.roles.length > 0 && !this.selectedRole) {
|
|
44
|
+
this.selectRole(this.roles[0]);
|
|
45
|
+
} else if (this.selectedRole) {
|
|
46
|
+
const updated = this.roles.find(r => r.id === this.selectedRole.id);
|
|
47
|
+
if (updated) this.selectRole(updated);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
error: (err: any) => {
|
|
51
|
+
this.errorMessage = 'Erro ao carregar perfis de acesso.';
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
selectRole(role: any): void {
|
|
57
|
+
// Clona para evitar modificar a referência original antes de salvar
|
|
58
|
+
this.selectedRole = {
|
|
59
|
+
...role,
|
|
60
|
+
permissions: [...(role.permissions || [])]
|
|
61
|
+
};
|
|
62
|
+
this.successMessage = '';
|
|
63
|
+
this.errorMessage = '';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
createRole(): void {
|
|
67
|
+
if (!this.newRoleName.trim()) return;
|
|
68
|
+
|
|
69
|
+
this.roleService.create({ name: this.newRoleName.trim(), permissions: [] }).subscribe({
|
|
70
|
+
next: (created: any) => {
|
|
71
|
+
this.newRoleName = '';
|
|
72
|
+
this.successMessage = 'Perfil de acesso criado com sucesso!';
|
|
73
|
+
this.selectedRole = created;
|
|
74
|
+
this.loadRoles();
|
|
75
|
+
},
|
|
76
|
+
error: (err: any) => {
|
|
77
|
+
this.errorMessage = err?.error?.message || 'Erro ao criar perfil de acesso.';
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
hasPermission(action: string, resource: string): boolean {
|
|
83
|
+
if (!this.selectedRole) return false;
|
|
84
|
+
const permission = `${action}:${resource}`;
|
|
85
|
+
return this.selectedRole.permissions.includes(permission);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
togglePermission(action: string, resource: string): void {
|
|
89
|
+
if (!this.selectedRole) return;
|
|
90
|
+
const permission = `${action}:${resource}`;
|
|
91
|
+
const index = this.selectedRole.permissions.indexOf(permission);
|
|
92
|
+
if (index > -1) {
|
|
93
|
+
this.selectedRole.permissions.splice(index, 1);
|
|
94
|
+
} else {
|
|
95
|
+
this.selectedRole.permissions.push(permission);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
hasSpecialPermission(permission: string): boolean {
|
|
100
|
+
if (!this.selectedRole) return false;
|
|
101
|
+
return this.selectedRole.permissions.includes(permission);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
toggleSpecialPermission(permission: string): void {
|
|
105
|
+
if (!this.selectedRole) return;
|
|
106
|
+
const index = this.selectedRole.permissions.indexOf(permission);
|
|
107
|
+
if (index > -1) {
|
|
108
|
+
this.selectedRole.permissions.splice(index, 1);
|
|
109
|
+
} else {
|
|
110
|
+
this.selectedRole.permissions.push(permission);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
savePermissions(): void {
|
|
115
|
+
if (!this.selectedRole) return;
|
|
116
|
+
|
|
117
|
+
this.isSaving = true;
|
|
118
|
+
this.successMessage = '';
|
|
119
|
+
this.errorMessage = '';
|
|
120
|
+
|
|
121
|
+
this.roleService.update(this.selectedRole.id, this.selectedRole).subscribe({
|
|
122
|
+
next: (updated: any) => {
|
|
123
|
+
this.isSaving = false;
|
|
124
|
+
this.successMessage = 'Permissões do perfil atualizadas com sucesso!';
|
|
125
|
+
// Atualiza a lista local com os novos valores
|
|
126
|
+
this.loadRoles();
|
|
127
|
+
},
|
|
128
|
+
error: (err: any) => {
|
|
129
|
+
this.isSaving = false;
|
|
130
|
+
this.errorMessage = err?.error?.message || 'Erro ao salvar permissões do perfil.';
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { BaseService } from '@devstroupe/devkit-angular';
|
|
4
|
+
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root',
|
|
7
|
+
})
|
|
8
|
+
export class RoleService extends BaseService<any> {
|
|
9
|
+
constructor(http: HttpClient) {
|
|
10
|
+
super(http, '/api/role');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { BaseService } from '@devstroupe/devkit-angular';
|
|
4
|
+
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root',
|
|
7
|
+
})
|
|
8
|
+
export class UserService extends BaseService<any> {
|
|
9
|
+
constructor(http: HttpClient) {
|
|
10
|
+
super(http as any, '/api/user');
|
|
11
|
+
}
|
|
12
|
+
}
|