add archive featcher to role , brtanch , car_mainte also update client and clien_addres create car mainte fails and update car fails delete car_maint from saidbar and but it in car model also update car image display

This commit is contained in:
m7amedez1122
2026-07-06 17:41:12 +03:00
parent 25f3468d74
commit a7e53f2047
56 changed files with 3864 additions and 147 deletions

View File

@@ -0,0 +1,34 @@
import { get } from "../api";
import type {
ArchivedClientListResponse,
ArchivedClientResponse,
ArchivedClientOrdersResponse,
} from "@/src/types/client";
/** Building a query string to fetch archived clients with pagination */
function buildArchivedQuery(page: number, search: string): string {
return `?page=${page}&limit=10${search ? `&search=${encodeURIComponent(search)}` : ""}`;
}
export const archivedClientService = {
/** Fetching the archived client list, paginated */
getAll: (page: number, search: string, token: string | null) =>
get<ArchivedClientListResponse>(
`client/archived${buildArchivedQuery(page, search)}`,
token,
),
/** Get a single archived client by id (includes addresses) */
getById: (id: string, token: string | null) =>
get<ArchivedClientResponse>(`client/archived/${id}`, token),
/** Get soft-deleted orders belonging to a specific client */
getArchivedOrders: (clientId: string, page: number, token: string | null) =>
get<ArchivedClientOrdersResponse>(
`client/${clientId}/orders/archived?page=${page}&limit=10`,
token,
),
// NOTE: delete/restore intentionally left out for now — mirrors
// archivedUser.service.ts, see ticket follow-up.
};