feature: a minimal implementation of staff management is done.

This commit is contained in:
2026-04-30 00:52:05 +03:30
parent d19da80d8e
commit c39bd872bd
26 changed files with 1361 additions and 26 deletions

View File

@@ -0,0 +1,63 @@
import { apiClient } from './client';
export interface StaffMemberDto {
id: string;
userId: string;
email: string;
name: string;
isOwner: boolean;
permissions: string[] | null;
}
export interface StaffListResponse {
success: boolean;
data: {
members: StaffMemberDto[];
seats: {
used: number;
limit: number | null;
unlimited: boolean;
};
};
}
export interface InviteStaffResponse {
success: boolean;
data: {
membershipId: string;
userId: string;
email: string;
temporaryPassword: string | null;
};
}
export const staffApi = {
list: async (): Promise<StaffListResponse> => {
const response = await apiClient.get('/staff');
return response.data;
},
invite: async (body: {
email: string;
name: string;
permissionNames: string[];
}): Promise<InviteStaffResponse> => {
const response = await apiClient.post('/staff/invite', body);
return response.data;
},
updateMember: async (
membershipId: string,
body: { name?: string; permissionNames?: string[] },
): Promise<{ success: boolean; message: string }> => {
const response = await apiClient.patch(`/staff/members/${membershipId}`, body);
return response.data;
},
removeMember: async (
membershipId: string,
): Promise<{ success: boolean; message: string }> => {
const response = await apiClient.delete(`/staff/members/${membershipId}`);
return response.data;
},
};