create-arkos 1.3.1-beta → 1.3.2-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-arkos",
3
- "version": "1.3.1-beta",
3
+ "version": "1.3.2-beta.1",
4
4
  "type": "module",
5
5
  "description": "CLI for creating Arkos.js projects, see docs at www.arkosjs.com",
6
6
  "bin": {
@@ -1,4 +1,4 @@
1
- This is a [Arkos.js](https://arkosjs.com) project bootstrapped with [`create-arkos`](https://arkosjs.com/docs/cli/create-arkos).
1
+ This is a [Arkos.js](https://arkosjs.com) project scaffolded with [`create-arkos`](https://arkosjs.com/docs/cli/create-arkos).
2
2
 
3
3
  ## Getting Started
4
4
 
@@ -5,7 +5,7 @@
5
5
  {{else}}
6
6
  "type": "module",
7
7
  {{/if}}
8
- "description": "This RESTful API was generated by Arkos.js, read more about Arkos.js at www.arkosjs.com",
8
+ "description": "This RESTful API was generated by create-arkos, read more about Arkos.js at www.arkosjs.com",
9
9
  "scripts": {
10
10
  "dev": "arkos dev",
11
11
  "build": "arkos build",
@@ -27,7 +27,7 @@
27
27
  "prisma": "^6.11.1"
28
28
  },
29
29
  "dependencies": {
30
- "arkos": "^1.3.1-beta",
30
+ "arkos": "^1.3.2-beta",
31
31
  "express": "^4.21.2",
32
32
  "@prisma/client": "^6.4.1",
33
33
  "swagger-jsdoc": "^6.2.8"{{#if validation.type}},{{/if}}
@@ -12,11 +12,13 @@ arkos.init({
12
12
  }
13
13
  },
14
14
  {{/if}}
15
- {{#if routing.strict}}
16
15
  routers: {
17
- strict: true,
18
- },
16
+ {{#if routing.strict}}
17
+ strict: true
18
+ {{else}}
19
+ strict: "no-bulk"
19
20
  {{/if}}
21
+ },
20
22
  {{#if validation.type}}
21
23
  validation: {
22
24
  resolver: '{{validation.type}}'
@@ -1,103 +1,123 @@
1
1
  {{#if typescript}}
2
2
  import { ArkosRequest, ArkosResponse, ArkosNextFunction } from "arkos";
3
3
 
4
- // export const beforeGetMe = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
5
- // // Your logic here
6
- // next();
7
- // };
8
- //
9
- // export const afterGetMe = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
10
- // // Your logic here
11
- // next();
12
- // };
13
- //
14
- // export const beforeLogin = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
15
- // // Your logic here
16
- // next();
17
- // };
18
- //
19
- // export const afterLogin = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
20
- // // Your logic here
21
- // next();
22
- // };
23
- //
24
- // export const beforeLogout = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
25
- // // Your logic here
26
- // next();
27
- // };
28
- //
29
- // export const afterLogout = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
30
- // // Your logic here
31
- // next();
32
- // };
33
- //
34
- // export const beforeSignup = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
35
- // // Your logic here
36
- // next();
37
- // };
38
- //
39
- // export const afterSignup = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
40
- // // Your logic here
41
- // next();
42
- // };
43
- //
44
- // export const beforeUpdatePassword = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
45
- // // Your logic here
46
- // next();
47
- // };
48
- //
49
- // export const afterUpdatePassword = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
50
- // // Your logic here
51
- // next();
52
- // };
4
+ // export const beforeGetMe = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
5
+ // next();
6
+ // }];
7
+
8
+ // export const afterGetMe = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
9
+ // next();
10
+ // }];
11
+
12
+ // export const onGetMeError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
13
+ // next();
14
+ // }];
15
+
16
+ // export const beforeLogin = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
17
+ // next();
18
+ // }];
19
+
20
+ // export const afterLogin = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
21
+ // next();
22
+ // }];
23
+
24
+ // export const onLoginError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
25
+ // next();
26
+ // }];
27
+
28
+ // export const beforeLogout = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
29
+ // next();
30
+ // }];
31
+
32
+ // export const afterLogout = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
33
+ // next();
34
+ // }];
35
+
36
+ // export const onLogoutError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
37
+ // next();
38
+ // }];
39
+
40
+ // export const beforeSignup = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
41
+ // next();
42
+ // }];
43
+
44
+ // export const afterSignup = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
45
+ // next();
46
+ // }];
47
+
48
+ // export const onSignupError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
49
+ // next();
50
+ // }];
51
+
52
+ // export const beforeUpdatePassword = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
53
+ // next();
54
+ // }];
55
+
56
+ // export const afterUpdatePassword = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
57
+ // next();
58
+ // }];
59
+
60
+ // export const onUpdatePasswordError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
61
+ // next();
62
+ // }];
53
63
  {{else}}
54
- // export const beforeGetMe = async (req, res, next) => {
55
- // // Your logic here
56
- // next();
57
- // };
58
- //
59
- // export const afterGetMe = async (req, res, next) => {
60
- // // Your logic here
61
- // next();
62
- // };
63
- //
64
- // export const beforeLogin = async (req, res, next) => {
65
- // // Your logic here
66
- // next();
67
- // };
68
- //
69
- // export const afterLogin = async (req, res, next) => {
70
- // // Your logic here
71
- // next();
72
- // };
73
- //
74
- // export const beforeLogout = async (req, res, next) => {
75
- // // Your logic here
76
- // next();
77
- // };
78
- //
79
- // export const afterLogout = async (req, res, next) => {
80
- // // Your logic here
81
- // next();
82
- // };
83
- //
84
- // export const beforeSignup = async (req, res, next) => {
85
- // // Your logic here
86
- // next();
87
- // };
88
- //
89
- // export const afterSignup = async (req, res, next) => {
90
- // // Your logic here
91
- // next();
92
- // };
93
- //
94
- // export const beforeUpdatePassword = async (req, res, next) => {
95
- // // Your logic here
96
- // next();
97
- // };
98
- //
99
- // export const afterUpdatePassword = async (req, res, next) => {
100
- // // Your logic here
101
- // next();
102
- // };
103
- // {{/if}}
64
+ // export const beforeGetMe = [async (req, res, next) => {
65
+ // next();
66
+ // }];
67
+
68
+ // export const afterGetMe = [async (req, res, next) => {
69
+ // next();
70
+ // }];
71
+
72
+ // export const onGetMeError = [async (err, req, res, next) => {
73
+ // next();
74
+ // }];
75
+
76
+ // export const beforeLogin = [async (req, res, next) => {
77
+ // next();
78
+ // }];
79
+
80
+ // export const afterLogin = [async (req, res, next) => {
81
+ // next();
82
+ // }];
83
+
84
+ // export const onLoginError = [async (err, req, res, next) => {
85
+ // next();
86
+ // }];
87
+
88
+ // export const beforeLogout = [async (req, res, next) => {
89
+ // next();
90
+ // }];
91
+
92
+ // export const afterLogout = [async (req, res, next) => {
93
+ // next();
94
+ // }];
95
+
96
+ // export const onLogoutError = [async (err, req, res, next) => {
97
+ // next();
98
+ // }];
99
+
100
+ // export const beforeSignup = [async (req, res, next) => {
101
+ // next();
102
+ // }];
103
+
104
+ // export const afterSignup = [async (req, res, next) => {
105
+ // next();
106
+ // }];
107
+
108
+ // export const onSignupError = [async (err, req, res, next) => {
109
+ // next();
110
+ // }];
111
+
112
+ // export const beforeUpdatePassword = [async (req, res, next) => {
113
+ // next();
114
+ // }];
115
+
116
+ // export const afterUpdatePassword = [async (req, res, next) => {
117
+ // next();
118
+ // }];
119
+
120
+ // export const onUpdatePasswordError = [async (err, req, res, next) => {
121
+ // next();
122
+ // }];
123
+ {{/if}}
@@ -1,11 +1,11 @@
1
1
  {{#if typescript}}
2
- import prisma from "../../utils/prisma/index.js";
2
+ import { Prisma } from "@prisma/client"
3
3
  import { AuthPrismaQueryOptions } from 'arkos/prisma';
4
4
 
5
- const authQueryOptions: AuthPrismaQueryOptions<typeof prisma.user> = {
5
+ const authQueryOptions: AuthPrismaQueryOptions<Prisma.UserDelegate> = {
6
6
  {{else}}
7
7
  /**
8
- * @type {import("arkos/prisma").PrismaQueryOptions<typeof import('../../utils/prisma/index.js').prisma.user>}
8
+ * @type {import("arkos/prisma").PrismaQueryOptions<typeof import("@prisma/client").Prisma.UserDelegate>}
9
9
  */
10
10
  const authQueryOptions = {
11
11
  {{/if}}
@@ -1,6 +1,16 @@
1
1
  {{#if typescript}}
2
- import { AuthConfigs } from "arkos/auth"
2
+ import { AuthConfigs } from "arkos/auth";
3
+ {{/if}}
4
+ import { authService } from "arkos/services";
5
+
6
+ export const authPermissionPermissions = {
7
+ canCreate: authService.permission("Create", "auth-permission"),
8
+ canUpdate: authService.permission("Update", "auth-permission"),
9
+ canDelete: authService.permission("Delete", "auth-permission"),
10
+ canView: authService.permission("View", "auth-permission"),
11
+ }
3
12
 
13
+ {{#if typescript}}
4
14
  const authPermissionAuthConfigs: AuthConfigs = {
5
15
  {{else}}
6
16
  /** @type {import('arkos/auth').AuthConfigs} */
@@ -14,10 +24,34 @@ const authPermissionAuthConfigs = {
14
24
  },
15
25
  {{#if (eq authentication.type "static")}}
16
26
  accessControl: {
17
- // Create: ["Admin"],
18
- // Update: ["Admin", "Manager"],
19
- // Delete: ["Admin"],
20
- // View: ["User", "Admin", "Guest"],
27
+ // Create: {
28
+ {{#if (eq authentication.type "static")}}
29
+ // roles: [],
30
+ {{/if}}
31
+ // name: "Create New Auth Permission",
32
+ // description: "Permission to create auth permission records"
33
+ // },
34
+ // Update: {
35
+ {{#if (eq authentication.type "static")}}
36
+ // roles: [],
37
+ {{/if}}
38
+ // name: "Update Auth Permission",
39
+ // description: "Permission to update auth permission records"
40
+ // },
41
+ // Delete: {
42
+ {{#if (eq authen.type "static")}}
43
+ // roles: [],
44
+ {{/if}}
45
+ // name: "Delete Auth Permission",
46
+ // description: "Permission to delete auth permission records"
47
+ // },
48
+ // View: {
49
+ {{#if (eq authen.type "static")}}
50
+ // roles: [],
51
+ {{/if}}
52
+ // name: "View Auth Permission",
53
+ // description: "Permission to update auth permission records"
54
+ // },
21
55
  },
22
56
  {{/if}}
23
57
  };
@@ -1,11 +1,11 @@
1
1
  {{#if typescript}}
2
- import prisma from "../../utils/prisma/index.js";
2
+ import { Prisma } from "@prisma/client"
3
3
  import { PrismaQueryOptions } from 'arkos/prisma';
4
4
 
5
- const authPermissionQueryOptions: PrismaQueryOptions<typeof prisma.authPermission> = {
5
+ const authPermissionQueryOptions: PrismaQueryOptions<Prisma.AuthPermissionDelegate> = {
6
6
  {{else}}
7
7
  /**
8
- * @type {import("arkos/prisma").PrismaQueryOptions<typeof import('../../utils/prisma/index.js').prisma.authPermission>}
8
+ * @type {import("arkos/prisma").PrismaQueryOptions<typeof import("@prisma/client").Prisma.AuthPermissionDelegate>}
9
9
  */
10
10
  const authPermissionQueryOptions = {
11
11
  {{/if}}
@@ -1,12 +1,13 @@
1
1
  import { BaseService } from "arkos/services";
2
+ {{#if typescript}}
3
+ import { Prisma } from "@prisma/client"
2
4
 
3
- class AuthPermissionService extends BaseService {
4
- constructor() {
5
- super("auth-permission");
6
- }
7
- // Add your custom service methods here
8
- }
5
+ class AuthPermissionService extends BaseService<Prisma.AuthPermissionDelegate> {}
6
+ {{else}}
9
7
 
10
- const authPermissionService = new AuthPermissionService();
8
+ class AuthPermissionService extends BaseService {}
9
+ {{/if}}
10
+
11
+ const authPermissionService = new AuthPermissionService("auth-permission");
11
12
 
12
13
  export default authPermissionService;
@@ -1,6 +1,16 @@
1
1
  {{#if typescript}}
2
- import { AuthConfigs } from "arkos/auth"
2
+ import { AuthConfigs } from "arkos/auth";
3
+ {{/if}}
4
+ import { authService } from "arkos/services";
5
+
6
+ export const authRolePermissions = {
7
+ canCreate: authService.permission("Create", "auth-role"),
8
+ canUpdate: authService.permission("Update", "auth-role"),
9
+ canDelete: authService.permission("Delete", "auth-role"),
10
+ canView: authService.permission("View", "auth-role"),
11
+ }
3
12
 
13
+ {{#if typescript}}
4
14
  const authRoleAuthConfigs: AuthConfigs = {
5
15
  {{else}}
6
16
  /** @type {import('arkos/auth').AuthConfigs} */
@@ -14,10 +24,34 @@ const authRoleAuthConfigs = {
14
24
  },
15
25
  {{#if (eq authentication.type "static")}}
16
26
  accessControl: {
17
- // Create: ["Admin"],
18
- // Update: ["Admin", "Manager"],
19
- // Delete: ["Admin"],
20
- // View: ["User", "Admin", "Guest"],
27
+ // Create: {
28
+ {{#if (eq authentication.type "static")}}
29
+ // roles: [],
30
+ {{/if}}
31
+ // name: "Create New Auth Role",
32
+ // description: "Permission to create auth role records"
33
+ // },
34
+ // Update: {
35
+ {{#if (eq authentication.type "static")}}
36
+ // roles: [],
37
+ {{/if}}
38
+ // name: "Update Auth Role",
39
+ // description: "Permission to update auth role records"
40
+ // },
41
+ // Delete: {
42
+ {{#if (eq authentication.type "static")}}
43
+ // roles: [],
44
+ {{/if}}
45
+ // name: "Delete Auth Role",
46
+ // description: "Permission to delete auth role records"
47
+ // },
48
+ // View: {
49
+ {{#if (eq authentication.type "static")}}
50
+ // roles: [],
51
+ {{/if}}
52
+ // name: "View Auth Role",
53
+ // description: "Permission to update auth role records"
54
+ // },
21
55
  },
22
56
  {{/if}}
23
57
  };
@@ -1,11 +1,11 @@
1
1
  {{#if typescript}}
2
- import prisma from "../../utils/prisma/index.js";
2
+ import { Prisma } from "@prisma/client"
3
3
  import { PrismaQueryOptions } from 'arkos/prisma';
4
4
 
5
- const authRoleQueryOptions: PrismaQueryOptions<typeof prisma.authRole> = {
5
+ const authRoleQueryOptions: PrismaQueryOptions<Prisma.AuthRoleDelegate> = {
6
6
  {{else}}
7
7
  /**
8
- * @type {import("arkos/prisma").PrismaQueryOptions<typeof import('../../utils/prisma/index.js').prisma.authRole>}
8
+ * @type {import("arkos/prisma").PrismaQueryOptions<typeof import("@prisma/client").Prisma.AuthRoleDelegate>}
9
9
  */
10
10
  const authRoleQueryOptions = {
11
11
  {{/if}}
@@ -1,12 +1,13 @@
1
1
  import { BaseService } from "arkos/services";
2
+ {{#if typescript}}
3
+ import { Prisma } from "@prisma/client"
2
4
 
3
- class AuthRoleService extends BaseService {
4
- constructor() {
5
- super("auth-role");
6
- }
7
- // Add your custom service methods here
8
- }
5
+ class AuthRoleService extends BaseService<Prisma.AuthRoleDelegate> {}
6
+ {{else}}
9
7
 
10
- const authRoleService = new AuthRoleService();
8
+ class AuthRoleService extends BaseService {}
9
+ {{/if}}
10
+
11
+ const authRoleService = new AuthRoleService("auth-role");
11
12
 
12
13
  export default authRoleService;
@@ -14,10 +14,34 @@ const fileUplaodAuthConfigs = {
14
14
  },
15
15
  {{#if (eq authentication.type "static")}}
16
16
  accessControl: {
17
- // Create: ["Admin"],
18
- // Update: ["Admin", "Manager"],
19
- // Delete: ["Admin"],
20
- // View: ["User", "Admin", "Guest"],
17
+ // Create: {
18
+ {{#if (eq authentication.type "static")}}
19
+ // roles: [],
20
+ {{/if}}
21
+ // name: "Upload File",
22
+ // description: "Permission to upload file"
23
+ // },
24
+ // Update: {
25
+ {{#if (eq authentication.type "static")}}
26
+ // roles: [],
27
+ {{/if}}
28
+ // name: "Update File",
29
+ // description: "Permission to update file"
30
+ // },
31
+ // Delete: {
32
+ {{#if (eq authen.type "static")}}
33
+ // roles: [],
34
+ {{/if}}
35
+ // name: "Delete File",
36
+ // description: "Permission to delete file"
37
+ // },
38
+ // View: {
39
+ {{#if (eq authen.type "static")}}
40
+ // roles: [],
41
+ {{/if}}
42
+ // name: "View File",
43
+ // description: "Permission to view file"
44
+ // },
21
45
  },
22
46
  {{/if}}
23
47
  };
@@ -1,77 +1,83 @@
1
1
  {{#if typescript}}
2
2
  import { ArkosRequest, ArkosResponse, ArkosNextFunction } from "arkos";
3
3
 
4
- // export const beforeFindFile = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
5
- // // Your logic here
4
+ // export const beforeFindFile = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
6
5
  // next();
7
- // };
6
+ // }];
8
7
  //
9
- // // There is not afterFindFile: because the main handler is handled by express.static()
10
- //
11
- // export const beforeUploadFile = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
12
- // // Your logic here
8
+ // export const beforeUploadFile = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
13
9
  // next();
14
- // };
10
+ // }];
15
11
  //
16
- // export const afterUploadFile = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
17
- // // Your logic here
12
+ // export const afterUploadFile = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
13
+ // next();
14
+ // }];
15
+
16
+ // export const onUploadFileError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
18
17
  // next();
19
- // };
18
+ // }];
20
19
  //
21
- // export const beforeUpdateFile = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
22
- // // Your logic here
20
+ // export const beforeUpdateFile = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
23
21
  // next();
24
- // };
22
+ // }];
25
23
  //
26
- // export const afterUpdateFile = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
27
- // // Your logic here
24
+ // export const afterUpdateFile = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
28
25
  // next();
29
- // };
26
+ // }];
30
27
  //
31
- // export const beforeDeleteFile = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
32
- // // Your logic here
28
+ // export const onUpdateFileError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
33
29
  // next();
34
- // };
30
+ // }];
31
+
32
+ // export const beforeDeleteFile = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
33
+ // next();
34
+ // }];
35
35
  //
36
- // export const afterDeleteFile = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
37
- // // Your logic here
36
+ // export const afterDeleteFile = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
37
+ // next();
38
+ // }];
39
+
40
+ // export const onDeleteFileError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
38
41
  // next();
39
- // };
42
+ // }];
40
43
  {{else}}
41
- // export const beforeFindFile = async (req, res, next) => {
42
- // // Your logic here
44
+ // export const beforeFindFile = [async (req, res, next) => {
43
45
  // next();
44
- // };
46
+ // }];
45
47
  //
46
- // // There is not afterFindFile: because the main handler is handled by express.static()
47
- //
48
- // export const beforeUploadFile = async (req, res, next) => {
49
- // // Your logic here
48
+ // export const beforeUploadFile = [async (req, res, next) => {
50
49
  // next();
51
- // };
50
+ // }];
52
51
  //
53
- // export const afterUploadFile = async (req, res, next) => {
54
- // // Your logic here
52
+ // export const afterUploadFile = [async (req, res, next) => {
55
53
  // next();
56
- // };
54
+ // }];
57
55
  //
58
- // export const beforeUpdateFile = async (req, res, next) => {
59
- // // Your logic here
56
+ // export const onUploadFileError = [async (err, req, res, next) => {
57
+ // next();
58
+ // }];
59
+
60
+ // export const beforeUpdateFile = [async (req, res, next) => {
60
61
  // next();
61
- // };
62
+ // }];
62
63
  //
63
- // export const afterUpdateFile = async (req, res, next) => {
64
- // // Your logic here
64
+ // export const afterUpdateFile = [async (req, res, next) => {
65
65
  // next();
66
- // };
66
+ // }];
67
67
  //
68
- // export const beforeDeleteFile = async (req, res, next) => {
69
- // // Your logic here
68
+ // export const onUpdateFileError = [async (err, req, res, next) => {
70
69
  // next();
71
- // };
70
+ // }];
71
+
72
+ // export const beforeDeleteFile = [async (req, res, next) => {
73
+ // next();
74
+ // }];
72
75
  //
73
- // export const afterDeleteFile = async (req, res, next) => {
74
- // // Your logic here
76
+ // export const afterDeleteFile = [async (req, res, next) => {
77
+ // next();
78
+ // }];
79
+
80
+ // export const onDeleteFileError = [async (err, req, res, next) => {
75
81
  // next();
76
- // };
82
+ // }];
77
83
  {{/if}}
@@ -1,6 +1,16 @@
1
1
  {{#if typescript}}
2
- import { AuthConfigs } from "arkos/auth"
2
+ import { AuthConfigs } from "arkos/auth";
3
+ {{/if}}
4
+ import { authService } from "arkos/services";
5
+
6
+ export const userPermissions = {
7
+ canCreate: authService.permission("Create", "user"),
8
+ canUpdate: authService.permission("Update", "user"),
9
+ canDelete: authService.permission("Delete", "user"),
10
+ canView: authService.permission("View", "user"),
11
+ }
3
12
 
13
+ {{#if typescript}}
4
14
  const userAuthConfigs: AuthConfigs = {
5
15
  {{else}}
6
16
  /** @type {import('arkos/auth').AuthConfigs} */
@@ -14,10 +24,34 @@ const userAuthConfigs = {
14
24
  },
15
25
  {{#if (eq authentication.type "static")}}
16
26
  accessControl: {
17
- // Create: ["Admin"],
18
- // Update: ["Admin", "Manager"],
19
- // Delete: ["Admin"],
20
- // View: ["User", "Admin", "Guest"],
27
+ // Create: {
28
+ {{#if (eq authentication.type "static")}}
29
+ // roles: [],
30
+ {{/if}}
31
+ // name: "Create New User",
32
+ // description: "Permission to create user records"
33
+ // },
34
+ // Update: {
35
+ {{#if (eq authentication.type "static")}}
36
+ // roles: [],
37
+ {{/if}}
38
+ // name: "Update User",
39
+ // description: "Permission to update user records"
40
+ // },
41
+ // Delete: {
42
+ {{#if (eq authentication.type "static")}}
43
+ // roles: [],
44
+ {{/if}}
45
+ // name: "Delete User",
46
+ // description: "Permission to delete user records"
47
+ // },
48
+ // View: {
49
+ {{#if (eq authentication.type "static")}}
50
+ // roles: [],
51
+ {{/if}}
52
+ // name: "View User",
53
+ // description: "Permission to update user records"
54
+ // },
21
55
  },
22
56
  {{/if}}
23
57
  };
@@ -1,163 +1,195 @@
1
1
  {{#if typescript}}
2
2
  import { ArkosRequest, ArkosResponse, ArkosNextFunction } from "arkos";
3
3
 
4
- // export const beforeCreateOne = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
5
- // // Your logic here
6
- // next();
7
- // };
8
- //
9
- // export const afterCreateOne = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
10
- // // Your logic here
11
- // next();
12
- // };
13
- //
14
- // export const beforeFindOne = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
15
- // // Your logic here
16
- // next();
17
- // };
18
- //
19
- // export const afterFindOne = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
20
- // // Your logic here
21
- // next();
22
- // };
23
- //
24
- // export const beforeFindMany = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
25
- // // Your logic here
26
- // next();
27
- // };
28
- //
29
- // export const afterFindMany = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
30
- // // Your logic here
31
- // next();
32
- // };
33
- //
34
- // export const beforeUpdateOne = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
35
- // // Your logic here
36
- // next();
37
- // };
38
- //
39
- // export const afterUpdateOne = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
40
- // // Your logic here
41
- // next();
42
- // };
43
- //
44
- // export const beforeDeleteOne = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
45
- // // Your logic here
46
- // next();
47
- // };
48
- //
49
- // export const afterDeleteOne = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
50
- // // Your logic here
51
- // next();
52
- // };
53
- //
54
- // export const beforeCreateMany = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
55
- // // Your logic here
56
- // next();
57
- // };
58
- //
59
- // export const afterCreateMany = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
60
- // // Your logic here
61
- // next();
62
- // };
63
- //
64
- // export const beforeUpdateMany = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
65
- // // Your logic here
66
- // next();
67
- // };
68
- //
69
- // export const afterUpdateMany = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
70
- // // Your logic here
71
- // next();
72
- // };
73
- //
74
- // export const beforeDeleteMany = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
75
- // // Your logic here
76
- // next();
77
- // };
78
- //
79
- // export const afterDeleteMany = async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
80
- // // Your logic here
81
- // next();
82
- // };
4
+ // export const beforeCreateOne = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
5
+ // next();
6
+ // }];
7
+
8
+ // export const afterCreateOne = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
9
+ // next();
10
+ // }];
11
+
12
+ // export const onCreateOneError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
13
+ // next();
14
+ // }];
15
+
16
+ // export const beforeFindOne = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
17
+ // next();
18
+ // }];
19
+
20
+ // export const afterFindOne = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
21
+ // next();
22
+ // }];
23
+
24
+ // export const onFindOneError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
25
+ // next();
26
+ // }];
27
+
28
+ // export const beforeFindMany = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
29
+ // next();
30
+ // }];
31
+
32
+ // export const afterFindMany = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
33
+ // next();
34
+ // }];
35
+
36
+ // export const onFindManyError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
37
+ // next();
38
+ // }];
39
+
40
+ // export const beforeUpdateOne = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
41
+ // next();
42
+ // }];
43
+
44
+ // export const afterUpdateOne = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
45
+ // next();
46
+ // }];
47
+
48
+ // export const onUpdateOneError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
49
+ // next();
50
+ // }];
51
+
52
+ // export const beforeDeleteOne = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
53
+ // next();
54
+ // }];
55
+
56
+ // export const afterDeleteOne = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
57
+ // next();
58
+ // }];
59
+
60
+ // export const onDeleteOneError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
61
+ // next();
62
+ // }];
63
+
64
+ // export const beforeCreateMany = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
65
+ // next();
66
+ // }];
67
+
68
+ // export const afterCreateMany = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
69
+ // next();
70
+ // }];
71
+
72
+ // export const onCreateManyError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
73
+ // next();
74
+ // }];
75
+
76
+ // export const beforeUpdateMany = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
77
+ // next();
78
+ // }];
79
+
80
+ // export const afterUpdateMany = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
81
+ // next();
82
+ // }];
83
+
84
+ // export const onUpdateManyError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
85
+ // next();
86
+ // }];
87
+
88
+ // export const beforeDeleteMany = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
89
+ // next();
90
+ // }];
91
+
92
+ // export const afterDeleteMany = [async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
93
+ // next();
94
+ // }];
95
+
96
+ // export const onDeleteManyError = [async (err: any, req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
97
+ // next();
98
+ // }];
83
99
  {{else}}
84
- // export const beforeCreateOne = async (req, res, next) => {
85
- // // Your logic here
86
- // next();
87
- // };
88
- //
89
- // export const afterCreateOne = async (req, res, next) => {
90
- // // Your logic here
91
- // next();
92
- // };
93
- //
94
- // export const beforeFindOne = async (req, res, next) => {
95
- // // Your logic here
96
- // next();
97
- // };
98
- //
99
- // export const afterFindOne = async (req, res, next) => {
100
- // // Your logic here
101
- // next();
102
- // };
103
- //
104
- // export const beforeFindMany = async (req, res, next) => {
105
- // // Your logic here
106
- // next();
107
- // };
108
- //
109
- // export const afterFindMany = async (req, res, next) => {
110
- // // Your logic here
111
- // next();
112
- // };
113
- //
114
- // export const beforeUpdateOne = async (req, res, next) => {
115
- // // Your logic here
116
- // next();
117
- // };
118
- //
119
- // export const afterUpdateOne = async (req, res, next) => {
120
- // // Your logic here
121
- // next();
122
- // };
123
- //
124
- // export const beforeDeleteOne = async (req, res, next) => {
125
- // // Your logic here
126
- // next();
127
- // };
128
- //
129
- // export const afterDeleteOne = async (req, res, next) => {
130
- // // Your logic here
131
- // next();
132
- // };
133
- //
134
- // export const beforeCreateMany = async (req, res, next) => {
135
- // // Your logic here
136
- // next();
137
- // };
138
- //
139
- // export const afterCreateMany = async (req, res, next) => {
140
- // // Your logic here
141
- // next();
142
- // };
143
- //
144
- // export const beforeUpdateMany = async (req, res, next) => {
145
- // // Your logic here
146
- // next();
147
- // };
148
- //
149
- // export const afterUpdateMany = async (req, res, next) => {
150
- // // Your logic here
151
- // next();
152
- // };
153
- //
154
- // export const beforeDeleteMany = async (req, res, next) => {
155
- // // Your logic here
156
- // next();
157
- // };
158
- //
159
- // export const afterDeleteMany = async (req, res, next) => {
160
- // // Your logic here
161
- // next();
162
- // };
100
+ // export const beforeCreateOne = [async (req, res, next) => {
101
+ // next();
102
+ // }];
103
+
104
+ // export const afterCreateOne = [async (req, res, next) => {
105
+ // next();
106
+ // }];
107
+
108
+ // export const onCreateOneError = [async (err, req, res, next) => {
109
+ // next();
110
+ // }];
111
+
112
+ // export const beforeFindOne = [async (req, res, next) => {
113
+ // next();
114
+ // }];
115
+
116
+ // export const afterFindOne = [async (req, res, next) => {
117
+ // next();
118
+ // }];
119
+
120
+ // export const onFindOneError = [async (err, req, res, next) => {
121
+ // next();
122
+ // }];
123
+
124
+ // export const beforeFindMany = [async (req, res, next) => {
125
+ // next();
126
+ // }];
127
+
128
+ // export const afterFindMany = [async (req, res, next) => {
129
+ // next();
130
+ // }];
131
+
132
+ // export const onFindManyError = [async (err, req, res, next) => {
133
+ // next();
134
+ // }];
135
+
136
+ // export const beforeUpdateOne = [async (req, res, next) => {
137
+ // next();
138
+ // }];
139
+
140
+ // export const afterUpdateOne = [async (req, res, next) => {
141
+ // next();
142
+ // }];
143
+
144
+ // export const onUpdateOneError = [async (err, req, res, next) => {
145
+ // next();
146
+ // }];
147
+
148
+ // export const beforeDeleteOne = [async (req, res, next) => {
149
+ // next();
150
+ // }];
151
+
152
+ // export const afterDeleteOne = [async (req, res, next) => {
153
+ // next();
154
+ // }];
155
+
156
+ // export const onDeleteOneError = [async (err, req, res, next) => {
157
+ // next();
158
+ // }];
159
+
160
+ // export const beforeCreateMany = [async (req, res, next) => {
161
+ // next();
162
+ // }];
163
+
164
+ // export const afterCreateMany = [async (req, res, next) => {
165
+ // next();
166
+ // }];
167
+
168
+ // export const onCreateManyError = [async (err, req, res, next) => {
169
+ // next();
170
+ // }];
171
+
172
+ // export const beforeUpdateMany = [async (req, res, next) => {
173
+ // next();
174
+ // }];
175
+
176
+ // export const afterUpdateMany = [async (req, res, next) => {
177
+ // next();
178
+ // }];
179
+
180
+ // export const onUpdateManyError = [async (err, req, res, next) => {
181
+ // next();
182
+ // }];
183
+
184
+ // export const beforeDeleteMany = [async (req, res, next) => {
185
+ // next();
186
+ // }];
187
+
188
+ // export const afterDeleteMany = [async (req, res, next) => {
189
+ // next();
190
+ // }];
191
+
192
+ // export const onDeleteManyError = [async (err, req, res, next) => {
193
+ // next();
194
+ // }];
163
195
  {{/if}}
@@ -1,81 +1,78 @@
1
1
  {{#if typescript}}
2
- import prisma from "../../utils/prisma/index.js";
3
2
  import { PrismaQueryOptions } from 'arkos/prisma';
3
+ import { Prisma } from "@prisma/client"
4
4
 
5
- const userQueryOptions: PrismaQueryOptions<typeof prisma.user> = {
5
+ const userQueryOptions: PrismaQueryOptions<Prisma.UserDelegate> = {
6
6
  {{else}}
7
7
  /**
8
- * @type {import("arkos/prisma").PrismaQueryOptions<typeof import('../../utils/prisma/index.js').prisma.user>}
8
+ * @type {import("arkos/prisma").PrismaQueryOptions<typeof import("@prisma/client").Prisma.UserDelegate>}
9
9
  */
10
10
  const userQueryOptions = {
11
11
  {{/if}}
12
- global: {},
13
- find: {
14
- omit: {
15
- password: true,
16
- },
17
- {{#if (eq authentication.type "dynamic")}}
18
- include: {
19
- {{#if authentication.multipleRoles}}
20
- roles: {
21
- include: {
22
- role: true,
23
- }
24
- },
25
- {{else}}
26
- role: {
27
- include: {
28
- role: true,
29
- }
30
- },
31
- {{/if}}
12
+ global: {
13
+ omit: {
14
+ password: true,
15
+ },
16
+ },
17
+ find: {
18
+ {{#if (eq authentication.type "dynamic")}}
19
+ include: {
20
+ {{#if authentication.multipleRoles}}
21
+ roles: {
22
+ include: {
23
+ role: true,
24
+ }
25
+ },
26
+ {{else}}
27
+ role: {
28
+ include: {
29
+ role: true,
30
+ }
32
31
  },
33
32
  {{/if}}
34
33
  },
35
- findOne: {
36
- {{#if (eq authentication.type "dynamic")}}
37
- include: {
38
- {{#if authentication.multipleRoles}}
39
- roles: {
40
- include: {
41
- role: {
42
- include: {
43
- permissions: true
44
- }
34
+ {{/if}}
35
+ },
36
+ findOne: {
37
+ {{#if (eq authentication.type "dynamic")}}
38
+ include: {
39
+ {{#if authentication.multipleRoles}}
40
+ roles: {
41
+ include: {
42
+ role: {
43
+ include: {
44
+ permissions: true
45
45
  }
46
46
  }
47
- },
48
- {{else}}
49
- role: {
50
- include: {
51
- role: {
52
- include: {
53
- permissions: true
54
- }
47
+ }
48
+ },
49
+ {{else}}
50
+ role: {
51
+ include: {
52
+ role: {
53
+ include: {
54
+ permissions: true
55
55
  }
56
56
  }
57
- },
58
- {{/if}}
57
+ }
59
58
  },
60
59
  {{/if}}
61
60
  },
62
- findMany: {},
63
- update: {},
64
- updateMany: {},
65
- updateOne: {},
66
- create: {},
67
- createMany: {},
68
- createOne: {},
69
- save: {
70
- omit: {
71
- password: true,
72
- },
73
- },
74
- saveMany: {},
75
- saveOne: {},
76
- delete: {},
77
- deleteMany: {},
78
- deleteOne: {},
61
+ {{/if}}
62
+ },
63
+ findMany: {},
64
+ update: {},
65
+ updateMany: {},
66
+ updateOne: {},
67
+ create: {},
68
+ createMany: {},
69
+ createOne: {},
70
+ save: {},
71
+ saveMany: {},
72
+ saveOne: {},
73
+ delete: {},
74
+ deleteMany: {},
75
+ deleteOne: {},
79
76
  }
80
77
 
81
78
  export default userQueryOptions;
@@ -1,19 +1,13 @@
1
- {{#if typescript}}
2
- import prisma from "../../utils/prisma";
3
1
  import { BaseService } from "arkos/services";
2
+ {{#if typescript}}
3
+ import { Prisma } from "@prisma/client"
4
4
 
5
- class UserService extends BaseService<typeof prisma.user> {
5
+ class UserService extends BaseService<Prisma.UserDelegate> {}
6
6
  {{else}}
7
- import { BaseService } from "arkos/services";
8
7
 
9
- class UserService extends BaseService {
8
+ class UserService extends BaseService {}
10
9
  {{/if}}
11
- constructor() {
12
- super("user");
13
- }
14
- // Add your custom service methods here
15
- }
16
10
 
17
- const userService = new UserService();
11
+ const userService = new UserService("user");
18
12
 
19
13
  export default userService;