690325:2132 Fixing Naming convention missunderstand #01
CI / CD Pipeline / build (push) Failing after 38m8s
CI / CD Pipeline / deploy (push) Has been skipped

This commit is contained in:
2026-03-25 21:32:47 +07:00
parent 509fe7b597
commit d36d4b0bf4
32 changed files with 648 additions and 527 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"npm.packageManager": "pnpm"
}
@@ -8,28 +8,28 @@ import { CorrespondenceType } from '@/types/master-data';
export default function CorrespondenceTypesPage() {
const columns: ColumnDef<CorrespondenceType>[] = [
{
accessorKey: 'type_code',
accessorKey: 'typeCode',
header: 'Code',
cell: ({ row }) => <span className="font-mono font-bold">{row.getValue('type_code')}</span>,
cell: ({ row }) => <span className="font-mono font-bold">{row.getValue('typeCode')}</span>,
},
{
accessorKey: 'type_name',
accessorKey: 'typeName',
header: 'Name',
},
{
accessorKey: 'sort_order',
accessorKey: 'sortOrder',
header: 'Sort Order',
},
{
accessorKey: 'is_active',
accessorKey: 'isActive',
header: 'Status',
cell: ({ row }) => (
<span
className={`px-2 py-1 rounded-full text-xs ${
row.getValue('is_active') ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
row.getValue('isActive') ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
}`}
>
{row.getValue('is_active') ? 'Active' : 'Inactive'}
{row.getValue('isActive') ? 'Active' : 'Inactive'}
</span>
),
},
@@ -52,10 +52,10 @@ export default function CorrespondenceTypesPage() {
deleteFn={(id) => masterDataService.deleteCorrespondenceType(id)}
columns={columns}
fields={[
{ name: 'type_code', label: 'Code', type: 'text', required: true },
{ name: 'type_name', label: 'Name', type: 'text', required: true },
{ name: 'sort_order', label: 'Sort Order', type: 'text' },
{ name: 'is_active', label: 'Active', type: 'checkbox' },
{ name: 'typeCode', label: 'Code', type: 'text', required: true },
{ name: 'typeName', label: 'Name', type: 'text', required: true },
{ name: 'sortOrder', label: 'Sort Order', type: 'text' },
{ name: 'isActive', label: 'Active', type: 'checkbox' },
]}
/>
</div>
@@ -17,28 +17,28 @@ export default function DisciplinesPage() {
const columns: ColumnDef<Discipline>[] = [
{
accessorKey: 'discipline_code',
accessorKey: 'disciplineCode',
header: 'Code',
cell: ({ row }) => <span className="font-mono font-bold">{row.getValue('discipline_code')}</span>,
cell: ({ row }) => <span className="font-mono font-bold">{row.getValue('disciplineCode')}</span>,
},
{
accessorKey: 'code_name_th',
accessorKey: 'codeNameTh',
header: 'Name (TH)',
},
{
accessorKey: 'code_name_en',
accessorKey: 'codeNameEn',
header: 'Name (EN)',
},
{
accessorKey: 'is_active',
accessorKey: 'isActive',
header: 'Status',
cell: ({ row }) => (
<span
className={`px-2 py-1 rounded-full text-xs ${
row.getValue('is_active') ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
row.getValue('isActive') ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
}`}
>
{row.getValue('is_active') ? 'Active' : 'Inactive'}
{row.getValue('isActive') ? 'Active' : 'Inactive'}
</span>
),
},
@@ -17,16 +17,16 @@ export default function RfaTypesPage() {
const columns: ColumnDef<RfaType>[] = [
{
accessorKey: 'type_code',
accessorKey: 'typeCode',
header: 'Code',
cell: ({ row }) => <span className="font-mono font-bold">{row.getValue('type_code')}</span>,
cell: ({ row }) => <span className="font-mono font-bold">{row.getValue('typeCode')}</span>,
},
{
accessorKey: 'type_name_th',
accessorKey: 'typeNameTh',
header: 'Name (TH)',
},
{
accessorKey: 'type_name_en',
accessorKey: 'typeNameEn',
header: 'Name (EN)',
},
{
@@ -34,15 +34,15 @@ export default function RfaTypesPage() {
header: 'Remark',
},
{
accessorKey: 'is_active',
accessorKey: 'isActive',
header: 'Status',
cell: ({ row }) => (
<span
className={`px-2 py-1 rounded-full text-xs ${
row.getValue('is_active') ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
row.getValue('isActive') ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
}`}
>
{row.getValue('is_active') ? 'Active' : 'Inactive'}
{row.getValue('isActive') ? 'Active' : 'Inactive'}
</span>
),
},
@@ -18,25 +18,25 @@ import { toast } from 'sonner';
import { Card, CardContent } from '@/components/ui/card';
interface MigrationAiIssues {
document_date?: string;
issued_date?: string;
received_date?: string;
sender_id?: string | number;
discipline_id?: string | number;
source_file_path?: string;
key_points?: string[];
validation_results?: Array<{ message: string; severity: string }>;
documentDate?: string;
issuedDate?: string;
receivedDate?: string;
senderId?: string | number;
disciplineId?: string | number;
sourceFilePath?: string;
keyPoints?: string[];
validationResults?: Array<{ message: string; severity: string }>;
}
const reviewFormSchema = z.object({
document_number: z.string().min(1, 'Document number is required'),
documentNumber: z.string().min(1, 'Document number is required'),
subject: z.string().min(1, 'Subject is required'),
category: z.string().min(1, 'Category is required'),
document_date: z.string().optional(),
issued_date: z.string().optional(),
received_date: z.string().optional(),
sender_id: z.string().optional(),
discipline_id: z.string().optional(),
documentDate: z.string().optional(),
issuedDate: z.string().optional(),
receivedDate: z.string().optional(),
senderId: z.string().optional(),
disciplineId: z.string().optional(),
});
type ReviewFormValues = z.infer<typeof reviewFormSchema>;
@@ -53,14 +53,14 @@ export default function MigrationReviewPage() {
const form = useForm<ReviewFormValues>({
resolver: zodResolver(reviewFormSchema),
defaultValues: {
document_number: '',
documentNumber: '',
subject: '',
category: '',
document_date: '',
issued_date: '',
received_date: '',
sender_id: '',
discipline_id: '',
documentDate: '',
issuedDate: '',
receivedDate: '',
senderId: '',
disciplineId: '',
},
});
@@ -75,14 +75,14 @@ export default function MigrationReviewPage() {
// Pre-fill form from database item and aiIssues payload
const issues = (res.aiIssues || {}) as MigrationAiIssues;
form.reset({
document_number: res.documentNumber || '',
documentNumber: res.documentNumber || '',
subject: res.title || res.originalTitle || '',
category: res.aiSuggestedCategory || '',
document_date: issues.document_date || '',
issued_date: issues.issued_date || '',
received_date: issues.received_date || '',
sender_id: issues.sender_id ? String(issues.sender_id) : '',
discipline_id: issues.discipline_id ? String(issues.discipline_id) : '',
documentDate: issues.documentDate || '',
issuedDate: issues.issuedDate || '',
receivedDate: issues.receivedDate || '',
senderId: issues.senderId ? String(issues.senderId) : '',
disciplineId: issues.disciplineId ? String(issues.disciplineId) : '',
});
}
} catch (_error) {
@@ -107,21 +107,21 @@ export default function MigrationReviewPage() {
const issues = item.aiIssues || {};
const payload = {
document_number: values.document_number,
documentNumber: values.documentNumber,
subject: values.subject,
category: values.category,
source_file_path: issues.source_file_path || '',
migrated_by: 'SYSTEM_IMPORT',
batch_id: 'MANUAL_REVIEW_BATCH',
project_id: 1, // Assumption or pulled from store
document_date: values.document_date,
issued_date: values.issued_date,
received_date: values.received_date,
sender_id: values.sender_id ? Number(values.sender_id) : undefined,
discipline_id: values.discipline_id ? Number(values.discipline_id) : undefined,
sourceFilePath: issues.sourceFilePath || '',
migratedBy: 'SYSTEM_IMPORT',
batchId: 'MANUAL_REVIEW_BATCH',
projectId: 1, // Assumption or pulled from store
documentDate: values.documentDate,
issuedDate: values.issuedDate,
receivedDate: values.receivedDate,
senderId: values.senderId ? Number(values.senderId) : undefined,
disciplineId: values.disciplineId ? Number(values.disciplineId) : undefined,
details: {
tags: issues.tags || [],
ai_confidence: item.aiConfidence,
aiConfidence: item.aiConfidence,
},
};
@@ -162,8 +162,8 @@ export default function MigrationReviewPage() {
return <div className="py-10 text-center text-red-500">Document not found</div>;
}
const pdfUrl = (item.aiIssues as MigrationAiIssues)?.source_file_path
? migrationService.getStagingFileUrl((item.aiIssues as MigrationAiIssues).source_file_path!)
const pdfUrl = (item.aiIssues as MigrationAiIssues)?.sourceFilePath
? migrationService.getStagingFileUrl((item.aiIssues as MigrationAiIssues).sourceFilePath!)
: null;
return (
@@ -221,7 +221,7 @@ export default function MigrationReviewPage() {
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
<FormField
control={form.control}
name="document_number"
name="documentNumber"
render={({ field }) => (
<FormItem>
<FormLabel>Document Number</FormLabel>
@@ -272,7 +272,7 @@ export default function MigrationReviewPage() {
/>
<FormField
control={form.control}
name="discipline_id"
name="disciplineId"
render={({ field }) => (
<FormItem>
<FormLabel>Discipline ID</FormLabel>
@@ -288,7 +288,7 @@ export default function MigrationReviewPage() {
<div className="grid grid-cols-2 gap-4">
<FormField
control={form.control}
name="document_date"
name="documentDate"
render={({ field }) => (
<FormItem>
<FormLabel>Doc Date</FormLabel>
@@ -300,7 +300,7 @@ export default function MigrationReviewPage() {
/>
<FormField
control={form.control}
name="issued_date"
name="issuedDate"
render={({ field }) => (
<FormItem>
<FormLabel>Issued Date</FormLabel>
@@ -314,7 +314,7 @@ export default function MigrationReviewPage() {
<FormField
control={form.control}
name="sender_id"
name="senderId"
render={({ field }) => (
<FormItem>
<FormLabel>Sender Org ID</FormLabel>
@@ -326,11 +326,11 @@ export default function MigrationReviewPage() {
)}
/>
{(item.aiIssues as MigrationAiIssues)?.key_points && (item.aiIssues as MigrationAiIssues).key_points!.length > 0 && (
{(item.aiIssues as MigrationAiIssues)?.keyPoints && (item.aiIssues as MigrationAiIssues).keyPoints!.length > 0 && (
<div className="mt-6 border-t pt-4">
<h3 className="font-semibold text-sm mb-2 text-muted-foreground">AI Extracted Key Points</h3>
<ul className="text-sm space-y-1 list-disc pl-4 text-muted-foreground">
{(item.aiIssues as MigrationAiIssues).key_points!.map((point: string, i: number) => (
{(item.aiIssues as MigrationAiIssues).keyPoints!.map((point: string, i: number) => (
<li key={i}>{point}</li>
))}
</ul>
+11 -11
View File
@@ -22,15 +22,15 @@ export interface CirculationRouting {
updatedAt: string;
// Joined relations from API
assignee?: {
user_id: number;
userId: number;
username: string;
first_name?: string;
last_name?: string;
firstName?: string;
lastName?: string;
};
organization?: {
id: number;
organization_code: string;
organization_name: string;
organizationCode: string;
organizationName: string;
};
}
@@ -55,20 +55,20 @@ export interface Circulation {
correspondence?: {
uuid: string;
id?: number;
correspondence_number: string;
correspondenceNumber: string;
};
organization?: {
uuid: string;
id?: number;
organization_code: string;
organization_name: string;
organizationCode: string;
organizationName: string;
};
creator?: {
uuid: string;
user_id?: number;
userId?: number;
username: string;
first_name?: string;
last_name?: string;
firstName?: string;
lastName?: string;
};
}
+4 -4
View File
@@ -2,13 +2,13 @@
export interface CreateTagDto {
/** ID โครงการ (NULL = Global) */
project_id?: number | null;
projectId?: number | null;
/** ชื่อ Tag (เช่น 'URGENT') */
tag_name: string;
tagName: string;
/** รหัสสี หรือชื่อคลาสสำหรับ UI */
color_code?: string;
colorCode?: string;
/** คำอธิบาย */
description?: string;
@@ -18,7 +18,7 @@ export type UpdateTagDto = Partial<CreateTagDto>;
export interface SearchTagDto {
/** ID โครงการ (ใช้กรอง Tag ของแต่ละโปรเจกต์) */
project_id?: number;
projectId?: number;
/** คำค้นหา (ชื่อ Tag หรือ คำอธิบาย) */
search?: string;
@@ -7,13 +7,13 @@ export interface WorkflowDsl {
/** Allow extra properties for different DSL formats */
[key: string]: unknown;
states?: Record<string, WorkflowState>;
initial_state?: string;
initialState?: string;
}
export interface WorkflowState {
transitions?: WorkflowTransition[];
on_enter?: string[];
on_exit?: string[];
onEnter?: string[];
onExit?: string[];
}
export interface WorkflowTransition {
@@ -26,13 +26,13 @@ export interface WorkflowTransition {
// --- Create Definition ---
export interface CreateWorkflowDefinitionDto {
/** รหัสของ Workflow (เช่น 'RFA', 'CORRESPONDENCE') */
workflow_code: string;
workflowCode: string;
/** นิยาม Workflow (DSL JSON Object) */
dsl: WorkflowDsl;
/** เปิดใช้งานทันทีหรือไม่ (Default: true) */
is_active?: boolean;
isActive?: boolean;
}
// --- Update Definition ---
@@ -41,10 +41,10 @@ export type UpdateWorkflowDefinitionDto = Partial<CreateWorkflowDefinitionDto>;
// --- Evaluate (ประมวลผล/ตรวจสอบ State) ---
export interface EvaluateWorkflowDto {
/** รหัส Workflow */
workflow_code: string;
workflowCode: string;
/** สถานะปัจจุบัน */
current_state: string;
currentState: string;
/** Action ที่ต้องการทำ (เช่น 'SUBMIT', 'APPROVE') */
action: string;
@@ -56,8 +56,8 @@ export interface EvaluateWorkflowDto {
// --- Get Available Actions ---
export interface GetAvailableActionsDto {
/** รหัส Workflow */
workflow_code: string;
workflowCode: string;
/** สถานะปัจจุบัน */
current_state: string;
currentState: string;
}
+2 -2
View File
@@ -29,8 +29,8 @@ export interface RfaType {
export interface Tag {
id: number;
tag_name: string;
color_code?: string;
tagName: string;
colorCode?: string;
description?: string;
}