@goweekdays/layer-common 1.0.1 → 1.0.3
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/.playground/nuxt.config.ts +0 -1
- package/CHANGELOG.md +12 -0
- package/components/InvitationMain.vue +195 -0
- package/components/Layout/Header.vue +14 -5
- package/components/LinkHome.vue +9 -0
- package/components/MemberMain.vue +452 -0
- package/components/RolePermissionMain.vue +1 -1
- package/composables/useCommonPermission.ts +61 -2
- package/composables/useLocal.ts +3 -28
- package/composables/useLocalAuth.ts +4 -0
- package/composables/useLocalSetup.ts +46 -0
- package/composables/useMember.ts +80 -59
- package/composables/useOrg.ts +12 -1
- package/composables/useUser.ts +9 -2
- package/composables/useUtils.ts +27 -0
- package/composables/useVerification.ts +3 -2
- package/nuxt.config.ts +1 -4
- package/package.json +2 -1
- package/plugins/iconify.client.ts +5 -0
- package/plugins/vuetify.ts +10 -0
- package/types/role.d.ts +1 -1
- package/composables/useAdminPermission.ts +0 -127
package/composables/useMember.ts
CHANGED
|
@@ -1,86 +1,107 @@
|
|
|
1
1
|
export default function useMember() {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
user: "",
|
|
7
|
-
role: "",
|
|
8
|
-
status: "",
|
|
9
|
-
createdAt: "",
|
|
10
|
-
updatedAt: "",
|
|
11
|
-
deletedAt: "",
|
|
12
|
-
};
|
|
13
|
-
});
|
|
2
|
+
const members = useState<Array<TMember>>("members", () => []);
|
|
3
|
+
const page = useState("page", () => 1);
|
|
4
|
+
const pages = useState("pages", () => 0);
|
|
5
|
+
const pageRange = useState("pageRange", () => "-- - -- of --");
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
const member = useState<TMember>("member", () => ({
|
|
8
|
+
_id: "",
|
|
9
|
+
org: "",
|
|
10
|
+
orgName: "",
|
|
11
|
+
roleName: "",
|
|
12
|
+
name: "",
|
|
13
|
+
user: "",
|
|
14
|
+
role: "",
|
|
15
|
+
type: "",
|
|
16
|
+
customerOrgId: "",
|
|
17
|
+
customerSiteId: "",
|
|
18
|
+
status: "",
|
|
19
|
+
createdAt: "",
|
|
20
|
+
updatedAt: "",
|
|
21
|
+
deletedAt: "",
|
|
22
|
+
}));
|
|
24
23
|
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
delete value._id;
|
|
29
|
-
delete value.status;
|
|
24
|
+
function getByUserId(user: string) {
|
|
25
|
+
return useNuxtApp().$api<TMember>(`/api/members/user/${user}`);
|
|
26
|
+
}
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
function getByUserType(user: string, type: string, org?: string) {
|
|
29
|
+
return useNuxtApp().$api<TMember>(`/api/members/user/${user}/app/${type}`, {
|
|
30
|
+
method: "GET",
|
|
31
|
+
query: { org },
|
|
34
32
|
});
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
function getAll({
|
|
38
|
-
search = "",
|
|
35
|
+
async function getAll({
|
|
39
36
|
page = 1,
|
|
40
|
-
|
|
41
|
-
user = "",
|
|
42
|
-
type = "main",
|
|
37
|
+
search = "",
|
|
43
38
|
limit = 10,
|
|
39
|
+
user = "",
|
|
40
|
+
org = "",
|
|
41
|
+
type = "",
|
|
44
42
|
status = "active",
|
|
45
43
|
} = {}) {
|
|
46
|
-
return useNuxtApp().$api<
|
|
44
|
+
return useNuxtApp().$api<Record<string, any>>("/api/members", {
|
|
47
45
|
method: "GET",
|
|
48
|
-
query: {
|
|
46
|
+
query: { page, limit, search, user, org, type, status },
|
|
49
47
|
});
|
|
50
48
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
function createUserByVerification(
|
|
50
|
+
verificationId: string,
|
|
51
|
+
payload: Record<string, any>
|
|
52
|
+
) {
|
|
53
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
54
|
+
`/api/users/invite/${verificationId}`,
|
|
55
|
+
{
|
|
56
|
+
method: "POST",
|
|
57
|
+
body: payload,
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
function
|
|
63
|
-
return useNuxtApp().$api<TMember>(
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
function createMemberInvite(verificatonId: string) {
|
|
63
|
+
return useNuxtApp().$api<TMember>(
|
|
64
|
+
`/api/members/verification/${verificatonId}`,
|
|
65
|
+
{
|
|
66
|
+
method: "POST",
|
|
67
|
+
}
|
|
68
|
+
);
|
|
66
69
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
function updateMemberStatus(id: string, status: string) {
|
|
71
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
72
|
+
`/api/members/status/${status}/id/${id}`,
|
|
73
|
+
{
|
|
74
|
+
method: "PUT",
|
|
75
|
+
}
|
|
76
|
+
);
|
|
72
77
|
}
|
|
73
78
|
|
|
79
|
+
function updateMemberRole(
|
|
80
|
+
id: string,
|
|
81
|
+
role: string,
|
|
82
|
+
type: string,
|
|
83
|
+
org: string
|
|
84
|
+
) {
|
|
85
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
86
|
+
`/api/members/id/${id}/role/${role}/type/${type}/org/${org}`,
|
|
87
|
+
{
|
|
88
|
+
method: "PUT",
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
74
92
|
return {
|
|
93
|
+
members,
|
|
75
94
|
member,
|
|
76
|
-
setMember,
|
|
77
|
-
inviteMember,
|
|
78
|
-
getAll,
|
|
79
95
|
page,
|
|
80
96
|
pages,
|
|
81
97
|
pageRange,
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
|
|
99
|
+
getAll,
|
|
84
100
|
getByUserId,
|
|
101
|
+
createUserByVerification,
|
|
102
|
+
createMemberInvite,
|
|
103
|
+
getByUserType,
|
|
104
|
+
updateMemberStatus,
|
|
105
|
+
updateMemberRole,
|
|
85
106
|
};
|
|
86
107
|
}
|
package/composables/useOrg.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
export default function useOrg() {
|
|
2
|
-
function getAll({ page = 1, search = "", limit = 20 } = {}) {
|
|
2
|
+
function getAll({ page = 1, search = "", limit = 20, status = "" } = {}) {
|
|
3
3
|
return useNuxtApp().$api<Record<string, any>>("/api/organizations", {
|
|
4
4
|
method: "GET",
|
|
5
5
|
query: {
|
|
6
6
|
page,
|
|
7
7
|
search,
|
|
8
8
|
limit,
|
|
9
|
+
status,
|
|
9
10
|
},
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
function getById(id = "") {
|
|
15
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
16
|
+
`/api/organizations/id/${id}`,
|
|
17
|
+
{
|
|
18
|
+
method: "GET",
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
13
23
|
function getByUserId({ page = 1, search = "", user = "", limit = 20 } = {}) {
|
|
14
24
|
return useNuxtApp().$api<Record<string, any>>(
|
|
15
25
|
`/api/organizations/user/${user}`,
|
|
@@ -91,5 +101,6 @@ export default function useOrg() {
|
|
|
91
101
|
total,
|
|
92
102
|
getByName,
|
|
93
103
|
currentOrg,
|
|
104
|
+
getById,
|
|
94
105
|
};
|
|
95
106
|
}
|
package/composables/useUser.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export default function useUser() {
|
|
2
|
-
function inviteUser({
|
|
2
|
+
function inviteUser({
|
|
3
|
+
email = "",
|
|
4
|
+
app = "",
|
|
5
|
+
role = "",
|
|
6
|
+
roleName = "",
|
|
7
|
+
org = "",
|
|
8
|
+
orgName = "",
|
|
9
|
+
} = {}) {
|
|
3
10
|
return useNuxtApp().$api<Record<string, any>>("/api/auth/invite", {
|
|
4
11
|
method: "POST",
|
|
5
|
-
body: { email, app, role,
|
|
12
|
+
body: { email, app, role, roleName, org, orgName },
|
|
6
13
|
});
|
|
7
14
|
}
|
|
8
15
|
|
package/composables/useUtils.ts
CHANGED
|
@@ -241,6 +241,30 @@ export default function useUtils() {
|
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
function getRouteParam(field = "") {
|
|
245
|
+
if (!field) return "";
|
|
246
|
+
|
|
247
|
+
return (useRoute().params[field] as string) ?? "";
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function replaceMatch(str: string, match: string, replace: string) {
|
|
251
|
+
return str.replace(new RegExp(match, "g"), replace);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function setRouteParams(...args: Array<Record<string, string>>) {
|
|
255
|
+
const params: Record<string, string> = {};
|
|
256
|
+
|
|
257
|
+
args.forEach((arg) => {
|
|
258
|
+
Object.entries(arg).forEach(([key, value]) => {
|
|
259
|
+
if (value !== undefined && value !== null && value !== "") {
|
|
260
|
+
params[key] = value;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
return params;
|
|
266
|
+
}
|
|
267
|
+
|
|
244
268
|
return {
|
|
245
269
|
requiredRule,
|
|
246
270
|
emailRule,
|
|
@@ -263,5 +287,8 @@ export default function useUtils() {
|
|
|
263
287
|
requireListRule,
|
|
264
288
|
convertPermissionsToArray,
|
|
265
289
|
extractMonthYear,
|
|
290
|
+
getRouteParam,
|
|
291
|
+
replaceMatch,
|
|
292
|
+
setRouteParams,
|
|
266
293
|
};
|
|
267
294
|
}
|
|
@@ -5,10 +5,11 @@ export default function useUser() {
|
|
|
5
5
|
search = "",
|
|
6
6
|
page = 1,
|
|
7
7
|
email = "",
|
|
8
|
+
app = "",
|
|
8
9
|
} = {}) {
|
|
9
|
-
return useNuxtApp().$api<
|
|
10
|
+
return useNuxtApp().$api<Record<string, any>>("/api/verifications", {
|
|
10
11
|
method: "GET",
|
|
11
|
-
query: { status, search, page, type, email },
|
|
12
|
+
query: { status, search, page, type, email, app },
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
15
|
|
package/nuxt.config.ts
CHANGED
|
@@ -25,10 +25,7 @@ export default defineNuxtConfig({
|
|
|
25
25
|
APP_AFFILIATE: (process.env.APP_AFFILIATE as string) ?? "",
|
|
26
26
|
APP_INVENTORY: (process.env.APP_INVENTORY as string) ?? "",
|
|
27
27
|
APP_ASSET: (process.env.APP_ASSET as string) ?? "",
|
|
28
|
-
|
|
29
|
-
APP_BOOK_KEEPING: (process.env.APP_BOOK_KEEPING as string) ?? "",
|
|
30
|
-
APP_ZONAL: (process.env.APP_ZONAL as string) ?? "",
|
|
31
|
-
APP_SCHOOL: (process.env.APP_SCHOOL as string) ?? "",
|
|
28
|
+
APP_FINANCE: (process.env.APP_FINANCE as string) ?? "",
|
|
32
29
|
},
|
|
33
30
|
},
|
|
34
31
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@goweekdays/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.3",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@iconify/vue": "^5.0.0",
|
|
30
31
|
"@mdi/font": "^7.4.47",
|
|
31
32
|
"sass": "^1.80.6",
|
|
32
33
|
"zod": "^3.24.2"
|
package/plugins/vuetify.ts
CHANGED
|
@@ -3,6 +3,8 @@ import "@mdi/font/css/materialdesignicons.css";
|
|
|
3
3
|
|
|
4
4
|
import "vuetify/styles";
|
|
5
5
|
import { createVuetify } from "vuetify";
|
|
6
|
+
import { h } from "vue";
|
|
7
|
+
import { Icon } from "@iconify/vue";
|
|
6
8
|
|
|
7
9
|
const defaultTheme = {
|
|
8
10
|
dark: false,
|
|
@@ -34,6 +36,14 @@ export default defineNuxtPlugin((app) => {
|
|
|
34
36
|
defaultTheme,
|
|
35
37
|
},
|
|
36
38
|
},
|
|
39
|
+
icons: {
|
|
40
|
+
defaultSet: "iconify",
|
|
41
|
+
sets: {
|
|
42
|
+
iconify: {
|
|
43
|
+
component: (props: any) => h(Icon, { icon: props.icon }),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
37
47
|
});
|
|
38
48
|
|
|
39
49
|
app.vueApp.use(vuetify);
|
package/types/role.d.ts
CHANGED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
export default function useAdminPermission() {
|
|
2
|
-
const permissions: TPermissions = {
|
|
3
|
-
organizations: {
|
|
4
|
-
"see-all-organizations": {
|
|
5
|
-
check: true,
|
|
6
|
-
description: "Allows the user to view the list of all organizations.",
|
|
7
|
-
},
|
|
8
|
-
"see-organization-details": {
|
|
9
|
-
check: true,
|
|
10
|
-
description:
|
|
11
|
-
"Allows the user to view the details of a specific organization.",
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
"promo-codes": {
|
|
15
|
-
"create-promo-code": {
|
|
16
|
-
check: true,
|
|
17
|
-
description: "Allows the user to add new promo codes to the system.",
|
|
18
|
-
},
|
|
19
|
-
"see-promo-code-details": {
|
|
20
|
-
check: true,
|
|
21
|
-
description:
|
|
22
|
-
"Allows the user to view the details of a specific promo code.",
|
|
23
|
-
},
|
|
24
|
-
"edit-promo-code-details": {
|
|
25
|
-
check: true,
|
|
26
|
-
description:
|
|
27
|
-
"Allows the user to update the promo code’s name, discount value, and other settings.",
|
|
28
|
-
},
|
|
29
|
-
"change-promo-code-status": {
|
|
30
|
-
check: true,
|
|
31
|
-
description:
|
|
32
|
-
"Allows the user to activate, deactivate, or expire a promo code.",
|
|
33
|
-
},
|
|
34
|
-
"delete-promo-code": {
|
|
35
|
-
check: true,
|
|
36
|
-
description:
|
|
37
|
-
"Allows the user to remove a promo code from the system permanently.",
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
users: {
|
|
41
|
-
"see-all-users": {
|
|
42
|
-
check: true,
|
|
43
|
-
description: "Allows the user to view the list of all users.",
|
|
44
|
-
},
|
|
45
|
-
"see-user-details": {
|
|
46
|
-
check: true,
|
|
47
|
-
description: "Allows the user to view the details of a specific user.",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
invitations: {
|
|
51
|
-
"see-all-invitations": {
|
|
52
|
-
check: true,
|
|
53
|
-
description: "Allows the user to view the list of all invitations.",
|
|
54
|
-
},
|
|
55
|
-
"see-invitation-details": {
|
|
56
|
-
check: true,
|
|
57
|
-
description:
|
|
58
|
-
"Allows the user to view the details of a specific invitation.",
|
|
59
|
-
},
|
|
60
|
-
"edit-invitation-details": {
|
|
61
|
-
check: true,
|
|
62
|
-
description:
|
|
63
|
-
"Allows the user to update the details of a specific invitation.",
|
|
64
|
-
},
|
|
65
|
-
"change-invitation-status": {
|
|
66
|
-
check: true,
|
|
67
|
-
description: "Allows the user to update the status of an invitation.",
|
|
68
|
-
},
|
|
69
|
-
"delete-invitation": {
|
|
70
|
-
check: true,
|
|
71
|
-
description:
|
|
72
|
-
"Allows the user to remove an invitation from the system permanently.",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
members: {
|
|
76
|
-
"see-all-members": {
|
|
77
|
-
check: true,
|
|
78
|
-
description: "Allows the user to view the list of all members.",
|
|
79
|
-
},
|
|
80
|
-
"see-member-details": {
|
|
81
|
-
check: true,
|
|
82
|
-
description:
|
|
83
|
-
"Allows the user to view the details of a specific member.",
|
|
84
|
-
},
|
|
85
|
-
"change-member-status": {
|
|
86
|
-
check: true,
|
|
87
|
-
description: "Allows the user to update the status of a member.",
|
|
88
|
-
},
|
|
89
|
-
"remove-member": {
|
|
90
|
-
check: true,
|
|
91
|
-
description: "Allows the user to remove a member from the system.",
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
"roles-and-permissions": {
|
|
95
|
-
"view-all-roles": {
|
|
96
|
-
check: true,
|
|
97
|
-
description: "Allows the user to view the list of all roles.",
|
|
98
|
-
},
|
|
99
|
-
"view-role-details": {
|
|
100
|
-
check: true,
|
|
101
|
-
description: "Allows the user to view the details of a specific role.",
|
|
102
|
-
},
|
|
103
|
-
"update-role-name": {
|
|
104
|
-
check: true,
|
|
105
|
-
description: "Allows the user to edit the name of an existing role.",
|
|
106
|
-
},
|
|
107
|
-
"update-role-permissions": {
|
|
108
|
-
check: true,
|
|
109
|
-
description:
|
|
110
|
-
"Allows the user to modify permissions assigned to a role.",
|
|
111
|
-
},
|
|
112
|
-
"update-role-status": {
|
|
113
|
-
check: true,
|
|
114
|
-
description: "Allows the user to activate or deactivate a role.",
|
|
115
|
-
},
|
|
116
|
-
"delete-role": {
|
|
117
|
-
check: true,
|
|
118
|
-
description:
|
|
119
|
-
"Allows the user to remove a role from the system permanently.",
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
permissions,
|
|
126
|
-
};
|
|
127
|
-
}
|