create-arkos 2.0.0-next.17 → 2.0.0-next.18

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.
Files changed (39) hide show
  1. package/dist/index.js +4 -0
  2. package/dist/index.js.map +1 -1
  3. package/dist/utils/project-config-inquirer.js +40 -33
  4. package/dist/utils/project-config-inquirer.js.map +1 -1
  5. package/dist/utils/template-compiler.js +16 -11
  6. package/dist/utils/template-compiler.js.map +1 -1
  7. package/package.json +1 -1
  8. package/templates/basic/.env.hbs +5 -1
  9. package/templates/basic/README.md.hbs +1 -1
  10. package/templates/basic/arkos.config.ts.hbs +16 -3
  11. package/templates/basic/package.json.hbs +4 -2
  12. package/templates/basic/prisma/schema/__tests__/user-role.prisma.hbs.test.ts +2 -2
  13. package/templates/basic/prisma/schema/__tests__/user.prisma.hbs.test.ts +2 -2
  14. package/templates/basic/prisma/schema/auth-permission.prisma.hbs +3 -9
  15. package/templates/basic/prisma/schema/auth-role.prisma.hbs +2 -2
  16. package/templates/basic/prisma/schema/user-permission.prisma.hbs +18 -0
  17. package/templates/basic/prisma/schema/user.prisma.hbs +4 -2
  18. package/templates/basic/public/favicon.ico +0 -0
  19. package/templates/basic/src/app.ts.hbs +9 -7
  20. package/templates/basic/src/modules/auth/auth.policy.ts.hbs +1 -1
  21. package/templates/basic/src/modules/auth/auth.router.ts.hbs +72 -7
  22. package/templates/basic/src/modules/auth-permission/auth-permission.router.ts.hbs +39 -7
  23. package/templates/basic/src/modules/auth-permission/dtos/create-auth-permission.dto.ts.hbs +5 -4
  24. package/templates/basic/src/modules/auth-permission/dtos/update-auth-permission.dto.ts.hbs +16 -3
  25. package/templates/basic/src/modules/auth-role/auth-role.router.ts.hbs +38 -6
  26. package/templates/basic/src/modules/auth-role/dtos/update-auth-role.dto.ts.hbs +1 -0
  27. package/templates/basic/src/modules/file-upload/file-upload.router.ts.hbs +28 -8
  28. package/templates/basic/src/modules/user/user.router.ts.hbs +91 -7
  29. package/templates/basic/src/router.ts.hbs +2 -2
  30. package/templates/basic/src/server.ts.hbs +8 -0
  31. package/templates/basic/src/utils/validation/api-actions.ts.hbs +1 -1
  32. package/templates/basic/tsconfig.json.hbs +1 -1
  33. package/templates/basic/src/loadables.ts.hbs +0 -29
  34. package/templates/basic/src/modules/auth/auth.route-hook.ts.hbs +0 -66
  35. package/templates/basic/src/modules/auth-permission/auth-permission.route-hook.ts.hbs +0 -35
  36. package/templates/basic/src/modules/auth-role/auth-role.route-hook.ts.hbs +0 -35
  37. package/templates/basic/src/modules/file-upload/file-upload.route-hook.ts.hbs +0 -23
  38. package/templates/basic/src/modules/user/user.route-hook.ts.hbs +0 -88
  39. /package/templates/basic/src/modules/auth-permission/dtos/{query-auth-role.dto.ts.hbs → query-auth-permission.dto.ts.hbs} +0 -0
@@ -1,88 +0,0 @@
1
- import { ArkosRouteHook } from 'arkos';
2
- {{#if authentication}}
3
- import userPolicy from '@/src/modules/user/user.policy';
4
- {{/if}}
5
- {{#if validation.type}}
6
- import CreateUserDto from '@/src/modules/user/dtos/create-user.dto';
7
- import UpdateUserDto from '@/src/modules/user/dtos/update-user.dto';
8
- {{/if}}
9
-
10
- const userRouteHook = ArkosRouteHook("user");
11
-
12
- userRouteHook.createOne({
13
- {{#if validation.type}}validation: { body: CreateUserDto },{{/if}}
14
- {{#if authentication}}authentication: userPolicy.Create,{{/if}}
15
- prismaArgs: {
16
- omit: { password: true },
17
- },
18
- });
19
-
20
- userRouteHook.findOne({
21
- {{#if authentication}}authentication: userPolicy.View,{{/if}}
22
- prismaArgs: {
23
- omit: { password: true },
24
- {{#if (eq authentication.type "dynamic")}}
25
- include: {
26
- {{#if authentication.multipleRoles}}
27
- roles: {
28
- include: {
29
- role: {
30
- include: {
31
- permissions: true,
32
- },
33
- },
34
- },
35
- },
36
- {{else}}
37
- role: {
38
- include: {
39
- role: {
40
- include: {
41
- permissions: true,
42
- },
43
- },
44
- },
45
- },
46
- {{/if}}
47
- },
48
- {{/if}}
49
- },
50
- });
51
-
52
- userRouteHook.findMany({
53
- {{#if authentication}}authentication: userPolicy.View,{{/if}}
54
- prismaArgs: {
55
- omit: { password: true },
56
- {{#if (eq authentication.type "dynamic")}}
57
- include: {
58
- {{#if authentication.multipleRoles}}
59
- roles: {
60
- include: {
61
- role: true,
62
- },
63
- },
64
- {{else}}
65
- role: {
66
- include: {
67
- role: true,
68
- },
69
- },
70
- {{/if}}
71
- },
72
- {{/if}}
73
- },
74
- });
75
-
76
- userRouteHook.updateOne({
77
- {{#if validation.type}}validation: { body: UpdateUserDto },{{/if}}
78
- {{#if authentication}}authentication: userPolicy.Update,{{/if}}
79
- prismaArgs: {
80
- omit: { password: true },
81
- },
82
- });
83
-
84
- userRouteHook.deleteOne({
85
- {{#if authentication}}authentication: userPolicy.Delete,{{/if}}
86
- });
87
-
88
- export default userRouteHook;