@goweekdays/layer-common 1.4.6 → 1.5.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/CHANGELOG.md +13 -0
- package/components/Input/Currency.vue +60 -0
- package/components/Input/Infinity.vue +112 -0
- package/components/Input/Slug.vue +50 -0
- package/components/InvitationMain.vue +4 -4
- package/components/MemberInvite.vue +4 -1
- package/composables/useAddress.ts +4 -4
- package/composables/useApps.ts +4 -4
- package/composables/useChartOfAccount.ts +12 -7
- package/composables/useFile.ts +7 -4
- package/composables/useInvoice.ts +17 -11
- package/composables/useJobPost.ts +67 -0
- package/composables/useLedgerBilling.ts +8 -5
- package/composables/useLocalAuth.ts +10 -7
- package/composables/useMember.ts +34 -22
- package/composables/useOrder.ts +1 -1
- package/composables/useOrg.ts +21 -14
- package/composables/usePaymentMethod.ts +37 -24
- package/composables/usePermission.ts +8 -8
- package/composables/usePlan.ts +1 -1
- package/composables/usePrice.ts +1 -1
- package/composables/usePromo.ts +78 -0
- package/composables/usePromoCode.ts +4 -4
- package/composables/useRole.ts +7 -7
- package/composables/useSubscription.ts +29 -10
- package/composables/useUser.ts +11 -11
- package/composables/useUtils.ts +1 -1
- package/composables/useVerification.ts +22 -13
- package/nuxt.config.ts +3 -2
- package/package.json +1 -1
- package/pages/member-suspended.vue +1 -1
- package/plugins/API.ts +6 -46
- package/plugins/secure.client.ts +3 -1
- package/plugins/vuetify.ts +4 -0
- package/types/job-post.d.ts +18 -0
- package/types/org.d.ts +1 -0
- package/types/promo.d.ts +22 -0
package/composables/useMember.ts
CHANGED
|
@@ -16,18 +16,18 @@ export default function useMember() {
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
function getByUserId(user: string) {
|
|
19
|
-
return
|
|
19
|
+
return useNuxtApp().$api<TMember>(`/api/members/user/${user}`);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function getByUserType(user: string, type: string, org?: string) {
|
|
23
|
-
return
|
|
23
|
+
return useNuxtApp().$api<TMember>(`/api/members/user/${user}/app/${type}`, {
|
|
24
24
|
method: "GET",
|
|
25
25
|
query: { org },
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function getByApp({ app = "", user = "", org = "" } = {}) {
|
|
30
|
-
return
|
|
30
|
+
return useNuxtApp().$api<TMember>(`/api/members/app/${app}/user/${user}`, {
|
|
31
31
|
method: "GET",
|
|
32
32
|
query: { org },
|
|
33
33
|
});
|
|
@@ -40,7 +40,7 @@ export default function useMember() {
|
|
|
40
40
|
page = 1,
|
|
41
41
|
search = "",
|
|
42
42
|
} = {}) {
|
|
43
|
-
return
|
|
43
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
44
44
|
`/api/members/orgs/app/${app}/user/${user}`,
|
|
45
45
|
{
|
|
46
46
|
method: "GET",
|
|
@@ -58,7 +58,7 @@ export default function useMember() {
|
|
|
58
58
|
app = "",
|
|
59
59
|
status = "active",
|
|
60
60
|
} = {}) {
|
|
61
|
-
return
|
|
61
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/members/app/${app}`, {
|
|
62
62
|
method: "GET",
|
|
63
63
|
query: { page, limit, search, user, org, status },
|
|
64
64
|
});
|
|
@@ -67,19 +67,25 @@ export default function useMember() {
|
|
|
67
67
|
verificationId: string,
|
|
68
68
|
payload: Record<string, any>
|
|
69
69
|
) {
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
71
|
+
`/api/users/invite/${verificationId}`,
|
|
72
|
+
{
|
|
73
|
+
method: "POST",
|
|
74
|
+
body: payload,
|
|
75
|
+
}
|
|
76
|
+
);
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
function createMemberInvite(verificatonId: string) {
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
return useNuxtApp().$api<TMember>(
|
|
81
|
+
`/api/members/verification/${verificatonId}`,
|
|
82
|
+
{
|
|
83
|
+
method: "POST",
|
|
84
|
+
}
|
|
85
|
+
);
|
|
80
86
|
}
|
|
81
87
|
function updateMemberStatus(id: string, status: string) {
|
|
82
|
-
return
|
|
88
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
83
89
|
`/api/members/status/${status}/id/${id}`,
|
|
84
90
|
{
|
|
85
91
|
method: "PUT",
|
|
@@ -88,21 +94,27 @@ export default function useMember() {
|
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
function updateRoleById(id: string, role: string) {
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
98
|
+
`/api/members/role/id/${id}`,
|
|
99
|
+
{
|
|
100
|
+
method: "PATCH",
|
|
101
|
+
body: { role },
|
|
102
|
+
}
|
|
103
|
+
);
|
|
95
104
|
}
|
|
96
105
|
|
|
97
106
|
function updateStatusById(id: string, status: string) {
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
108
|
+
`/api/members/status/id/${id}`,
|
|
109
|
+
{
|
|
110
|
+
method: "PATCH",
|
|
111
|
+
body: { status },
|
|
112
|
+
}
|
|
113
|
+
);
|
|
102
114
|
}
|
|
103
115
|
|
|
104
116
|
function deleteById(id: string) {
|
|
105
|
-
return
|
|
117
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/members/id/${id}`, {
|
|
106
118
|
method: "DELETE",
|
|
107
119
|
});
|
|
108
120
|
}
|
package/composables/useOrder.ts
CHANGED
package/composables/useOrg.ts
CHANGED
|
@@ -4,14 +4,14 @@ export default function useOrg() {
|
|
|
4
4
|
seats: number;
|
|
5
5
|
}
|
|
6
6
|
) {
|
|
7
|
-
return
|
|
7
|
+
return useNuxtApp().$api<Record<string, any>>("/api/organizations", {
|
|
8
8
|
method: "POST",
|
|
9
9
|
body: value,
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function getAll({ page = 1, search = "", limit = 20, status = "" } = {}) {
|
|
14
|
-
return
|
|
14
|
+
return useNuxtApp().$api<Record<string, any>>("/api/organizations", {
|
|
15
15
|
method: "GET",
|
|
16
16
|
query: {
|
|
17
17
|
page,
|
|
@@ -23,27 +23,33 @@ export default function useOrg() {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function getById(id = "") {
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
27
|
+
`/api/organizations/id/${id}`,
|
|
28
|
+
{
|
|
29
|
+
method: "GET",
|
|
30
|
+
}
|
|
31
|
+
);
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
function getByUserId({ page = 1, search = "", user = "", limit = 20 } = {}) {
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
36
|
+
`/api/organizations/user/${user}`,
|
|
37
|
+
{
|
|
38
|
+
method: "GET",
|
|
39
|
+
query: {
|
|
40
|
+
page,
|
|
41
|
+
search,
|
|
42
|
+
limit,
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
);
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
function updateById(
|
|
43
49
|
id: string,
|
|
44
50
|
options: Pick<TOrg, "name" | "description" | "email" | "contact">
|
|
45
51
|
) {
|
|
46
|
-
return
|
|
52
|
+
return useNuxtApp().$api(`/api/organizations/id/${id}`, {
|
|
47
53
|
method: "PATCH",
|
|
48
54
|
body: options,
|
|
49
55
|
});
|
|
@@ -54,6 +60,7 @@ export default function useOrg() {
|
|
|
54
60
|
contact: "",
|
|
55
61
|
email: "",
|
|
56
62
|
createdBy: "",
|
|
63
|
+
promoCode: "",
|
|
57
64
|
});
|
|
58
65
|
|
|
59
66
|
return {
|
|
@@ -9,17 +9,20 @@ export default function usePaymentMethod() {
|
|
|
9
9
|
cancel_return_url = "",
|
|
10
10
|
category = "individual",
|
|
11
11
|
} = {}) {
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
13
|
+
"/api/payment-methods/e-wallet",
|
|
14
|
+
{
|
|
15
|
+
method: "POST",
|
|
16
|
+
body: {
|
|
17
|
+
customer_id,
|
|
18
|
+
type,
|
|
19
|
+
success_return_url,
|
|
20
|
+
failure_return_url,
|
|
21
|
+
cancel_return_url,
|
|
22
|
+
category,
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
);
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
function linkCard({
|
|
@@ -34,7 +37,7 @@ export default function usePaymentMethod() {
|
|
|
34
37
|
failure_return_url = "",
|
|
35
38
|
subscriptionData = {},
|
|
36
39
|
} = {}) {
|
|
37
|
-
return
|
|
40
|
+
return useNuxtApp().$api<Record<string, any>>("/api/payment-methods/card", {
|
|
38
41
|
method: "POST",
|
|
39
42
|
body: {
|
|
40
43
|
cardType,
|
|
@@ -52,7 +55,7 @@ export default function usePaymentMethod() {
|
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
function getByUser(user = "") {
|
|
55
|
-
return
|
|
58
|
+
return useNuxtApp().$api<Array<Record<string, any>>>(
|
|
56
59
|
`/api/payment-methods/user/${user}`,
|
|
57
60
|
{
|
|
58
61
|
method: "GET",
|
|
@@ -61,7 +64,7 @@ export default function usePaymentMethod() {
|
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
function getByOrg(org = "") {
|
|
64
|
-
return
|
|
67
|
+
return useNuxtApp().$api<Array<Record<string, any>>>(
|
|
65
68
|
`/api/payment-methods/org/${org}`,
|
|
66
69
|
{
|
|
67
70
|
method: "GET",
|
|
@@ -70,11 +73,15 @@ export default function usePaymentMethod() {
|
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
function getById(id = "") {
|
|
73
|
-
return
|
|
76
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
77
|
+
`/api/payment-methods/id/${id}`
|
|
78
|
+
);
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
function getByCustomerId(id = "") {
|
|
77
|
-
return
|
|
82
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
83
|
+
`/api/payment-methods/customer/${id}`
|
|
84
|
+
);
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
const eWalletNumber = useState("eWalletNumber", () => "");
|
|
@@ -87,10 +94,13 @@ export default function usePaymentMethod() {
|
|
|
87
94
|
const selectedPaymentMethod = useState("selectedPaymentMethod", () => "");
|
|
88
95
|
|
|
89
96
|
function linkOnly(value: Record<string, any>) {
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
98
|
+
"/api/payment-methods/link-only",
|
|
99
|
+
{
|
|
100
|
+
method: "POST",
|
|
101
|
+
body: value,
|
|
102
|
+
}
|
|
103
|
+
);
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
const supportedEwallets = [
|
|
@@ -298,10 +308,13 @@ export default function usePaymentMethod() {
|
|
|
298
308
|
}
|
|
299
309
|
|
|
300
310
|
function updateStatusById(id: string, status: string) {
|
|
301
|
-
return
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
311
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
312
|
+
`/api/payment-methods/status/${id}`,
|
|
313
|
+
{
|
|
314
|
+
method: "PATCH",
|
|
315
|
+
body: { status },
|
|
316
|
+
}
|
|
317
|
+
);
|
|
305
318
|
}
|
|
306
319
|
|
|
307
320
|
return {
|
|
@@ -56,7 +56,7 @@ export default function usePermission() {
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
function addPerm(value: TPerm) {
|
|
59
|
-
return
|
|
59
|
+
return useNuxtApp().$api("/api/permissions", {
|
|
60
60
|
method: "POST",
|
|
61
61
|
body: value,
|
|
62
62
|
});
|
|
@@ -66,7 +66,7 @@ export default function usePermission() {
|
|
|
66
66
|
id: string,
|
|
67
67
|
value: Pick<TPerm, "key" | "name" | "group" | "description">
|
|
68
68
|
) {
|
|
69
|
-
return
|
|
69
|
+
return useNuxtApp().$api(`/api/permissions/id/${id}`, {
|
|
70
70
|
method: "PATCH",
|
|
71
71
|
body: value,
|
|
72
72
|
});
|
|
@@ -79,14 +79,14 @@ export default function usePermission() {
|
|
|
79
79
|
app = "",
|
|
80
80
|
status = "active",
|
|
81
81
|
} = {}) {
|
|
82
|
-
return
|
|
82
|
+
return useNuxtApp().$api<Record<string, any>>("/api/permissions", {
|
|
83
83
|
method: "GET",
|
|
84
84
|
query: { page, limit, search, app, status },
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
function deletePermById(id: string) {
|
|
89
|
-
return
|
|
89
|
+
return useNuxtApp().$api(`/api/permissions/id/${id}`, {
|
|
90
90
|
method: "DELETE",
|
|
91
91
|
});
|
|
92
92
|
}
|
|
@@ -99,7 +99,7 @@ export default function usePermission() {
|
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
function addPermGroup(value: Pick<TPermGroup, "app" | "key" | "label">) {
|
|
102
|
-
return
|
|
102
|
+
return useNuxtApp().$api("/api/permissions/groups", {
|
|
103
103
|
method: "POST",
|
|
104
104
|
body: value,
|
|
105
105
|
});
|
|
@@ -109,7 +109,7 @@ export default function usePermission() {
|
|
|
109
109
|
id: string,
|
|
110
110
|
value: Pick<TPermGroup, "key" | "label">
|
|
111
111
|
) {
|
|
112
|
-
return
|
|
112
|
+
return useNuxtApp().$api(`/api/permissions/groups/id/${id}`, {
|
|
113
113
|
method: "PATCH",
|
|
114
114
|
body: value,
|
|
115
115
|
});
|
|
@@ -122,14 +122,14 @@ export default function usePermission() {
|
|
|
122
122
|
app = "",
|
|
123
123
|
status = "active",
|
|
124
124
|
} = {}) {
|
|
125
|
-
return
|
|
125
|
+
return useNuxtApp().$api<Record<string, any>>("/api/permissions/groups", {
|
|
126
126
|
method: "GET",
|
|
127
127
|
query: { page, limit, search, app, status },
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
function deletePermGroupById(id: string) {
|
|
132
|
-
return
|
|
132
|
+
return useNuxtApp().$api(`/api/permissions/groups/id/${id}`, {
|
|
133
133
|
method: "DELETE",
|
|
134
134
|
});
|
|
135
135
|
}
|
package/composables/usePlan.ts
CHANGED
package/composables/usePrice.ts
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export default function usePromo() {
|
|
2
|
+
const promo = ref<TPromo>({
|
|
3
|
+
_id: "",
|
|
4
|
+
code: "",
|
|
5
|
+
type: "fixed",
|
|
6
|
+
flatRate: 0,
|
|
7
|
+
fixedRate: 0,
|
|
8
|
+
tiers: [],
|
|
9
|
+
currency: "",
|
|
10
|
+
startDate: "",
|
|
11
|
+
endDate: "",
|
|
12
|
+
seats: 0,
|
|
13
|
+
usage: 0,
|
|
14
|
+
apps: [],
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
function add(value: TPromo) {
|
|
18
|
+
return useNuxtApp().$api<Record<string, any>>("/api/promos", {
|
|
19
|
+
method: "POST",
|
|
20
|
+
body: value,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function getAll({
|
|
25
|
+
page = 1,
|
|
26
|
+
limit = 10,
|
|
27
|
+
search = "",
|
|
28
|
+
status = "",
|
|
29
|
+
} = {}) {
|
|
30
|
+
return useNuxtApp().$api<Record<string, any>>("/api/promos", {
|
|
31
|
+
method: "GET",
|
|
32
|
+
query: { page, limit, search, status },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function getByCode(code: string) {
|
|
37
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/promos/code/${code}`, {
|
|
38
|
+
method: "GET",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function getById(id: string) {
|
|
43
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/promos/id/${id}`, {
|
|
44
|
+
method: "GET",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function updateById(
|
|
49
|
+
id: string,
|
|
50
|
+
value: Pick<
|
|
51
|
+
TPromo,
|
|
52
|
+
| "code"
|
|
53
|
+
| "apps"
|
|
54
|
+
| "type"
|
|
55
|
+
| "flatRate"
|
|
56
|
+
| "fixedRate"
|
|
57
|
+
| "tiers"
|
|
58
|
+
| "currency"
|
|
59
|
+
| "startDate"
|
|
60
|
+
| "endDate"
|
|
61
|
+
| "seats"
|
|
62
|
+
| "usage"
|
|
63
|
+
>
|
|
64
|
+
) {
|
|
65
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/promos/id/${id}`, {
|
|
66
|
+
method: "PATCH",
|
|
67
|
+
body: value,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function deleteById(id: string) {
|
|
72
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/promos/${id}`, {
|
|
73
|
+
method: "DELETE",
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return { promo, add, getAll, getByCode, getById, updateById, deleteById };
|
|
78
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export default function usePromoCode() {
|
|
2
2
|
function add(value: TPromoCode) {
|
|
3
|
-
return
|
|
3
|
+
return useNuxtApp().$api<Record<string, any>>("/api/promo-codes", {
|
|
4
4
|
method: "POST",
|
|
5
5
|
body: value,
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function getPromoCodes({ search = "", page = 1, status = "active" } = {}) {
|
|
10
|
-
return
|
|
10
|
+
return useNuxtApp().$api<Record<string, any>>("/api/promo-codes", {
|
|
11
11
|
method: "GET",
|
|
12
12
|
query: {
|
|
13
13
|
search,
|
|
@@ -18,7 +18,7 @@ export default function usePromoCode() {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function getByCode(code: string, type?: string, assigned?: boolean) {
|
|
21
|
-
return
|
|
21
|
+
return useNuxtApp().$api<TPromoCode>("/api/promo-codes/code", {
|
|
22
22
|
method: "GET",
|
|
23
23
|
params: {
|
|
24
24
|
code,
|
|
@@ -29,7 +29,7 @@ export default function usePromoCode() {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function getById(id: string) {
|
|
32
|
-
return
|
|
32
|
+
return useNuxtApp().$api<TPromoCode>(`/api/promo-codes/id/${id}`, {
|
|
33
33
|
method: "GET",
|
|
34
34
|
});
|
|
35
35
|
}
|
package/composables/useRole.ts
CHANGED
|
@@ -2,7 +2,7 @@ export default function useRole() {
|
|
|
2
2
|
function add(
|
|
3
3
|
value: Pick<TRole, "name" | "permissions" | "app" | "org" | "createdBy">
|
|
4
4
|
) {
|
|
5
|
-
return
|
|
5
|
+
return useNuxtApp().$api("/api/roles", {
|
|
6
6
|
method: "POST",
|
|
7
7
|
body: value,
|
|
8
8
|
});
|
|
@@ -15,41 +15,41 @@ export default function useRole() {
|
|
|
15
15
|
app = "",
|
|
16
16
|
org = "",
|
|
17
17
|
} = {}) {
|
|
18
|
-
return
|
|
18
|
+
return useNuxtApp().$api<Record<string, any>>("/api/roles", {
|
|
19
19
|
method: "GET",
|
|
20
20
|
query: { search, page, limit, app, org },
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function getById(id: string) {
|
|
25
|
-
return
|
|
25
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/roles/id/${id}`, {
|
|
26
26
|
method: "GET",
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function updateById(id: string, value: Pick<TRole, "name" | "permissions">) {
|
|
31
|
-
return
|
|
31
|
+
return useNuxtApp().$api(`/api/roles/id/${id}`, {
|
|
32
32
|
method: "PATCH",
|
|
33
33
|
body: value,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function updatePermissionById(_id: string, permissions?: Array<string>) {
|
|
38
|
-
return
|
|
38
|
+
return useNuxtApp().$api(`/api/roles/permissions/id/${_id}`, {
|
|
39
39
|
method: "PATCH",
|
|
40
40
|
body: { permissions },
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function updateRoleFieldById(_id: string, field: string, value: string) {
|
|
45
|
-
return
|
|
45
|
+
return useNuxtApp().$api(`/api/roles/${_id}`, {
|
|
46
46
|
method: "PATCH",
|
|
47
47
|
body: { field, value },
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function deleteById(_id: string) {
|
|
52
|
-
return
|
|
52
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/roles/${_id}`, {
|
|
53
53
|
method: "DELETE",
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -10,16 +10,19 @@ export default function useSubscription() {
|
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
function getByOrg(org = "") {
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
14
|
+
`/api/subscriptions/org/${org}`,
|
|
15
|
+
{
|
|
16
|
+
method: "GET",
|
|
17
|
+
}
|
|
18
|
+
);
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
function getTransactionsById(
|
|
19
22
|
id = "",
|
|
20
23
|
options: { page?: number; limit?: number } = {}
|
|
21
24
|
) {
|
|
22
|
-
return
|
|
25
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
23
26
|
`/api/subscriptions/id/${id}/transactions`,
|
|
24
27
|
{
|
|
25
28
|
method: "GET",
|
|
@@ -32,18 +35,34 @@ export default function useSubscription() {
|
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
function updateSeatById({ id = "", seats = 0, amount = 0, user = "" } = {}) {
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
39
|
+
`/api/subscriptions/id/${id}/seats`,
|
|
40
|
+
{
|
|
41
|
+
method: "PATCH",
|
|
42
|
+
body: {
|
|
43
|
+
seats,
|
|
44
|
+
amount,
|
|
45
|
+
user,
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function getAll({ page = 1, limit = 20, search = "", status = "" } = {}) {
|
|
52
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/subscriptions`, {
|
|
53
|
+
method: "GET",
|
|
54
|
+
query: {
|
|
55
|
+
page,
|
|
56
|
+
limit,
|
|
57
|
+
search,
|
|
58
|
+
status,
|
|
41
59
|
},
|
|
42
60
|
});
|
|
43
61
|
}
|
|
44
62
|
|
|
45
63
|
return {
|
|
46
64
|
subscription,
|
|
65
|
+
getAll,
|
|
47
66
|
getByOrg,
|
|
48
67
|
getTransactionsById,
|
|
49
68
|
updateSeatById,
|