Files
lcbp3/frontend/lib/api/drawings.ts
T
admin 7a9a15560b
CI / CD Pipeline / build (push) Successful in 8m10s
CI / CD Pipeline / deploy (push) Successful in 4m26s
690328:1703 Fixing Refactor uuid by Kimi #11
2026-03-28 17:03:12 +07:00

44 lines
1.4 KiB
TypeScript

import { Drawing } from '@/types/drawing';
// Mock Data
const mockDrawings: Drawing[] = [
{
publicId: 'dwg-001',
drawingNumber: 'S-201-A',
title: 'Structural Foundation Plan',
discipline: 'Structural',
status: 'APPROVED',
revision: 'A',
createdAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 5).toISOString(),
updatedAt: new Date(Date.now() - 1000 * 60 * 60 * 24).toISOString(),
},
{
publicId: 'dwg-002',
drawingNumber: 'A-101-B',
title: 'Architectural Floor Plan - Level 1',
discipline: 'Architectural',
status: 'IN_REVIEW',
revision: 'B',
createdAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 3).toISOString(),
updatedAt: new Date(Date.now() - 1000 * 60 * 60 * 2).toISOString(),
},
];
export const drawingApi = {
getAll: async (): Promise<{ data: Drawing[]; meta: { total: number } }> => {
await new Promise((resolve) => setTimeout(resolve, 500));
return { data: mockDrawings, meta: { total: mockDrawings.length } };
},
getById: async (_id: string): Promise<Drawing | undefined> => {
await new Promise((resolve) => setTimeout(resolve, 300));
return mockDrawings.find((d) => d.publicId === _id);
},
getByContract: async (_contractId: string): Promise<{ data: Drawing[] }> => {
await new Promise((resolve) => setTimeout(resolve, 400));
// Mock: return all drawings for any contract
return { data: mockDrawings };
},
};