690328:1547 Fixing Refactor uuid by Kimi #10
This commit is contained in:
BIN
Binary file not shown.
@@ -113,7 +113,7 @@ export default function UsersPage() {
|
||||
return (
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{roles.map((r) => (
|
||||
<Badge key={r.roleId} variant="outline" className="text-xs">
|
||||
<Badge key={r.publicId} variant="outline" className="text-xs">
|
||||
{r.roleName}
|
||||
</Badge>
|
||||
))}
|
||||
|
||||
@@ -42,7 +42,7 @@ export default function WorkflowsPage() {
|
||||
) : (
|
||||
<div className="grid gap-4">
|
||||
{workflowList.map((workflow: Workflow) => (
|
||||
<Card key={workflow.workflowId} className="p-6">
|
||||
<Card key={workflow.publicId} className="p-6">
|
||||
<div className="flex justify-between items-start">
|
||||
<div className="flex-1">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
@@ -64,7 +64,7 @@ export default function WorkflowsPage() {
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2">
|
||||
<Link href={`/admin/doc-control/workflows/${workflow.workflowId}/edit`}>
|
||||
<Link href={`/admin/doc-control/workflows/${workflow.publicId}/edit`}>
|
||||
<Button variant="outline" size="sm">
|
||||
<Edit className="mr-2 h-4 w-4" />
|
||||
Edit
|
||||
|
||||
@@ -26,12 +26,12 @@ export default function AuditLogsPage() {
|
||||
<div className="text-center text-muted-foreground py-10">No logs found</div>
|
||||
) : (
|
||||
logs.map((log: import('@/lib/services/audit-log.service').AuditLog) => (
|
||||
<Card key={log.auditId} className="p-4">
|
||||
<Card key={log.publicId} className="p-4">
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="flex-1">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<span className="font-medium text-sm">
|
||||
{log.user?.fullName || log.user?.username || `User #${log.userId || 'System'}`}
|
||||
{log.user?.fullName || log.user?.username || `User #${log.user?.userId || 'System'}`}
|
||||
</span>
|
||||
<Badge
|
||||
variant={log.severity === 'ERROR' ? 'destructive' : 'outline'}
|
||||
|
||||
@@ -64,7 +64,7 @@ export function OrganizationDialog({ open, onOpenChange, organization }: Organiz
|
||||
reset({
|
||||
organizationCode: organization.organizationCode,
|
||||
organizationName: organization.organizationName,
|
||||
roleId: organization.roleId?.toString() || '',
|
||||
roleId: organization.publicId?.toString() || '',
|
||||
isActive: organization.isActive,
|
||||
});
|
||||
} else {
|
||||
@@ -80,7 +80,7 @@ export function OrganizationDialog({ open, onOpenChange, organization }: Organiz
|
||||
const onSubmit = (data: OrganizationFormData) => {
|
||||
const submitData = {
|
||||
...data,
|
||||
roleId: data.roleId ? Number(data.roleId) : undefined,
|
||||
roleId: data.roleId ? String(data.roleId) : undefined,
|
||||
};
|
||||
|
||||
if (organization) {
|
||||
|
||||
@@ -137,7 +137,7 @@ export function RbacMatrix() {
|
||||
<TableRow>
|
||||
<TableHead className="w-[300px]">Permission</TableHead>
|
||||
{roleList.map((role) => (
|
||||
<TableHead key={role.roleId} className="text-center min-w-[100px]">
|
||||
<TableHead key={role.publicId} className="text-center min-w-[100px]">
|
||||
{role.roleName}
|
||||
</TableHead>
|
||||
))}
|
||||
@@ -153,14 +153,14 @@ export function RbacMatrix() {
|
||||
{roleList.map((role) => {
|
||||
// Assume role.permissions is populated
|
||||
const currentRolePerms = role.permissions?.map((p) => p.permissionId) || [];
|
||||
const activePerms = pendingChanges[role.roleId] || currentRolePerms;
|
||||
const activePerms = pendingChanges[role.publicId] || currentRolePerms;
|
||||
const isChecked = activePerms.includes(perm.permissionId);
|
||||
|
||||
return (
|
||||
<TableCell key={`${role.roleId}-${perm.permissionId}`} className="text-center">
|
||||
<TableCell key={`${role.publicId}-${perm.permissionId}`} className="text-center">
|
||||
<Checkbox
|
||||
checked={isChecked}
|
||||
onCheckedChange={() => handleToggle(role.roleId, perm.permissionId, currentRolePerms)}
|
||||
onCheckedChange={() => handleToggle(role.publicId, perm.permissionId, currentRolePerms)}
|
||||
/>
|
||||
</TableCell>
|
||||
);
|
||||
|
||||
@@ -108,7 +108,7 @@ export function UserDialog({ open, onOpenChange, user }: UserDialogProps) {
|
||||
isActive: user.isActive,
|
||||
lineId: user.lineId || '',
|
||||
primaryOrganizationId: user.primaryOrganizationId?.toString() || ALL_ORGANIZATIONS_VALUE,
|
||||
roleIds: user.roles?.map((r: { roleId: number }) => r.roleId) || [],
|
||||
roleIds: user.roles?.map((r: { publicId: string }) => r.publicId) || [],
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
});
|
||||
@@ -297,26 +297,26 @@ export function UserDialog({ open, onOpenChange, user }: UserDialogProps) {
|
||||
<p className="text-sm text-muted-foreground">Loading roles...</p>
|
||||
)}
|
||||
{Array.isArray(roles) &&
|
||||
roles.map((role: { roleId: number; roleName: string; description?: string }) => (
|
||||
<div key={role.roleId} className="flex items-start space-x-2">
|
||||
roles.map((role: { publicId: string; roleName: string; description?: string }) => (
|
||||
<div key={role.publicId} className="flex items-start space-x-2">
|
||||
<Checkbox
|
||||
id={`role-${role.roleId}`}
|
||||
checked={selectedRoleIds.includes(role.roleId)}
|
||||
id={`role-${role.publicId}`}
|
||||
checked={selectedRoleIds.includes(role.publicId)}
|
||||
onCheckedChange={(checked) => {
|
||||
const current = selectedRoleIds;
|
||||
if (checked) {
|
||||
setValue('roleIds', [...current, role.roleId]);
|
||||
setValue('roleIds', [...current, role.publicId]);
|
||||
} else {
|
||||
setValue(
|
||||
'roleIds',
|
||||
current.filter((id) => id !== role.roleId)
|
||||
current.filter((id) => id !== role.publicId)
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<div className="grid gap-1.5 leading-none">
|
||||
<label
|
||||
htmlFor={`role-${role.roleId}`}
|
||||
htmlFor={`role-${role.publicId}`}
|
||||
className="text-sm font-medium leading-none cursor-pointer"
|
||||
>
|
||||
{role.roleName}
|
||||
|
||||
@@ -30,14 +30,14 @@ export function TagManager({ uuid, canEdit }: TagManagerProps) {
|
||||
|
||||
const assigned: Tag[] = Array.isArray(assignedRaw) ? (assignedRaw as Tag[]) : [];
|
||||
const allTags: Tag[] = Array.isArray(allTagsRaw) ? (allTagsRaw as Tag[]) : [];
|
||||
const assignedIds = new Set(assigned.map((t) => t.id));
|
||||
const available = allTags.filter((t) => !assignedIds.has(t.id));
|
||||
const assignedIds = new Set(assigned.map((t) => t.publicId));
|
||||
const available = allTags.filter((t) => !assignedIds.has(t.publicId));
|
||||
|
||||
const handleAdd = (tagId: number) => {
|
||||
const handleAdd = (tagId: number | string) => {
|
||||
addMutation.mutate({ uuid, tagId });
|
||||
};
|
||||
|
||||
const handleRemove = (tagId: number) => {
|
||||
const handleRemove = (tagId: number | string) => {
|
||||
removeMutation.mutate({ uuid, tagId });
|
||||
};
|
||||
|
||||
@@ -71,7 +71,7 @@ export function TagManager({ uuid, canEdit }: TagManagerProps) {
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{assigned.map((tag) => (
|
||||
<span
|
||||
key={tag.id}
|
||||
key={tag.publicId}
|
||||
className="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border"
|
||||
style={{
|
||||
backgroundColor: `${getTagColor(tag.colorCode)}22`,
|
||||
@@ -86,7 +86,7 @@ export function TagManager({ uuid, canEdit }: TagManagerProps) {
|
||||
{tag.tagName}
|
||||
{canEdit && (
|
||||
<button
|
||||
onClick={() => handleRemove(tag.id)}
|
||||
onClick={() => handleRemove(tag.publicId)}
|
||||
disabled={removeMutation.isPending}
|
||||
className="ml-0.5 opacity-60 hover:opacity-100 transition-opacity"
|
||||
>
|
||||
@@ -110,9 +110,9 @@ export function TagManager({ uuid, canEdit }: TagManagerProps) {
|
||||
) : (
|
||||
available.map((tag) => (
|
||||
<button
|
||||
key={tag.id}
|
||||
key={tag.publicId}
|
||||
className="w-full flex items-center gap-2 p-2 text-xs hover:bg-muted/60 transition-colors text-left"
|
||||
onClick={() => { handleAdd(tag.id); setIsOpen(false); }}
|
||||
onClick={() => { handleAdd(tag.publicId); setIsOpen(false); }}
|
||||
disabled={addMutation.isPending}
|
||||
>
|
||||
<span
|
||||
|
||||
@@ -14,7 +14,7 @@ export function RevisionHistory({ revisions }: { revisions: DrawingRevision[] })
|
||||
|
||||
<div className="space-y-3">
|
||||
{revisions.map((rev) => (
|
||||
<div key={rev.revisionId} className="flex items-center justify-between p-3 bg-muted/30 rounded-lg border">
|
||||
<div key={rev.publicId} className="flex items-center justify-between p-3 bg-muted/30 rounded-lg border">
|
||||
<div className="flex-1">
|
||||
<div className="flex items-center gap-3 mb-1">
|
||||
<Badge variant={rev.isCurrent ? 'default' : 'outline'}>Rev. {rev.revisionNumber}</Badge>
|
||||
|
||||
@@ -120,7 +120,7 @@ export function TemplateEditor({
|
||||
<SelectItem value="__default__">Default (All Types)</SelectItem>
|
||||
{correspondenceTypes.map((type) => {
|
||||
return (
|
||||
<SelectItem key={type.id} value={type.id.toString()}>
|
||||
<SelectItem key={type.publicId} value={type.publicId.toString()}>
|
||||
{type.typeCode} - {type.typeName}
|
||||
</SelectItem>
|
||||
);
|
||||
@@ -142,7 +142,7 @@ export function TemplateEditor({
|
||||
<SelectContent>
|
||||
<SelectItem value="0">All Disciplines</SelectItem>
|
||||
{disciplines.map((d) => (
|
||||
<SelectItem key={d.id} value={d.id.toString()}>
|
||||
<SelectItem key={d.publicId} value={d.publicId.toString()}>
|
||||
{d.disciplineCode} - {d.codeNameEn || d.codeNameTh}
|
||||
</SelectItem>
|
||||
))}
|
||||
|
||||
@@ -158,7 +158,7 @@ export function TemplateTester({ open, onOpenChange, template }: TemplateTesterP
|
||||
<SelectContent>
|
||||
<SelectItem value="0">Default (All Types)</SelectItem>
|
||||
{(correspondenceTypes as CorrespondenceType[])?.map((type) => (
|
||||
<SelectItem key={type.id} value={type.id.toString()}>
|
||||
<SelectItem key={type.publicId} value={type.publicId.toString()}>
|
||||
{type.typeCode} - {type.typeName}
|
||||
</SelectItem>
|
||||
))}
|
||||
@@ -179,7 +179,7 @@ export function TemplateTester({ open, onOpenChange, template }: TemplateTesterP
|
||||
<SelectContent>
|
||||
<SelectItem value="0">None</SelectItem>
|
||||
{(disciplines as Discipline[])?.map((disc) => (
|
||||
<SelectItem key={disc.id} value={disc.id.toString()}>
|
||||
<SelectItem key={disc.publicId} value={disc.publicId.toString()}>
|
||||
{disc.disciplineCode}
|
||||
</SelectItem>
|
||||
))}
|
||||
|
||||
@@ -26,7 +26,7 @@ const rfaSchema = z.object({
|
||||
projectId: z.string().min(1, 'Project is required'), // ADR-019: UUID
|
||||
contractId: z.string().min(1, 'Contract is required'),
|
||||
disciplineId: z.number({ message: 'Discipline is required' }).min(1, 'Discipline is required'),
|
||||
rfaTypeId: z.number().min(1, 'Type is required'),
|
||||
rfaTypeId: z.string().min(1, 'Type is required'), // ADR-019: UUID
|
||||
subject: z.string().min(5, 'Subject must be at least 5 characters'),
|
||||
description: z.string().optional(),
|
||||
body: z.string().optional(),
|
||||
@@ -53,14 +53,16 @@ type ContractOption = {
|
||||
};
|
||||
|
||||
type DisciplineOption = {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT
|
||||
disciplineCode: string;
|
||||
codeNameEn?: string;
|
||||
codeNameTh?: string;
|
||||
};
|
||||
|
||||
type RfaTypeOption = {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT
|
||||
typeCode?: string;
|
||||
typeName?: string;
|
||||
typeNameEn?: string;
|
||||
@@ -68,7 +70,7 @@ type RfaTypeOption = {
|
||||
};
|
||||
|
||||
type CorrespondenceTypeOption = {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
typeCode?: string;
|
||||
typeName?: string;
|
||||
};
|
||||
@@ -164,7 +166,7 @@ export function RFAForm() {
|
||||
projectId: '',
|
||||
contractId: '',
|
||||
disciplineId: 0,
|
||||
rfaTypeId: 0,
|
||||
rfaTypeId: '',
|
||||
subject: '',
|
||||
description: '',
|
||||
body: '',
|
||||
@@ -185,13 +187,13 @@ export function RFAForm() {
|
||||
|
||||
const selectedContractId = watch('contractId');
|
||||
const { data: disciplinesData, isLoading: isLoadingDisciplines } = useDisciplines(selectedContractId);
|
||||
const disciplines = dedupeByKey(extractArrayData<DisciplineOption>(disciplinesData), (discipline) => discipline.id);
|
||||
const disciplines = dedupeByKey(extractArrayData<DisciplineOption>(disciplinesData), (discipline) => discipline.publicId);
|
||||
const { data: rfaTypesData, isLoading: isLoadingRfaTypes } = useRfaTypes(selectedContractId);
|
||||
const rfaTypes = dedupeByKey(extractArrayData<RfaTypeOption>(rfaTypesData), (rfaType) => rfaType.id);
|
||||
const rfaTypes = dedupeByKey(extractArrayData<RfaTypeOption>(rfaTypesData), (rfaType) => rfaType.publicId);
|
||||
const [shopDrawingSearch, setShopDrawingSearch] = useState('');
|
||||
const [shopDrawingPage, setShopDrawingPage] = useState(1);
|
||||
const { data: shopDrawingsData, isLoading: isLoadingShopDrawings } = useDrawings('SHOP', {
|
||||
projectPublicId: selectedProjectId || '',
|
||||
projectUuid: selectedProjectId || '',
|
||||
search: shopDrawingSearch,
|
||||
page: shopDrawingPage,
|
||||
limit: 10,
|
||||
@@ -204,7 +206,7 @@ export function RFAForm() {
|
||||
const [asBuiltDrawingSearch, setAsBuiltDrawingSearch] = useState('');
|
||||
const [asBuiltDrawingPage, setAsBuiltDrawingPage] = useState(1);
|
||||
const { data: asBuiltDrawingsData, isLoading: isLoadingAsBuiltDrawings } = useDrawings('AS_BUILT', {
|
||||
projectPublicId: selectedProjectId || '',
|
||||
projectUuid: selectedProjectId || '',
|
||||
search: asBuiltDrawingSearch,
|
||||
page: asBuiltDrawingPage,
|
||||
limit: 10,
|
||||
@@ -220,7 +222,7 @@ export function RFAForm() {
|
||||
const toOrganizationId = watch('toOrganizationId');
|
||||
const selectedShopDrawingRevisionIds = watch('shopDrawingRevisionIds') ?? [];
|
||||
const selectedAsBuiltDrawingRevisionIds = watch('asBuiltDrawingRevisionIds') ?? [];
|
||||
const selectedRfaType = rfaTypes.find((rfaType) => rfaType.id === rfaTypeId);
|
||||
const selectedRfaType = rfaTypes.find((rfaType) => rfaType.publicId === rfaTypeId);
|
||||
const selectedRfaTypeCode = selectedRfaType?.typeCode?.toUpperCase();
|
||||
const requiresShopDrawings = selectedRfaTypeCode === 'DDW' || selectedRfaTypeCode === 'SDW';
|
||||
const requiresAsBuiltDrawings = selectedRfaTypeCode === 'ADW';
|
||||
@@ -254,7 +256,7 @@ export function RFAForm() {
|
||||
const [preview, setPreview] = useState<{ number: string; isDefaultTemplate: boolean } | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedProjectId || !rfaCorrespondenceType?.id || !rfaTypeId || !disciplineId || !toOrganizationId) {
|
||||
if (!selectedProjectId || !rfaCorrespondenceType?.publicId || !rfaTypeId || !disciplineId || !toOrganizationId) {
|
||||
setPreview(null);
|
||||
return;
|
||||
}
|
||||
@@ -263,7 +265,7 @@ export function RFAForm() {
|
||||
try {
|
||||
const res = await correspondenceService.previewNumber({
|
||||
projectId: selectedProjectId,
|
||||
typeId: rfaCorrespondenceType.id,
|
||||
typeId: rfaCorrespondenceType.publicId,
|
||||
disciplineId,
|
||||
recipients: [{ organizationId: toOrganizationId, type: 'TO' }],
|
||||
subject: watch('subject') || 'Preview Subject',
|
||||
@@ -276,7 +278,7 @@ export function RFAForm() {
|
||||
|
||||
const timer = setTimeout(fetchPreview, 500);
|
||||
return () => clearTimeout(timer);
|
||||
}, [rfaTypeId, disciplineId, toOrganizationId, selectedProjectId, rfaCorrespondenceType?.id, watch]);
|
||||
}, [rfaTypeId, disciplineId, toOrganizationId, selectedProjectId, rfaCorrespondenceType?.publicId, watch]);
|
||||
|
||||
const onSubmit = (data: RFAFormData) => {
|
||||
if (requiresShopDrawings && data.shopDrawingRevisionIds?.length === 0) {
|
||||
@@ -365,7 +367,7 @@ export function RFAForm() {
|
||||
setValue('projectId', val);
|
||||
setValue('contractId', '');
|
||||
setValue('disciplineId', 0);
|
||||
setValue('rfaTypeId', 0);
|
||||
setValue('rfaTypeId', '');
|
||||
setValue('shopDrawingRevisionIds', []);
|
||||
setValue('asBuiltDrawingRevisionIds', []);
|
||||
}}
|
||||
@@ -441,7 +443,7 @@ export function RFAForm() {
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{disciplines.map((d) => (
|
||||
<SelectItem key={d.id} value={String(d.id)}>
|
||||
<SelectItem key={d.publicId} value={String(d.publicId)}>
|
||||
{`${d.codeNameEn || d.codeNameTh || d.disciplineCode} (${d.disciplineCode})`}
|
||||
</SelectItem>
|
||||
))}
|
||||
@@ -460,9 +462,9 @@ export function RFAForm() {
|
||||
<div>
|
||||
<Label>RFA Type *</Label>
|
||||
<Select
|
||||
value={rfaTypeId > 0 ? String(rfaTypeId) : undefined}
|
||||
value={rfaTypeId || undefined}
|
||||
onValueChange={(val) => {
|
||||
setValue('rfaTypeId', Number(val));
|
||||
setValue('rfaTypeId', val);
|
||||
setValue('shopDrawingRevisionIds', []);
|
||||
setValue('asBuiltDrawingRevisionIds', []);
|
||||
}}
|
||||
@@ -473,7 +475,7 @@ export function RFAForm() {
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{rfaTypes.map((rfaType) => (
|
||||
<SelectItem key={rfaType.id} value={String(rfaType.id)}>
|
||||
<SelectItem key={rfaType.publicId} value={String(rfaType.publicId)}>
|
||||
{`${rfaType.typeCode || 'RFA'} - ${rfaType.typeName || rfaType.typeNameEn || rfaType.typeNameTh || 'Unnamed Type'}`}
|
||||
</SelectItem>
|
||||
))}
|
||||
|
||||
@@ -141,7 +141,7 @@ export function useAddTag() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ uuid, tagId }: { uuid: string; tagId: number }) =>
|
||||
mutationFn: ({ uuid, tagId }: { uuid: string; tagId: number | string }) =>
|
||||
correspondenceService.addTag(uuid, tagId),
|
||||
onSuccess: (_, { uuid }) => {
|
||||
toast.success('Tag added');
|
||||
@@ -159,7 +159,7 @@ export function useRemoveTag() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ uuid, tagId }: { uuid: string; tagId: number }) =>
|
||||
mutationFn: ({ uuid, tagId }: { uuid: string; tagId: number | string }) =>
|
||||
correspondenceService.removeTag(uuid, tagId),
|
||||
onSuccess: (_, { uuid }) => {
|
||||
toast.success('Tag removed');
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
export interface Role {
|
||||
roleId: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
roleId?: number; // Internal INT (excluded from API)
|
||||
roleName: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
userId: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
userId?: number; // Internal INT (excluded from API)
|
||||
username: string;
|
||||
email: string;
|
||||
firstName: string;
|
||||
@@ -25,7 +27,8 @@ export interface CreateUserDto {
|
||||
}
|
||||
|
||||
export interface Organization {
|
||||
orgId: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
orgId?: number; // Internal INT (excluded from API)
|
||||
orgCode: string;
|
||||
orgName: string;
|
||||
orgNameTh?: string;
|
||||
@@ -33,7 +36,8 @@ export interface Organization {
|
||||
}
|
||||
|
||||
export interface AuditLog {
|
||||
auditLogId: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
auditLogId?: number; // Internal INT (excluded from API)
|
||||
userName: string;
|
||||
action: string;
|
||||
entityType: string;
|
||||
|
||||
@@ -4,14 +4,14 @@ export interface CreateCorrespondenceDto {
|
||||
/** ID or UUID ของโครงการ */
|
||||
projectId: number | string;
|
||||
|
||||
/** ID ของประเภทเอกสาร (เช่น RFA, LETTER) */
|
||||
typeId: number;
|
||||
/** ID ของประเภทเอกสาร (เช่น RFA, LETTER) - ADR-019: Accept UUID */
|
||||
typeId: number | string;
|
||||
|
||||
/** [Req 6B] สาขางาน (เช่น GEN, STR) */
|
||||
disciplineId?: number;
|
||||
/** [Req 6B] สาขางาน (เช่น GEN, STR) - ADR-019: Accept UUID */
|
||||
disciplineId?: number | string;
|
||||
|
||||
/** [Req 6B] ประเภทย่อย (เช่น MAT, SHP สำหรับ Transmittal/RFA) */
|
||||
subTypeId?: number;
|
||||
/** [Req 6B] ประเภทย่อย (เช่น MAT, SHP สำหรับ Transmittal/RFA) - ADR-019: Accept UUID */
|
||||
subTypeId?: number | string;
|
||||
|
||||
/** หัวข้อเอกสาร */
|
||||
subject: string;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
export interface SearchCorrespondenceDto {
|
||||
search?: string; // ค้นหาจาก Title หรือ Number
|
||||
typeId?: number; // กรองตามประเภทเอกสาร
|
||||
projectId?: number; // กรองตามโครงการ
|
||||
statusId?: number; // กรองตามสถานะ (จาก Revision ปัจจุบัน)
|
||||
typeId?: number | string; // ADR-019: Accept UUID - กรองตามประเภทเอกสาร
|
||||
projectId?: number | string; // ADR-019: Accept UUID - กรองตามโครงการ
|
||||
statusId?: number | string; // ADR-019: Accept UUID - กรองตามสถานะ (จาก Revision ปัจจุบัน)
|
||||
status?: string; // กรองตามสถานะ code string (เช่น DRAFT, IN_REVIEW)
|
||||
revisionStatus?: 'CURRENT' | 'ALL' | 'OLD'; // กรองตามสถานะ Revision
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
// --- Create New As Built Drawing ---
|
||||
export interface CreateAsBuiltDrawingDto {
|
||||
projectId: number;
|
||||
projectId: number | string; // ADR-019: Accept UUID
|
||||
drawingNumber: string;
|
||||
mainCategoryId: number;
|
||||
subCategoryId: number;
|
||||
mainCategoryId: number | string; // ADR-019: Accept UUID
|
||||
subCategoryId: number | string; // ADR-019: Accept UUID
|
||||
|
||||
// First Revision Data
|
||||
revisionLabel?: string;
|
||||
@@ -14,8 +14,8 @@ export interface CreateAsBuiltDrawingDto {
|
||||
revisionDate?: string; // ISO Date String
|
||||
description?: string;
|
||||
|
||||
shopDrawingRevisionIds?: number[]; // Reference to Shop Drawing Revisions
|
||||
attachmentIds?: number[];
|
||||
shopDrawingRevisionIds?: (number | string)[]; // ADR-019: Accept UUID - Reference to Shop Drawing Revisions
|
||||
attachmentIds?: (number | string)[]; // ADR-019: Accept UUID
|
||||
}
|
||||
|
||||
// --- Create New Revision ---
|
||||
@@ -26,8 +26,8 @@ export interface CreateAsBuiltDrawingRevisionDto {
|
||||
revisionDate?: string;
|
||||
description?: string;
|
||||
|
||||
shopDrawingRevisionIds?: number[];
|
||||
attachmentIds?: number[];
|
||||
shopDrawingRevisionIds?: (number | string)[]; // ADR-019: Accept UUID
|
||||
attachmentIds?: (number | string)[]; // ADR-019: Accept UUID
|
||||
}
|
||||
|
||||
// --- Search ---
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
// --- Create ---
|
||||
export interface CreateContractDrawingDto {
|
||||
/** ID ของโครงการ */
|
||||
projectId: number;
|
||||
/** ID ของโครงการ - ADR-019: Accept UUID */
|
||||
projectId: number | string;
|
||||
|
||||
/** เลขที่แบบสัญญา */
|
||||
contractDrawingNo: string;
|
||||
@@ -11,17 +11,17 @@ export interface CreateContractDrawingDto {
|
||||
/** ชื่อแบบ */
|
||||
title: string;
|
||||
|
||||
/** ID หมวดหมู่ย่อย (Mapping) */
|
||||
mapCatId?: number;
|
||||
/** ID หมวดหมู่ย่อย (Mapping) - ADR-019: Accept UUID */
|
||||
mapCatId?: number | string;
|
||||
|
||||
/** ID เล่มของแบบ */
|
||||
volumeId?: number;
|
||||
/** ID เล่มของแบบ - ADR-019: Accept UUID */
|
||||
volumeId?: number | string;
|
||||
|
||||
/** เลขหน้าในเล่ม */
|
||||
volumePage?: number;
|
||||
|
||||
/** รายการ ID ของไฟล์แนบ (PDF/DWG) */
|
||||
attachmentIds?: number[];
|
||||
/** รายการ ID ของไฟล์แนบ (PDF/DWG) - ADR-019: Accept UUID */
|
||||
attachmentIds?: (number | string)[];
|
||||
}
|
||||
|
||||
// --- Update (Partial) ---
|
||||
@@ -32,8 +32,8 @@ export interface SearchContractDrawingDto {
|
||||
/** จำเป็นต้องระบุ Project UUID เสมอ */
|
||||
projectUuid: string;
|
||||
|
||||
volumeId?: number;
|
||||
mapCatId?: number;
|
||||
volumeId?: number | string; // ADR-019: Accept UUID
|
||||
mapCatId?: number | string; // ADR-019: Accept UUID
|
||||
search?: string; // ค้นหาจาก Title หรือ Number
|
||||
|
||||
page?: number; // Default: 1
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
// --- Create New Shop Drawing ---
|
||||
export interface CreateShopDrawingDto {
|
||||
projectId: number;
|
||||
projectId: number | string; // ADR-019: Accept UUID
|
||||
drawingNumber: string;
|
||||
title: string;
|
||||
mainCategoryId: number;
|
||||
subCategoryId: number;
|
||||
mainCategoryId: number | string; // ADR-019: Accept UUID
|
||||
subCategoryId: number | string; // ADR-019: Accept UUID
|
||||
|
||||
// First Revision Data (Optional)
|
||||
revisionLabel?: string;
|
||||
revisionDate?: string; // ISO Date String
|
||||
description?: string;
|
||||
legacyDrawingNumber?: string; // Legacy number for the first revision
|
||||
contractDrawingIds?: number[]; // อ้างอิงแบบสัญญา
|
||||
attachmentIds?: number[];
|
||||
contractDrawingIds?: (number | string)[]; // ADR-019: Accept UUID - อ้างอิงแบบสัญญา
|
||||
attachmentIds?: (number | string)[]; // ADR-019: Accept UUID
|
||||
}
|
||||
|
||||
// --- Create New Revision ---
|
||||
@@ -24,15 +24,15 @@ export interface CreateShopDrawingRevisionDto {
|
||||
legacyDrawingNumber?: string;
|
||||
revisionDate?: string;
|
||||
description?: string;
|
||||
contractDrawingIds?: number[];
|
||||
attachmentIds?: number[];
|
||||
contractDrawingIds?: (number | string)[]; // ADR-019: Accept UUID
|
||||
attachmentIds?: (number | string)[]; // ADR-019: Accept UUID
|
||||
}
|
||||
|
||||
// --- Search ---
|
||||
export interface SearchShopDrawingDto {
|
||||
projectUuid: string;
|
||||
mainCategoryId?: number;
|
||||
subCategoryId?: number;
|
||||
mainCategoryId?: number | string; // ADR-019: Accept UUID
|
||||
subCategoryId?: number | string; // ADR-019: Accept UUID
|
||||
search?: string;
|
||||
|
||||
page?: number; // Default: 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// File: src/types/dto/master/discipline.dto.ts
|
||||
|
||||
export interface CreateDisciplineDto {
|
||||
contractId: number;
|
||||
contractId: number | string; // ADR-019: Accept UUID
|
||||
|
||||
/** รหัสสาขา (เช่น 'STR', 'ARC') */
|
||||
disciplineCode: string;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// File: src/types/dto/master/tag.dto.ts
|
||||
|
||||
export interface CreateTagDto {
|
||||
/** ID โครงการ (NULL = Global) */
|
||||
projectId?: number | null;
|
||||
/** ID โครงการ (NULL = Global) - ADR-019: Accept UUID */
|
||||
projectId?: number | string | null;
|
||||
|
||||
/** ชื่อ Tag (เช่น 'URGENT') */
|
||||
tagName: string;
|
||||
@@ -17,8 +17,8 @@ export interface CreateTagDto {
|
||||
export type UpdateTagDto = Partial<CreateTagDto>;
|
||||
|
||||
export interface SearchTagDto {
|
||||
/** ID โครงการ (ใช้กรอง Tag ของแต่ละโปรเจกต์) */
|
||||
projectId?: number;
|
||||
/** ID โครงการ (ใช้กรอง Tag ของแต่ละโปรเจกต์) - ADR-019: Accept UUID */
|
||||
projectId?: number | string;
|
||||
|
||||
/** คำค้นหา (ชื่อ Tag หรือ คำอธิบาย) */
|
||||
search?: string;
|
||||
|
||||
@@ -8,7 +8,8 @@ export interface AuditErrorRecord {
|
||||
}
|
||||
|
||||
export interface NumberingAuditLog {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
documentNumber: string;
|
||||
operation: string;
|
||||
status: string;
|
||||
@@ -22,13 +23,13 @@ export interface NumberingMetrics {
|
||||
}
|
||||
|
||||
export interface ManualOverrideDto {
|
||||
projectId: number;
|
||||
originatorOrganizationId: number;
|
||||
recipientOrganizationId: number;
|
||||
correspondenceTypeId: number;
|
||||
subTypeId?: number;
|
||||
rfaTypeId?: number;
|
||||
disciplineId?: number;
|
||||
projectId: number | string; // ADR-019: Accept UUID
|
||||
originatorOrganizationId: number | string; // ADR-019: Accept UUID
|
||||
recipientOrganizationId: number | string; // ADR-019: Accept UUID
|
||||
correspondenceTypeId: number | string; // ADR-019: Accept UUID
|
||||
subTypeId?: number | string; // ADR-019: Accept UUID
|
||||
rfaTypeId?: number | string; // ADR-019: Accept UUID
|
||||
disciplineId?: number | string; // ADR-019: Accept UUID
|
||||
resetScope: string;
|
||||
newLastNumber: number;
|
||||
reason: string;
|
||||
@@ -38,16 +39,16 @@ export interface VoidReplaceDto {
|
||||
documentNumber: string;
|
||||
reason: string;
|
||||
replace: boolean;
|
||||
projectId: number;
|
||||
projectId: number | string; // ADR-019: Accept UUID
|
||||
}
|
||||
|
||||
export interface CancelNumberDto {
|
||||
documentNumber: string;
|
||||
reason: string;
|
||||
projectId?: number;
|
||||
projectId?: number | string; // ADR-019: Accept UUID
|
||||
}
|
||||
|
||||
export interface AuditQueryParams {
|
||||
projectId?: number;
|
||||
projectId?: number | string; // ADR-019: Accept UUID
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
export interface CreateOrganizationDto {
|
||||
organizationCode: string;
|
||||
organizationName: string;
|
||||
roleId?: number;
|
||||
roleId?: number | string; // ADR-019: Accept UUID
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
export interface UpdateOrganizationDto {
|
||||
organizationCode?: string;
|
||||
organizationName?: string;
|
||||
roleId?: number;
|
||||
roleId?: number | string; // ADR-019: Accept UUID
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
export interface SearchOrganizationDto {
|
||||
search?: string;
|
||||
projectId?: number;
|
||||
projectId?: number | string; // ADR-019: Accept UUID
|
||||
page?: number;
|
||||
limit?: number;
|
||||
isActive?: boolean;
|
||||
|
||||
@@ -5,11 +5,11 @@ export interface CreateRfaDto {
|
||||
/** ID or UUID ของโครงการ */
|
||||
projectId: number | string; // ADR-019: Accept UUID
|
||||
|
||||
/** ประเภท RFA (เช่น DWG, MAT) */
|
||||
rfaTypeId: number;
|
||||
/** ประเภท RFA (เช่น DWG, MAT) - ADR-019: Accept UUID */
|
||||
rfaTypeId: number | string;
|
||||
|
||||
/** [Req 6B] สาขางาน (จำเป็นสำหรับการรันเลข RFA) */
|
||||
disciplineId?: number;
|
||||
/** [Req 6B] สาขางาน (จำเป็นสำหรับการรันเลข RFA) - ADR-019: Accept UUID */
|
||||
disciplineId?: number | string;
|
||||
|
||||
/** หัวข้อเรื่อง */
|
||||
subject: string;
|
||||
@@ -50,11 +50,11 @@ export interface SearchRfaDto {
|
||||
/** Filter by Project ID or UUID (optional to allow cross-project search) */
|
||||
projectId?: number | string; // ADR-019: Accept UUID
|
||||
|
||||
/** กรองตามประเภท RFA */
|
||||
rfaTypeId?: number;
|
||||
/** กรองตามประเภท RFA - ADR-019: Accept UUID */
|
||||
rfaTypeId?: number | string;
|
||||
|
||||
/** กรองตามสถานะ (เช่น Draft, For Approve) */
|
||||
statusId?: number;
|
||||
/** กรองตามสถานะ (เช่น Draft, For Approve) - ADR-019: Accept UUID */
|
||||
statusId?: number | string;
|
||||
|
||||
/** กรองตามสถานะ code โดยตรง (เช่น 'DFT', 'FAP', 'FRE') */
|
||||
statusCode?: string;
|
||||
|
||||
@@ -20,7 +20,7 @@ export interface CreateTransmittalDto {
|
||||
|
||||
export interface CreateTransmittalItemDto {
|
||||
itemType: string;
|
||||
itemId: number;
|
||||
itemId: number | string; // ADR-019: Accept UUID
|
||||
description?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@ export type UpdateUserDto = Partial<CreateUserDto>;
|
||||
|
||||
// --- Assign Role ---
|
||||
export interface AssignRoleDto {
|
||||
userId: number;
|
||||
roleId: number;
|
||||
userId: number | string; // ADR-019: Accept UUID
|
||||
roleId: number | string; // ADR-019: Accept UUID
|
||||
|
||||
// Scope (Optional)
|
||||
organizationId?: number;
|
||||
projectId?: number;
|
||||
contractId?: number;
|
||||
// Scope (Optional) - ADR-019: Accept UUID
|
||||
organizationId?: number | string;
|
||||
projectId?: number | string;
|
||||
contractId?: number | string;
|
||||
}
|
||||
|
||||
// --- Update Preferences ---
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
*/
|
||||
|
||||
export interface CorrespondenceType {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
typeCode: string;
|
||||
typeName: string;
|
||||
isActive: boolean;
|
||||
@@ -11,7 +12,8 @@ export interface CorrespondenceType {
|
||||
}
|
||||
|
||||
export interface Discipline {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
disciplineCode: string;
|
||||
codeNameEn: string;
|
||||
codeNameTh?: string;
|
||||
@@ -21,11 +23,12 @@ export interface Discipline {
|
||||
contractCode: string;
|
||||
contractName: string;
|
||||
};
|
||||
contractId?: number | string;
|
||||
contractId?: number | string; // ADR-019: Accept UUID
|
||||
}
|
||||
|
||||
export interface RfaType {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
typeCode: string;
|
||||
typeNameTh: string;
|
||||
typeNameEn?: string;
|
||||
@@ -36,25 +39,28 @@ export interface RfaType {
|
||||
contractCode: string;
|
||||
contractName: string;
|
||||
};
|
||||
contractId?: number | string;
|
||||
contractId?: number | string; // ADR-019: Accept UUID
|
||||
}
|
||||
|
||||
export interface Tag {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
tagName: string;
|
||||
colorCode?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface DrawingCategory {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
subTypeCode: string;
|
||||
subTypeName: string;
|
||||
subTypeNumber?: string;
|
||||
}
|
||||
|
||||
export interface ShopMainCategory {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
mainCategoryCode: string;
|
||||
mainCategoryName: string;
|
||||
name?: string; // Fallback for legacy data
|
||||
@@ -62,7 +68,8 @@ export interface ShopMainCategory {
|
||||
}
|
||||
|
||||
export interface ShopSubCategory {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
subCategoryCode: string;
|
||||
subCategoryName: string;
|
||||
name?: string; // Fallback for legacy data
|
||||
@@ -70,7 +77,8 @@ export interface ShopSubCategory {
|
||||
}
|
||||
|
||||
export interface ContractDrawingCategory {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
catCode: string;
|
||||
catName: string;
|
||||
name?: string; // Fallback for legacy data
|
||||
|
||||
@@ -5,7 +5,8 @@ export enum MigrationReviewStatus {
|
||||
}
|
||||
|
||||
export interface MigrationReviewQueueItem {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
documentNumber: string;
|
||||
title?: string;
|
||||
originalTitle?: string;
|
||||
@@ -17,15 +18,15 @@ export interface MigrationReviewQueueItem {
|
||||
reviewedBy?: string;
|
||||
reviewedAt?: string;
|
||||
createdAt: string;
|
||||
projectId?: number;
|
||||
senderOrganizationId?: number;
|
||||
receiverOrganizationId?: number;
|
||||
projectId?: number | string; // ADR-019: Accept UUID
|
||||
senderOrganizationId?: number | string; // ADR-019: Accept UUID
|
||||
receiverOrganizationId?: number | string; // ADR-019: Accept UUID
|
||||
receivedDate?: string;
|
||||
issuedDate?: string;
|
||||
remarks?: string;
|
||||
aiSummary?: string;
|
||||
extractedTags?: Record<string, unknown>;
|
||||
tempAttachmentId?: number;
|
||||
tempAttachmentId?: number | string; // ADR-019: Accept UUID
|
||||
}
|
||||
|
||||
export interface CommitBatchItemDto {
|
||||
@@ -48,7 +49,8 @@ export enum MigrationErrorType {
|
||||
}
|
||||
|
||||
export interface MigrationErrorItem {
|
||||
id: number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
id?: number; // Internal INT (excluded from API)
|
||||
batchId?: string;
|
||||
documentNumber?: string;
|
||||
errorType?: MigrationErrorType;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
export type WorkflowType = 'CORRESPONDENCE' | 'RFA' | 'DRAWING';
|
||||
|
||||
export interface WorkflowStep {
|
||||
stepId?: string;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
stepId?: string; // Internal ID (excluded from API)
|
||||
stepName: string;
|
||||
stepType: 'APPROVAL' | 'REVIEW' | 'ENDORSEMENT';
|
||||
approverRoleId?: number;
|
||||
@@ -11,7 +12,8 @@ export interface WorkflowStep {
|
||||
}
|
||||
|
||||
export interface Workflow {
|
||||
workflowId: string | number;
|
||||
publicId: string; // ADR-019: public identifier
|
||||
workflowId?: string | number; // Internal ID (excluded from API)
|
||||
workflowName: string;
|
||||
description: string;
|
||||
workflowType: WorkflowType;
|
||||
|
||||
Reference in New Issue
Block a user