chore: add input parrain and reset point and add amende for admin
This commit is contained in:
@@ -475,6 +475,21 @@ export const deleteClientAdmin = async (clientId: number) => {
|
||||
// PARRAINAGE ADMIN
|
||||
// ============================================
|
||||
|
||||
export const setClientParrain = async (
|
||||
username: string,
|
||||
parrain: string,
|
||||
): Promise<{ success: boolean; error?: string }> => {
|
||||
try {
|
||||
await apiClient.post(
|
||||
`${V2}/admin/protected/client/${username}/parrain/set`,
|
||||
{ parrain },
|
||||
);
|
||||
return { success: true };
|
||||
} catch (e: any) {
|
||||
return { success: false, error: e.response?.data?.error || "Erreur" };
|
||||
}
|
||||
};
|
||||
|
||||
export const creditClientReferral = async (
|
||||
username: string,
|
||||
amount: number,
|
||||
@@ -541,6 +556,73 @@ export const getClientCancelledOrders = async (
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// AMENDES & POINTS CLIENT (Admin)
|
||||
// ============================================
|
||||
|
||||
export const applyClientPenalty = async (
|
||||
username: string,
|
||||
points: number,
|
||||
reason: string,
|
||||
): Promise<{ success: boolean; error?: string }> => {
|
||||
try {
|
||||
await apiClient.post(`${V2}/admin/protected/penalty`, {
|
||||
username,
|
||||
points,
|
||||
reason,
|
||||
});
|
||||
return { success: true };
|
||||
} catch (e: any) {
|
||||
return { success: false, error: e.response?.data?.error || "Erreur" };
|
||||
}
|
||||
};
|
||||
|
||||
export const resetClientPenalties = async (
|
||||
username: string,
|
||||
resetCancellationsCount = false,
|
||||
): Promise<{ success: boolean; error?: string }> => {
|
||||
try {
|
||||
await apiClient.post(
|
||||
`${V2}/admin/protected/client/${username}/penalties/reset`,
|
||||
{ reset_cancellations_count: resetCancellationsCount },
|
||||
);
|
||||
return { success: true };
|
||||
} catch (e: any) {
|
||||
return { success: false, error: e.response?.data?.error || "Erreur" };
|
||||
}
|
||||
};
|
||||
|
||||
export const resetClientPoints = async (
|
||||
username: string,
|
||||
pool = -1,
|
||||
): Promise<{ success: boolean; error?: string }> => {
|
||||
try {
|
||||
await apiClient.post(
|
||||
`${V2}/admin/protected/client/${username}/point/reset`,
|
||||
{ pool },
|
||||
);
|
||||
return { success: true };
|
||||
} catch (e: any) {
|
||||
return { success: false, error: e.response?.data?.error || "Erreur" };
|
||||
}
|
||||
};
|
||||
|
||||
export const addClientPoints = async (
|
||||
username: string,
|
||||
poolKey: string,
|
||||
points: number,
|
||||
): Promise<{ success: boolean; error?: string }> => {
|
||||
try {
|
||||
await apiClient.post(
|
||||
`${V2}/admin/protected/client/${username}/points/add`,
|
||||
{ pool_key: poolKey, points },
|
||||
);
|
||||
return { success: true };
|
||||
} catch (e: any) {
|
||||
return { success: false, error: e.response?.data?.error || "Erreur" };
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// ALERTES
|
||||
// ============================================
|
||||
|
||||
Reference in New Issue
Block a user