Files
vexplor_dev/frontend/lib/api/itemInspection.ts

62 lines
1.7 KiB
TypeScript
Raw Normal View History

/**
* API
* -
*/
import { apiClient } from "./client";
export interface InspectionRowApi {
id: string;
item_code: string;
item_name: string;
inspection_type: string | null;
inspection_standard: string | null;
inspection_standard_id: string | null;
inspection_item_name: string | null;
inspection_method: string | null;
apply_process: string | null;
classification: string | null;
pass_criteria: string | null;
is_required: string | null;
is_active: string | null;
manager_id: string | null;
memo: string | null;
sort_order: string | null;
change_record?: string | null;
created_date?: string | null;
updated_date?: string | null;
// 프론트가 추가로 참조하는 필드(있을 수도, 없을 수도)
[key: string]: any;
}
export interface InspectionGroupApi {
item_code: string;
item_name: string;
is_active: string;
rows: InspectionRowApi[];
}
export interface InspectionGroupedResponse {
success: boolean;
groups: InspectionGroupApi[];
total: number;
page: number;
size: number;
totalPages: number;
message?: string;
}
export async function getInspectionGrouped(params: {
page?: number;
size?: number;
search?: string;
}): Promise<InspectionGroupedResponse> {
const qp = new URLSearchParams();
if (params.page) qp.set("page", String(params.page));
if (params.size) qp.set("size", String(params.size));
if (params.search && params.search.trim()) qp.set("search", params.search.trim());
const qs = qp.toString();
const res = await apiClient.get(`/item-inspection/grouped${qs ? `?${qs}` : ""}`);
return res.data;
}