@goweekdays/layer-common 1.5.0 → 1.5.2
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/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 +227 -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 +20 -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 +6 -6
- package/composables/usePromoCode.ts +4 -4
- package/composables/useRole.ts +7 -7
- package/composables/useSubscription.ts +19 -13
- package/composables/useUser.ts +11 -11
- package/composables/useUtils.ts +1 -1
- package/composables/useVerification.ts +22 -13
- package/nuxt.config.ts +1 -0
- package/package.json +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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @goweekdays/layer-common
|
|
2
2
|
|
|
3
|
+
## 1.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c94cd5f: Add job post filters and supporting API methods
|
|
8
|
+
|
|
9
|
+
## 1.5.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4390428: Add default props for VCombobox in Vuetify plugin
|
|
14
|
+
- 0304ef9: Refactor API calls to use $api from Nuxt plugin
|
|
15
|
+
|
|
3
16
|
## 1.5.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -13,7 +13,7 @@ export default function useAddress() {
|
|
|
13
13
|
postalCode = "",
|
|
14
14
|
taxId = "",
|
|
15
15
|
} = {}) {
|
|
16
|
-
return
|
|
16
|
+
return useNuxtApp().$api("/api/addresses", {
|
|
17
17
|
method: "POST",
|
|
18
18
|
body: {
|
|
19
19
|
type,
|
|
@@ -57,18 +57,18 @@ export default function useAddress() {
|
|
|
57
57
|
payload.org = orgId;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
return
|
|
60
|
+
return useNuxtApp().$api(`/api/addresses/details/${id}`, {
|
|
61
61
|
method: "PUT",
|
|
62
62
|
body: payload,
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function getByUserId(user = "") {
|
|
67
|
-
return
|
|
67
|
+
return useNuxtApp().$api<TAddress>(`/api/addresses/user/${user}`);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function getByOrgId(id = "") {
|
|
71
|
-
return
|
|
71
|
+
return useNuxtApp().$api<TAddress>(`/api/addresses/org/${id}`);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
const _address = useState("address", (): TAddress => {
|
package/composables/useApps.ts
CHANGED
|
@@ -13,7 +13,7 @@ export default function useApps() {
|
|
|
13
13
|
const resource = "/api/apps";
|
|
14
14
|
|
|
15
15
|
function add(value: TApp) {
|
|
16
|
-
return
|
|
16
|
+
return useNuxtApp().$api(resource, {
|
|
17
17
|
method: "POST",
|
|
18
18
|
body: value,
|
|
19
19
|
});
|
|
@@ -26,7 +26,7 @@ export default function useApps() {
|
|
|
26
26
|
status = "active",
|
|
27
27
|
type = "standard",
|
|
28
28
|
} = {}) {
|
|
29
|
-
return
|
|
29
|
+
return useNuxtApp().$api<Record<string, any>>(resource, {
|
|
30
30
|
method: "GET",
|
|
31
31
|
query: { page, limit, search, status, type },
|
|
32
32
|
});
|
|
@@ -36,14 +36,14 @@ export default function useApps() {
|
|
|
36
36
|
id: string,
|
|
37
37
|
value: { name: string; description: string }
|
|
38
38
|
) {
|
|
39
|
-
return
|
|
39
|
+
return useNuxtApp().$api(`${resource}/id/${id}`, {
|
|
40
40
|
method: "PATCH",
|
|
41
41
|
body: value,
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function deleteById(id: string) {
|
|
46
|
-
return
|
|
46
|
+
return useNuxtApp().$api(`${resource}/id/${id}`, {
|
|
47
47
|
method: "DELETE",
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -7,7 +7,7 @@ export default function useChartOfAccount() {
|
|
|
7
7
|
children?: number;
|
|
8
8
|
}
|
|
9
9
|
) {
|
|
10
|
-
return
|
|
10
|
+
return useNuxtApp().$api<Record<string, any>>("/api/chart-of-accounts", {
|
|
11
11
|
method: "GET",
|
|
12
12
|
query: { page, status, orgId, children },
|
|
13
13
|
});
|
|
@@ -23,30 +23,35 @@ export default function useChartOfAccount() {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
function add(value: TAddPayload) {
|
|
26
|
-
return
|
|
26
|
+
return useNuxtApp().$api<TAddPayload>("/api/chart-of-accounts", {
|
|
27
27
|
method: "POST",
|
|
28
28
|
body: value,
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function getById(id: string) {
|
|
33
|
-
return
|
|
33
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
34
|
+
`/api/chart-of-accounts/id/${id}`
|
|
35
|
+
);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
function updateById(
|
|
37
39
|
id: string,
|
|
38
40
|
value: Pick<TAddPayload, "name" | "code" | "normalBalance" | "parent">
|
|
39
41
|
) {
|
|
40
|
-
return
|
|
42
|
+
return useNuxtApp().$api<TAddPayload>(`/api/chart-of-accounts/id/${id}`, {
|
|
41
43
|
method: "PUT",
|
|
42
44
|
body: value,
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
function deleteById(id: string) {
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
50
|
+
`/api/chart-of-accounts/id/${id}`,
|
|
51
|
+
{
|
|
52
|
+
method: "DELETE",
|
|
53
|
+
}
|
|
54
|
+
);
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
return {
|
package/composables/useFile.ts
CHANGED
|
@@ -7,16 +7,19 @@ export default function useFile() {
|
|
|
7
7
|
const formData = new FormData();
|
|
8
8
|
formData.append("file", file);
|
|
9
9
|
|
|
10
|
-
return
|
|
10
|
+
return useNuxtApp().$api<Record<string, any>>("/api/files", {
|
|
11
11
|
method: "POST",
|
|
12
12
|
body: formData,
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function deleteFile(attachmentId: string) {
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
18
|
+
`/api/files/${attachmentId}`,
|
|
19
|
+
{
|
|
20
|
+
method: "DELETE",
|
|
21
|
+
}
|
|
22
|
+
);
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
return {
|
|
@@ -4,23 +4,29 @@ export default function useInvoice() {
|
|
|
4
4
|
throw new Error("Subscription ID is required");
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
8
|
+
`/api/invoices/subscription/${id}`,
|
|
9
|
+
{
|
|
10
|
+
method: "GET",
|
|
11
|
+
params: {
|
|
12
|
+
search,
|
|
13
|
+
page,
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
);
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
function getByNumber(number: string) {
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
21
|
+
`/api/invoices/number/${number}`,
|
|
22
|
+
{
|
|
23
|
+
method: "GET",
|
|
24
|
+
}
|
|
25
|
+
);
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
function getByDueDateStatus(date: string, status: string) {
|
|
23
|
-
return
|
|
29
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
24
30
|
`/api/invoices/due-date/${date}/status/${status}`,
|
|
25
31
|
{
|
|
26
32
|
method: "GET",
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
export function useJobPost() {
|
|
2
|
+
const jobPost = ref<TJobPost>({
|
|
3
|
+
title: "",
|
|
4
|
+
org: "",
|
|
5
|
+
setup: "",
|
|
6
|
+
location: "",
|
|
7
|
+
type: "",
|
|
8
|
+
description: "",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
function getAll({ page = 1, limit = 50, search = "" } = {}) {
|
|
12
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/job/posts`, {
|
|
13
|
+
method: "GET",
|
|
14
|
+
query: {
|
|
15
|
+
page,
|
|
16
|
+
limit,
|
|
17
|
+
search,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getJobPostsByOrg(
|
|
23
|
+
id: any,
|
|
24
|
+
{ page = 1, search = "", status = "draft", limit = 10, org = "" } = {}
|
|
25
|
+
) {
|
|
26
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/job/posts/org/${id}`, {
|
|
27
|
+
method: "GET",
|
|
28
|
+
query: {
|
|
29
|
+
page,
|
|
30
|
+
search,
|
|
31
|
+
limit,
|
|
32
|
+
status,
|
|
33
|
+
org,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getJobPostsById(id: any) {
|
|
39
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/job/posts/id/${id}`, {
|
|
40
|
+
method: "GET",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function deleteJobPostById(id: any) {
|
|
45
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/job/posts/id/${id}`, {
|
|
46
|
+
method: "DELETE",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function updateJobPostStatusById(id: any, status: any) {
|
|
51
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
52
|
+
`/api/job/posts/id/${id}/status/${status}`,
|
|
53
|
+
{
|
|
54
|
+
method: "PATCH",
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getLocations({ page = 1, limit = 10, search = "" } = {}) {
|
|
60
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/job/posts/locations`, {
|
|
61
|
+
method: "GET",
|
|
62
|
+
query: {
|
|
63
|
+
page,
|
|
64
|
+
limit,
|
|
65
|
+
search,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function getJobTitles({ page = 1, limit = 10, search = "" } = {}) {
|
|
71
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/job/posts/titles`, {
|
|
72
|
+
method: "GET",
|
|
73
|
+
query: {
|
|
74
|
+
page,
|
|
75
|
+
limit,
|
|
76
|
+
search,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function getCurrencies({ page = 1, limit = 10, search = "" } = {}) {
|
|
82
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/job/posts/currencies`, {
|
|
83
|
+
method: "GET",
|
|
84
|
+
query: {
|
|
85
|
+
page,
|
|
86
|
+
limit,
|
|
87
|
+
search,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const workplaceTypes = [
|
|
93
|
+
{ title: "On-site", value: "onsite" },
|
|
94
|
+
{ title: "Remote", value: "remote" },
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
const jobTypes = [
|
|
98
|
+
{ title: "Full-time", value: "full-time" },
|
|
99
|
+
{ title: "Part-time", value: "part-time" },
|
|
100
|
+
{ title: "Internship - Education/OJT", value: "internship-education" },
|
|
101
|
+
{ title: "Internship - Career", value: "internship-career" },
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
const defaultCurrencies = [
|
|
105
|
+
{
|
|
106
|
+
title: "PHP",
|
|
107
|
+
value: "PHP",
|
|
108
|
+
prop: {
|
|
109
|
+
subtitle: "Philippines Peso",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
title: "USD",
|
|
114
|
+
value: "USD",
|
|
115
|
+
prop: {
|
|
116
|
+
subtitle: "United States Dollar",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
title: "EUR",
|
|
121
|
+
value: "EUR",
|
|
122
|
+
prop: {
|
|
123
|
+
subtitle: "Euro",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
title: "GBP",
|
|
128
|
+
value: "GBP",
|
|
129
|
+
prop: {
|
|
130
|
+
subtitle: "British Pound Sterling",
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
title: "JPY",
|
|
135
|
+
value: "JPY",
|
|
136
|
+
prop: {
|
|
137
|
+
subtitle: "Japanese Yen",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
title: "AUD",
|
|
142
|
+
value: "AUD",
|
|
143
|
+
prop: {
|
|
144
|
+
subtitle: "Australian Dollar",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
title: "CAD",
|
|
149
|
+
value: "CAD",
|
|
150
|
+
prop: {
|
|
151
|
+
subtitle: "Canadian Dollar",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
title: "CHF",
|
|
156
|
+
value: "CHF",
|
|
157
|
+
prop: {
|
|
158
|
+
subtitle: "Swiss Franc",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
title: "CNY",
|
|
163
|
+
value: "CNY",
|
|
164
|
+
prop: {
|
|
165
|
+
subtitle: "Chinese Yuan",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
title: "INR",
|
|
170
|
+
value: "INR",
|
|
171
|
+
prop: {
|
|
172
|
+
subtitle: "Indian Rupee",
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
const payPeriodOptions = [
|
|
178
|
+
{ title: "Hourly", value: "hourly" },
|
|
179
|
+
{ title: "Weekly", value: "weekly" },
|
|
180
|
+
{ title: "Bi-Monthly", value: "bi-monthly" },
|
|
181
|
+
{ title: "Monthly", value: "monthly" },
|
|
182
|
+
{ title: "Annually", value: "annually" },
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
const searchFilterJobTitle = useState<string>(
|
|
186
|
+
"searchFilterJobTitle",
|
|
187
|
+
() => ""
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
const searchFilterWorkType = useState<string>(
|
|
191
|
+
"searchFilterWorkType",
|
|
192
|
+
() => ""
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const searchFilterJobType = useState<string>("searchFilterJobType", () => "");
|
|
196
|
+
|
|
197
|
+
const searchFilterLocation = useState<string>(
|
|
198
|
+
"searchFilterLocation",
|
|
199
|
+
() => ""
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
const searchFilterCurrency = useState<string>(
|
|
203
|
+
"searchFilterCurrency",
|
|
204
|
+
() => ""
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
jobPost,
|
|
209
|
+
workplaceTypes,
|
|
210
|
+
jobTypes,
|
|
211
|
+
defaultCurrencies,
|
|
212
|
+
payPeriodOptions,
|
|
213
|
+
searchFilterJobTitle,
|
|
214
|
+
searchFilterWorkType,
|
|
215
|
+
searchFilterJobType,
|
|
216
|
+
searchFilterLocation,
|
|
217
|
+
searchFilterCurrency,
|
|
218
|
+
getAll,
|
|
219
|
+
getLocations,
|
|
220
|
+
getJobTitles,
|
|
221
|
+
getCurrencies,
|
|
222
|
+
getJobPostsByOrg,
|
|
223
|
+
getJobPostsById,
|
|
224
|
+
deleteJobPostById,
|
|
225
|
+
updateJobPostStatusById,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default function useLedgerBilling() {
|
|
2
2
|
function getAll({ org = "", search = "", page = 1, status = "" } = {}) {
|
|
3
|
-
return
|
|
3
|
+
return useNuxtApp().$api<Record<string, any>>("/api/ledger/billings", {
|
|
4
4
|
method: "GET",
|
|
5
5
|
query: {
|
|
6
6
|
org,
|
|
@@ -12,13 +12,16 @@ export default function useLedgerBilling() {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function getById(id = "") {
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
16
|
+
`/api/ledger/billings/id/${id}`,
|
|
17
|
+
{
|
|
18
|
+
method: "GET",
|
|
19
|
+
}
|
|
20
|
+
);
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
function getSummary(org = "", status = "") {
|
|
21
|
-
return
|
|
24
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
22
25
|
`/api/ledger/billings/summary/org/${org}/status/${status}`,
|
|
23
26
|
{
|
|
24
27
|
method: "GET",
|
|
@@ -13,7 +13,7 @@ export default function useLocalAuth() {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
async function login({ email = "", password = "", role = "" }) {
|
|
16
|
-
return
|
|
16
|
+
return useNuxtApp().$api<Record<string, any>>("/api/auth/login", {
|
|
17
17
|
method: "POST",
|
|
18
18
|
body: JSON.stringify({ email, password, role }),
|
|
19
19
|
});
|
|
@@ -29,7 +29,7 @@ export default function useLocalAuth() {
|
|
|
29
29
|
const user = useCookie("user", cookieConfig).value;
|
|
30
30
|
if (!user) return null;
|
|
31
31
|
try {
|
|
32
|
-
const _user = await
|
|
32
|
+
const _user = await useNuxtApp().$api<TUser>(`/api/users/id/${user}`, {
|
|
33
33
|
method: "GET",
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -41,14 +41,17 @@ export default function useLocalAuth() {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
async function forgotPassword(email: string) {
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
45
|
+
"/api/verifications/forget-password",
|
|
46
|
+
{
|
|
47
|
+
method: "POST",
|
|
48
|
+
body: JSON.stringify({ email }),
|
|
49
|
+
}
|
|
50
|
+
);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
function verify(id: string) {
|
|
51
|
-
return
|
|
54
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/auth/verify/${id}`, {
|
|
52
55
|
method: "GET",
|
|
53
56
|
});
|
|
54
57
|
}
|
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
|
});
|