feat(admin): add draw management features including create, update, delete, and batch delete functionalities
- Implemented API functions for creating, updating, and deleting draws. - Enhanced the admin draws console with UI components for managing draws. - Added internationalization support for new draw management actions and messages.
This commit is contained in:
@@ -12,6 +12,8 @@ import type {
|
||||
AdminDrawPublishResponse,
|
||||
AdminDrawPlanGenerateResponse,
|
||||
AdminDrawShowData,
|
||||
AdminDrawCreatePayload,
|
||||
AdminDrawCreateResponse,
|
||||
} from "@/types/api/admin-draws";
|
||||
|
||||
const A = `${API_V1_PREFIX}/admin`;
|
||||
@@ -56,6 +58,32 @@ export async function postAdminGenerateDrawPlan(): Promise<AdminDrawPlanGenerate
|
||||
return adminRequest.post<AdminDrawPlanGenerateResponse>(`${A}/draws/generate-plan`);
|
||||
}
|
||||
|
||||
export async function postAdminCreateDraw(
|
||||
payload: AdminDrawCreatePayload,
|
||||
): Promise<AdminDrawCreateResponse> {
|
||||
return adminRequest.post<AdminDrawCreateResponse>(`${A}/draws`, payload);
|
||||
}
|
||||
|
||||
export async function putAdminUpdateDraw(
|
||||
drawId: number,
|
||||
payload: AdminDrawCreatePayload,
|
||||
): Promise<AdminDrawCreateResponse> {
|
||||
return adminRequest.put<AdminDrawCreateResponse>(`${A}/draws/${drawId}`, payload);
|
||||
}
|
||||
|
||||
export async function deleteAdminDraw(drawId: number): Promise<{ deleted: boolean }> {
|
||||
return adminRequest.delete<{ deleted: boolean }>(`${A}/draws/${drawId}`);
|
||||
}
|
||||
|
||||
export async function postAdminBatchDestroyDraws(
|
||||
drawIds: number[],
|
||||
): Promise<{ success: number[]; failed: Array<{ id: number; reason: string }> }> {
|
||||
return adminRequest.post<{ success: number[]; failed: Array<{ id: number; reason: string }> }>(
|
||||
`${A}/draws/batch-destroy`,
|
||||
{ draw_ids: drawIds },
|
||||
);
|
||||
}
|
||||
|
||||
export async function postAdminManualCloseDraw(drawId: number): Promise<AdminDrawActionResponse> {
|
||||
return adminRequest.post<AdminDrawActionResponse>(`${A}/draws/${drawId}/manual-close`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user