+ {/* ADR-019: Project & Recipient Organization selectors */}
+
+ (
+
+ Project
+
+
+
+ )}
+ />
+
+ (
+
+ Recipient Organization
+
+
+
+ )}
+ />
+
+
{/* Linked Correspondence (Ref No) */}
{
const item = row.original;
return (
-
+
diff --git a/frontend/hooks/use-rfa.ts b/frontend/hooks/use-rfa.ts
index 74fd703..5244d87 100644
--- a/frontend/hooks/use-rfa.ts
+++ b/frontend/hooks/use-rfa.ts
@@ -11,7 +11,7 @@ export const rfaKeys = {
lists: () => [...rfaKeys.all, 'list'] as const,
list: (params: SearchRfaDto) => [...rfaKeys.lists(), params] as const,
details: () => [...rfaKeys.all, 'detail'] as const,
- detail: (id: number | string) => [...rfaKeys.details(), id] as const,
+ detail: (uuid: string) => [...rfaKeys.details(), uuid] as const,
};
// --- Queries ---
@@ -24,11 +24,11 @@ export function useRFAs(params: SearchRfaDto) {
});
}
-export function useRFA(id: number | string) {
+export function useRFA(uuid: string) {
return useQuery({
- queryKey: rfaKeys.detail(id),
- queryFn: () => rfaService.getById(id),
- enabled: !!id,
+ queryKey: rfaKeys.detail(uuid),
+ queryFn: () => rfaService.getByUuid(uuid),
+ enabled: !!uuid,
});
}
@@ -55,11 +55,11 @@ export function useUpdateRFA() {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: ({ id, data }: { id: number | string; data: UpdateRfaDto }) =>
- rfaService.update(id, data),
- onSuccess: (_, { id }) => {
+ mutationFn: ({ uuid, data }: { uuid: string; data: UpdateRfaDto }) =>
+ rfaService.update(uuid, data),
+ onSuccess: (_, { uuid }) => {
toast.success('RFA updated successfully');
- queryClient.invalidateQueries({ queryKey: rfaKeys.detail(id) });
+ queryClient.invalidateQueries({ queryKey: rfaKeys.detail(uuid) });
queryClient.invalidateQueries({ queryKey: rfaKeys.lists() });
},
onError: (error: unknown) => {
@@ -74,11 +74,11 @@ export function useProcessRFA() {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: ({ id, data }: { id: number | string; data: WorkflowActionDto }) =>
- rfaService.processWorkflow(id, data),
- onSuccess: (_, { id }) => {
+ mutationFn: ({ uuid, data }: { uuid: string; data: WorkflowActionDto }) =>
+ rfaService.processWorkflow(uuid, data),
+ onSuccess: (_, { uuid }) => {
toast.success('Workflow status updated successfully');
- queryClient.invalidateQueries({ queryKey: rfaKeys.detail(id) });
+ queryClient.invalidateQueries({ queryKey: rfaKeys.detail(uuid) });
queryClient.invalidateQueries({ queryKey: rfaKeys.lists() });
},
onError: (error: unknown) => {
diff --git a/frontend/lib/services/rfa.service.ts b/frontend/lib/services/rfa.service.ts
index 6be56fd..d075ed5 100644
--- a/frontend/lib/services/rfa.service.ts
+++ b/frontend/lib/services/rfa.service.ts
@@ -1,9 +1,9 @@
// File: lib/services/rfa.service.ts
import apiClient from "@/lib/api/client";
-import {
- CreateRfaDto,
- UpdateRfaDto,
- SearchRfaDto
+import {
+ CreateRfaDto,
+ UpdateRfaDto,
+ SearchRfaDto
} from "@/types/dto/rfa/rfa.dto";
// DTO สำหรับการอนุมัติ (อาจจะย้ายไปไว้ใน folder dto/rfa/ ก็ได้ในอนาคต)
@@ -26,9 +26,9 @@ export const rfaService = {
/**
* ดึงรายละเอียด RFA และประวัติ Workflow
*/
- getById: async (id: string | number) => {
- // GET /rfas/:id
- const response = await apiClient.get(`/rfas/${id}`);
+ getByUuid: async (uuid: string) => {
+ // GET /rfas/:uuid (ADR-019)
+ const response = await apiClient.get(`/rfas/${uuid}`);
return response.data;
},
@@ -44,26 +44,27 @@ export const rfaService = {
/**
* แก้ไข RFA (เฉพาะสถานะ Draft)
*/
- update: async (id: string | number, data: UpdateRfaDto) => {
- // PUT /rfas/:id
- const response = await apiClient.put(`/rfas/${id}`, data);
+ update: async (uuid: string, data: UpdateRfaDto) => {
+ // PUT /rfas/:uuid (ADR-019)
+ const response = await apiClient.put(`/rfas/${uuid}`, data);
return response.data;
},
/**
* ดำเนินการ Workflow (อนุมัติ / ตีกลับ / ส่งต่อ)
*/
- processWorkflow: async (id: string | number, actionData: WorkflowActionDto) => {
- // POST /rfas/:id/workflow
- const response = await apiClient.post(`/rfas/${id}/workflow`, actionData);
+ processWorkflow: async (uuid: string, actionData: WorkflowActionDto) => {
+ // POST /rfas/:uuid/workflow (ADR-019)
+ const response = await apiClient.post(`/rfas/${uuid}/workflow`, actionData);
return response.data;
},
/**
* (Optional) ลบ RFA (Soft Delete)
*/
- delete: async (id: string | number) => {
- const response = await apiClient.delete(`/rfas/${id}`);
+ delete: async (uuid: string) => {
+ // DELETE /rfas/:uuid (ADR-019)
+ const response = await apiClient.delete(`/rfas/${uuid}`);
return response.data;
}
-};
\ No newline at end of file
+};
diff --git a/frontend/lib/services/transmittal.service.ts b/frontend/lib/services/transmittal.service.ts
index 87c6396..32a5e11 100644
--- a/frontend/lib/services/transmittal.service.ts
+++ b/frontend/lib/services/transmittal.service.ts
@@ -1,9 +1,9 @@
// File: lib/services/transmittal.service.ts
import apiClient from "@/lib/api/client";
-import {
- CreateTransmittalDto,
- UpdateTransmittalDto,
- SearchTransmittalDto
+import {
+ CreateTransmittalDto,
+ UpdateTransmittalDto,
+ SearchTransmittalDto
} from "@/types/dto/transmittal/transmittal.dto";
export const transmittalService = {
@@ -17,11 +17,11 @@ export const transmittalService = {
},
/**
- * ดึงรายละเอียด Transmittal ตาม ID
+ * ดึงรายละเอียด Transmittal ตาม UUID (ADR-019)
*/
- getById: async (id: string | number) => {
- // GET /transmittals/:id
- const response = await apiClient.get(`/transmittals/${id}`);
+ getByUuid: async (uuid: string) => {
+ // GET /transmittals/:uuid
+ const response = await apiClient.get(`/transmittals/${uuid}`);
return response.data;
},
@@ -37,18 +37,18 @@ export const transmittalService = {
/**
* แก้ไขข้อมูล Transmittal (เฉพาะ Draft)
*/
- update: async (id: string | number, data: UpdateTransmittalDto) => {
- // PUT /transmittals/:id
- const response = await apiClient.put(`/transmittals/${id}`, data);
+ update: async (uuid: string, data: UpdateTransmittalDto) => {
+ // PUT /transmittals/:uuid (ADR-019)
+ const response = await apiClient.put(`/transmittals/${uuid}`, data);
return response.data;
},
/**
* ลบเอกสาร (Soft Delete)
*/
- delete: async (id: string | number) => {
- // DELETE /transmittals/:id
- const response = await apiClient.delete(`/transmittals/${id}`);
+ delete: async (uuid: string) => {
+ // DELETE /transmittals/:uuid (ADR-019)
+ const response = await apiClient.delete(`/transmittals/${uuid}`);
return response.data;
}
-};
\ No newline at end of file
+};
diff --git a/frontend/package.json b/frontend/package.json
index 5fdab8b..71c367a 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "lcbp3-frontend",
- "version": "1.5.1",
+ "version": "1.8.0",
"private": true,
"scripts": {
"dev": "next dev",
diff --git a/frontend/types/rfa.ts b/frontend/types/rfa.ts
index b04aab0..af37349 100644
--- a/frontend/types/rfa.ts
+++ b/frontend/types/rfa.ts
@@ -8,7 +8,8 @@ export interface RFAItem {
}
export interface RFA {
- id: number; // Shared PK with Correspondence
+ uuid: string; // ADR-019: from correspondence.uuid
+ id?: number; // Excluded from API responses (ADR-019)
rfaTypeId: number;
createdBy: number;
disciplineId?: number;
@@ -35,12 +36,14 @@ export interface RFA {
};
// Shared Correspondence Relation
correspondence?: {
- id: number;
+ uuid: string;
+ id?: number; // Excluded from API responses (ADR-019)
correspondenceNumber: string;
projectId: number;
originatorId?: number;
createdAt?: string;
project?: {
+ uuid: string;
projectName: string;
projectCode: string;
};
diff --git a/frontend/types/transmittal.ts b/frontend/types/transmittal.ts
index dcb2ba2..c1bdd36 100644
--- a/frontend/types/transmittal.ts
+++ b/frontend/types/transmittal.ts
@@ -28,8 +28,9 @@ export interface TransmittalItem {
* Main Transmittal entity
*/
export interface Transmittal {
- id: number;
- correspondenceId: number;
+ uuid: string; // ADR-019: from correspondence.uuid
+ id?: number; // Excluded from API responses (ADR-019)
+ correspondenceId?: number | string;
transmittalNo: string;
subject: string;
purpose?: TransmittalPurpose;
@@ -38,7 +39,8 @@ export interface Transmittal {
// Joined relations from API
items?: TransmittalItem[];
correspondence?: {
- id: number;
+ uuid: string;
+ id?: number; // Excluded from API responses (ADR-019)
correspondence_number: string;
project_id: number;
};
@@ -70,9 +72,9 @@ export interface CreateTransmittalItemDto {
* DTO for creating a transmittal
*/
export interface CreateTransmittalDto {
- projectId?: number;
- recipientOrganizationId?: number;
- correspondenceId: number;
+ projectId?: number | string; // ADR-019: Accept UUID
+ recipientOrganizationId?: number | string; // ADR-019: Accept UUID
+ correspondenceId: number | string; // ADR-019: Accept UUID
subject: string;
purpose?: TransmittalPurpose;
remarks?: string;
@@ -85,6 +87,6 @@ export interface CreateTransmittalDto {
export interface SearchTransmittalDto {
page?: number;
limit?: number;
- projectId?: number;
+ projectId?: number | string; // ADR-019: Accept UUID
search?: string;
}
diff --git a/lcbp3.code-workspace b/lcbp3.code-workspace
index 2bdb0c5..f63085d 100644
--- a/lcbp3.code-workspace
+++ b/lcbp3.code-workspace
@@ -928,6 +928,6 @@
],
},
"extensions": {
- "recommendations": ["jlcodes.antigravity-cockpit"],
+ "recommendations": [],
},
}