251210:1709 Frontend: reeactor organization and run build
This commit is contained in:
@@ -1,43 +1,43 @@
|
||||
export interface Role {
|
||||
role_id: number;
|
||||
role_name: string;
|
||||
roleId: number;
|
||||
roleName: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
user_id: number;
|
||||
userId: number;
|
||||
username: string;
|
||||
email: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
is_active: boolean;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
isActive: boolean;
|
||||
roles: Role[];
|
||||
}
|
||||
|
||||
export interface CreateUserDto {
|
||||
username: string;
|
||||
email: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
password?: string;
|
||||
is_active: boolean;
|
||||
isActive: boolean;
|
||||
roles: number[];
|
||||
}
|
||||
|
||||
export interface Organization {
|
||||
org_id: number;
|
||||
org_code: string;
|
||||
org_name: string;
|
||||
org_name_th?: string;
|
||||
orgId: number;
|
||||
orgCode: string;
|
||||
orgName: string;
|
||||
orgNameTh?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface AuditLog {
|
||||
audit_log_id: number;
|
||||
user_name: string;
|
||||
auditLogId: number;
|
||||
userName: string;
|
||||
action: string;
|
||||
entity_type: string;
|
||||
entityType: string;
|
||||
description: string;
|
||||
ip_address?: string;
|
||||
created_at: string;
|
||||
ipAddress?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export interface Organization {
|
||||
id: number;
|
||||
org_name: string;
|
||||
org_code: string;
|
||||
orgName: string;
|
||||
orgCode: string;
|
||||
}
|
||||
|
||||
export interface Attachment {
|
||||
@@ -10,32 +10,32 @@ export interface Attachment {
|
||||
url: string;
|
||||
size?: number;
|
||||
type?: string;
|
||||
created_at?: string;
|
||||
createdAt?: string;
|
||||
}
|
||||
|
||||
export interface Correspondence {
|
||||
correspondence_id: number;
|
||||
document_number: string;
|
||||
correspondenceId: number;
|
||||
documentNumber: string;
|
||||
subject: string;
|
||||
description?: string;
|
||||
status: "DRAFT" | "PENDING" | "IN_REVIEW" | "APPROVED" | "REJECTED" | "CLOSED";
|
||||
importance: "NORMAL" | "HIGH" | "URGENT";
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
from_organization_id: number;
|
||||
to_organization_id: number;
|
||||
from_organization?: Organization;
|
||||
to_organization?: Organization;
|
||||
document_type_id: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
fromOrganizationId: number;
|
||||
toOrganizationId: number;
|
||||
fromOrganization?: Organization;
|
||||
toOrganization?: Organization;
|
||||
documentTypeId: number;
|
||||
attachments?: Attachment[];
|
||||
}
|
||||
|
||||
export interface CreateCorrespondenceDto {
|
||||
subject: string;
|
||||
description?: string;
|
||||
document_type_id: number;
|
||||
from_organization_id: number;
|
||||
to_organization_id: number;
|
||||
documentTypeId: number;
|
||||
fromOrganizationId: number;
|
||||
toOrganizationId: number;
|
||||
importance: "NORMAL" | "HIGH" | "URGENT";
|
||||
attachments?: File[];
|
||||
}
|
||||
|
||||
@@ -1,34 +1,36 @@
|
||||
export interface DrawingRevision {
|
||||
revision_id: number;
|
||||
revision_number: string;
|
||||
revision_date: string;
|
||||
revision_description?: string;
|
||||
revised_by_name: string;
|
||||
file_url: string;
|
||||
is_current: boolean;
|
||||
revisionId: number;
|
||||
revisionNumber: string;
|
||||
revisionDate: string;
|
||||
revisionDescription?: string;
|
||||
revisedByName: string;
|
||||
fileUrl: string;
|
||||
isCurrent: boolean;
|
||||
}
|
||||
|
||||
export interface Drawing {
|
||||
drawing_id: number;
|
||||
drawing_number: string;
|
||||
drawingId: number;
|
||||
drawingNumber: string;
|
||||
title: string;
|
||||
type: "CONTRACT" | "SHOP";
|
||||
discipline_id: number;
|
||||
discipline?: { id: number; discipline_code: string; discipline_name: string };
|
||||
sheet_number: string;
|
||||
discipline?: string | { disciplineCode: string; disciplineName: string };
|
||||
type?: string;
|
||||
status?: string;
|
||||
revision?: string;
|
||||
sheetNumber?: string;
|
||||
scale?: string;
|
||||
current_revision: string;
|
||||
issue_date: string;
|
||||
revision_count: number;
|
||||
issueDate?: string;
|
||||
revisionCount?: number;
|
||||
revisions?: DrawingRevision[];
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface CreateDrawingDto {
|
||||
drawing_type: "CONTRACT" | "SHOP";
|
||||
drawing_number: string;
|
||||
drawingType: "CONTRACT" | "SHOP";
|
||||
drawingNumber: string;
|
||||
title: string;
|
||||
discipline_id: number;
|
||||
sheet_number: string;
|
||||
disciplineId: number;
|
||||
sheetNumber: string;
|
||||
scale?: string;
|
||||
file: File;
|
||||
}
|
||||
|
||||
22
frontend/types/dto/organization.dto.ts
Normal file
22
frontend/types/dto/organization.dto.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
// DTOs for Organization management
|
||||
// Aligned with backend CreateOrganizationDto, UpdateOrganizationDto, SearchOrganizationDto
|
||||
|
||||
export interface CreateOrganizationDto {
|
||||
organizationCode: string;
|
||||
organizationName: string;
|
||||
roleId?: number;
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
export interface UpdateOrganizationDto {
|
||||
organizationCode?: string;
|
||||
organizationName?: string;
|
||||
roleId?: number;
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
export interface SearchOrganizationDto {
|
||||
search?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}
|
||||
@@ -35,8 +35,8 @@ export interface UpdateRfaDto extends Partial<CreateRfaDto> {}
|
||||
|
||||
// --- Search ---
|
||||
export interface SearchRfaDto {
|
||||
/** บังคับระบุ Project ID เสมอ */
|
||||
projectId: number;
|
||||
/** Filter by Project ID (optional to allow cross-project search) */
|
||||
projectId?: number;
|
||||
|
||||
/** กรองตามประเภท RFA */
|
||||
rfaTypeId?: number;
|
||||
@@ -52,4 +52,4 @@ export interface SearchRfaDto {
|
||||
|
||||
/** จำนวนต่อหน้า (Default: 20) */
|
||||
pageSize?: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,12 @@ export enum TransmittalPurpose {
|
||||
|
||||
// --- Create ---
|
||||
export interface CreateTransmittalDto {
|
||||
/** จำเป็นสำหรับการออกเลขที่เอกสาร (Running Number) */
|
||||
projectId: number;
|
||||
|
||||
/** วัตถุประสงค์การส่ง */
|
||||
purpose?: TransmittalPurpose;
|
||||
|
||||
/** หมายเหตุเพิ่มเติม */
|
||||
projectId?: number;
|
||||
recipientOrganizationId?: number;
|
||||
subject: string;
|
||||
purpose?: string;
|
||||
remarks?: string;
|
||||
|
||||
/** ID ของเอกสาร (Correspondence IDs) ที่จะแนบไปใน Transmittal นี้ */
|
||||
correspondenceId: number; // For now linked correspondence
|
||||
items: CreateTransmittalItemDto[];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export interface Notification {
|
||||
notification_id: number;
|
||||
notificationId: number;
|
||||
title: string;
|
||||
message: string;
|
||||
type: "INFO" | "SUCCESS" | "WARNING" | "ERROR";
|
||||
is_read: boolean;
|
||||
created_at: string;
|
||||
isRead: boolean;
|
||||
createdAt: string;
|
||||
link?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +1,13 @@
|
||||
export interface NumberingTemplate {
|
||||
template_id: number;
|
||||
document_type_id: string;
|
||||
document_type_name: string;
|
||||
discipline_code?: string;
|
||||
template_format: string;
|
||||
example_number: string;
|
||||
current_number: number;
|
||||
reset_annually: boolean;
|
||||
padding_length: number;
|
||||
is_active: boolean;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface NumberingSequence {
|
||||
sequence_id: number;
|
||||
template_id: number;
|
||||
year: number;
|
||||
organization_code?: string;
|
||||
discipline_code?: string;
|
||||
current_number: number;
|
||||
last_generated_number: string;
|
||||
updated_at: string;
|
||||
}
|
||||
// Re-export types from API file to keep single source of truth
|
||||
export type { NumberingTemplate, NumberSequence } from "@/lib/api/numbering";
|
||||
|
||||
export interface CreateTemplateDto {
|
||||
document_type_id: string;
|
||||
discipline_code?: string;
|
||||
template_format: string;
|
||||
reset_annually: boolean;
|
||||
padding_length: number;
|
||||
starting_number: number;
|
||||
documentTypeId: string;
|
||||
disciplineCode?: string;
|
||||
templateFormat: string;
|
||||
resetAnnually: boolean;
|
||||
paddingLength: number;
|
||||
startingNumber: number;
|
||||
}
|
||||
|
||||
export interface TestGenerationResult {
|
||||
|
||||
@@ -2,15 +2,8 @@ export interface Organization {
|
||||
id: number;
|
||||
organizationCode: string;
|
||||
organizationName: string;
|
||||
organizationNameTh?: string; // Optional if not present in backend entity
|
||||
description?: string;
|
||||
roleId?: number; // NEW - organization role (OWNER, DESIGNER, CONSULTANT, CONTRACTOR, THIRD_PARTY)
|
||||
isActive: boolean;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
|
||||
// Keep legacy types optional for backward compatibility if needed, or remove them
|
||||
organization_id?: number;
|
||||
org_code?: string;
|
||||
org_name?: string;
|
||||
org_name_th?: string;
|
||||
}
|
||||
|
||||
1
frontend/types/react-day-picker.d.ts
vendored
Normal file
1
frontend/types/react-day-picker.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare module 'react-day-picker';
|
||||
@@ -1,6 +1,6 @@
|
||||
export interface RFAItem {
|
||||
id?: number;
|
||||
item_no: string;
|
||||
itemNo: string;
|
||||
description: string;
|
||||
quantity: number;
|
||||
unit: string;
|
||||
@@ -8,25 +8,30 @@ export interface RFAItem {
|
||||
}
|
||||
|
||||
export interface RFA {
|
||||
rfa_id: number;
|
||||
rfa_number: string;
|
||||
rfaId: number;
|
||||
rfaNumber: string;
|
||||
subject: string;
|
||||
description?: string;
|
||||
contract_id: number;
|
||||
discipline_id: number;
|
||||
contractId: number;
|
||||
disciplineId: number;
|
||||
status: "DRAFT" | "PENDING" | "IN_REVIEW" | "APPROVED" | "REJECTED" | "CLOSED";
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
items: RFAItem[];
|
||||
// Mock fields for display
|
||||
contract_name?: string;
|
||||
discipline_name?: string;
|
||||
contractName?: string;
|
||||
disciplineName?: string;
|
||||
}
|
||||
|
||||
export interface CreateRFADto {
|
||||
subject: string;
|
||||
projectId?: number;
|
||||
rfaTypeId: number;
|
||||
title: string;
|
||||
description?: string;
|
||||
contract_id: number;
|
||||
discipline_id: number;
|
||||
contractId: number;
|
||||
disciplineId: number;
|
||||
toOrganizationId: number;
|
||||
dueDate?: string;
|
||||
shopDrawingRevisionIds?: number[];
|
||||
items: RFAItem[];
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ export interface CreateTransmittalItemDto {
|
||||
* DTO for creating a transmittal
|
||||
*/
|
||||
export interface CreateTransmittalDto {
|
||||
projectId?: number;
|
||||
recipientOrganizationId?: number;
|
||||
correspondenceId: number;
|
||||
subject: string;
|
||||
purpose?: TransmittalPurpose;
|
||||
|
||||
@@ -5,44 +5,52 @@ export interface Role {
|
||||
}
|
||||
|
||||
export interface UserOrganization {
|
||||
organization_id: number;
|
||||
org_code: string;
|
||||
org_name: string;
|
||||
org_name_th?: string;
|
||||
organizationId: number;
|
||||
orgCode: string;
|
||||
orgName: string;
|
||||
orgNameTh?: string;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
user_id: number;
|
||||
userId: number;
|
||||
username: string;
|
||||
email: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
is_active: boolean;
|
||||
line_id?: string;
|
||||
primary_organization_id?: number;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
isActive: boolean;
|
||||
lineId?: string;
|
||||
primaryOrganizationId?: number;
|
||||
organization?: UserOrganization;
|
||||
roles?: Role[];
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
|
||||
// Security fields (from backend v1.5.1)
|
||||
failedAttempts: number;
|
||||
lockedUntil?: string;
|
||||
lastLoginAt?: string;
|
||||
|
||||
// Audit columns
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface CreateUserDto {
|
||||
username: string;
|
||||
email: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
password?: string;
|
||||
is_active: boolean;
|
||||
line_id?: string;
|
||||
primary_organization_id?: number;
|
||||
role_ids: number[];
|
||||
isActive: boolean;
|
||||
lineId?: string;
|
||||
primaryOrganizationId?: number;
|
||||
roleIds: number[];
|
||||
}
|
||||
|
||||
export interface UpdateUserDto extends Partial<CreateUserDto> {}
|
||||
export type UpdateUserDto = Partial<CreateUserDto>;
|
||||
|
||||
export interface SearchUserDto {
|
||||
page?: number;
|
||||
limit?: number;
|
||||
search?: string;
|
||||
role_id?: number;
|
||||
roleId?: number;
|
||||
primaryOrganizationId?: number;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
export type WorkflowType = "CORRESPONDENCE" | "RFA" | "DRAWING";
|
||||
|
||||
export interface WorkflowStep {
|
||||
step_id?: string;
|
||||
step_name: string;
|
||||
step_type: "APPROVAL" | "REVIEW" | "ENDORSEMENT";
|
||||
approver_role_id?: number;
|
||||
approver_role_name?: string;
|
||||
next_step_success?: string;
|
||||
next_step_failure?: string;
|
||||
stepId?: string;
|
||||
stepName: string;
|
||||
stepType: "APPROVAL" | "REVIEW" | "ENDORSEMENT";
|
||||
approverRoleId?: number;
|
||||
approverRoleName?: string;
|
||||
nextStepSuccess?: string;
|
||||
nextStepFailure?: string;
|
||||
}
|
||||
|
||||
export interface Workflow {
|
||||
workflow_id: number;
|
||||
workflow_name: string;
|
||||
workflowId: number;
|
||||
workflowName: string;
|
||||
description: string;
|
||||
workflow_type: WorkflowType;
|
||||
workflowType: WorkflowType;
|
||||
version: number;
|
||||
is_active: boolean;
|
||||
dsl_definition: string;
|
||||
step_count: number;
|
||||
updated_at: string;
|
||||
isActive: boolean;
|
||||
dslDefinition: string;
|
||||
stepCount: number;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface CreateWorkflowDto {
|
||||
workflow_name: string;
|
||||
workflowName: string;
|
||||
description: string;
|
||||
workflow_type: WorkflowType;
|
||||
dsl_definition: string;
|
||||
workflowType: WorkflowType;
|
||||
dslDefinition: string;
|
||||
}
|
||||
|
||||
export interface ValidationResult {
|
||||
|
||||
Reference in New Issue
Block a user