feat: StorageService S3/MinIO, POST /users, invoice upload, portal dashboard §08 statuses + notifications
This commit is contained in:
@@ -116,10 +116,22 @@ export const api = {
|
||||
create: (body: any) => request<any>("/pre-alerts", { method: "POST", body: JSON.stringify(body) }),
|
||||
delete: (id: string) => request<any>(`/pre-alerts/${id}`, { method: "DELETE" }),
|
||||
updateStatus: (id: string, body: any) => request<any>(`/pre-alerts/${id}/status`, { method: "PATCH", body: JSON.stringify(body) }),
|
||||
uploadInvoice: (id: string, file: File) => {
|
||||
const token = getToken();
|
||||
const fd = new FormData();
|
||||
fd.append("invoice", file);
|
||||
return fetch(`${API_BASE}/pre-alerts/${id}/invoice`, {
|
||||
method: "POST",
|
||||
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
||||
body: fd,
|
||||
}).then(r => { if (!r.ok) throw new Error("Upload failed"); return r.json(); });
|
||||
},
|
||||
},
|
||||
users: {
|
||||
list: (search?: string) => request<any[]>("/users" + (search ? `?search=${search}` : "")),
|
||||
get: (id: string) => request<any>(`/users/${id}`),
|
||||
create: (body: { email: string; password: string; firstName: string; lastName: string; phone?: string; role: string }) =>
|
||||
request<any>("/users", { method: "POST", body: JSON.stringify(body) }),
|
||||
updateRole: (id: string, role: string) => request<any>(`/users/${id}/role`, { method: "PATCH", body: JSON.stringify({ role }) }),
|
||||
setActive: (id: string, isActive: boolean) => request<any>(`/users/${id}/active`, { method: "PATCH", body: JSON.stringify({ isActive }) }),
|
||||
},
|
||||
@@ -165,6 +177,9 @@ export const api = {
|
||||
update: (id: string, body: { body: string; subject?: string; isActive?: boolean }) =>
|
||||
request<any>(`/notification-templates/${id}`, { method: "PUT", body: JSON.stringify(body) }),
|
||||
},
|
||||
notifications: {
|
||||
list: (limit = 20) => request<any[]>(`/notifications?limit=${limit}`),
|
||||
},
|
||||
payments: {
|
||||
list: (status?: string) => request<any[]>(`/payments${status ? `?status=${status}` : ""}`),
|
||||
packageDetail: (packageId: string) => request<any>(`/payments/package/${packageId}`),
|
||||
|
||||
Reference in New Issue
Block a user