260326:1634 Fixing Refactor ADR-019 Naming convention uuid #05
This commit is contained in:
@@ -59,7 +59,7 @@ export default function OrganizationsPage() {
|
||||
|
||||
const confirmDelete = () => {
|
||||
if (orgToDelete) {
|
||||
deleteOrg.mutate(orgToDelete.uuid, {
|
||||
deleteOrg.mutate(orgToDelete.publicId, {
|
||||
onSuccess: () => {
|
||||
setDeleteDialogOpen(false);
|
||||
setOrgToDelete(null);
|
||||
|
||||
@@ -66,7 +66,7 @@ export default function UsersPage() {
|
||||
|
||||
const confirmDelete = () => {
|
||||
if (userToDelete) {
|
||||
deleteMutation.mutate(userToDelete.uuid, {
|
||||
deleteMutation.mutate(userToDelete.publicId, {
|
||||
onSuccess: () => {
|
||||
setDeleteDialogOpen(false);
|
||||
setUserToDelete(null);
|
||||
@@ -100,7 +100,7 @@ export default function UsersPage() {
|
||||
}
|
||||
|
||||
const org = organizationList.find(
|
||||
(o) => (o.id ?? o.uuid) === orgId?.toString() || o.uuid === orgId?.toString()
|
||||
(o) => (o.id ?? o.publicId) === orgId?.toString() || o.publicId === orgId?.toString()
|
||||
);
|
||||
return org ? org.organizationCode : 'All Organizations';
|
||||
},
|
||||
@@ -197,7 +197,7 @@ export default function UsersPage() {
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All Organizations</SelectItem>
|
||||
{organizationList.map((org) => (
|
||||
<SelectItem key={org.uuid} value={org.uuid}>
|
||||
<SelectItem key={org.publicId} value={org.publicId}>
|
||||
{org.organizationCode} - {org.organizationName}
|
||||
</SelectItem>
|
||||
))}
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function NumberingPage() {
|
||||
useEffect(() => {
|
||||
if (projects.length > 0 && !selectedProjectId) {
|
||||
const first = projects[0] as ProjectItem;
|
||||
setSelectedProjectId(String(first.uuid ?? first.id));
|
||||
setSelectedProjectId(String(first.publicId ?? first.id));
|
||||
}
|
||||
}, [projects, selectedProjectId]);
|
||||
|
||||
@@ -48,14 +48,14 @@ export default function NumberingPage() {
|
||||
const [isTesting, setIsTesting] = useState(false);
|
||||
const [testTemplate, setTestTemplate] = useState<NumberingTemplate | null>(null);
|
||||
|
||||
const selectedProject = (projects as ProjectItem[]).find((p) => String(p.uuid ?? p.id) === selectedProjectId);
|
||||
const selectedProject = (projects as ProjectItem[]).find((p) => String(p.publicId ?? p.id) === selectedProjectId);
|
||||
const selectedProjectName = selectedProject?.projectName || 'Unknown Project';
|
||||
|
||||
// Master Data
|
||||
const { data: correspondenceTypes = [] } = useCorrespondenceTypes();
|
||||
const { data: contracts = [] } = useContracts(selectedProjectId);
|
||||
const firstContract = contracts[0] as { id?: number; uuid?: string } | undefined;
|
||||
const contractId = firstContract?.uuid ?? firstContract?.id;
|
||||
const contractId = firstContract?.publicId ?? firstContract?.id;
|
||||
const { data: disciplines = [] } = useDisciplines(contractId);
|
||||
|
||||
const { data: templateResponse, isLoading: _isLoadingTemplates } = useTemplates();
|
||||
@@ -116,7 +116,7 @@ export default function NumberingPage() {
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{(projects as ProjectItem[]).map((project) => (
|
||||
<SelectItem key={String(project.uuid ?? project.id)} value={String(project.uuid ?? project.id)}>
|
||||
<SelectItem key={String(project.publicId ?? project.id)} value={String(project.publicId ?? project.id)}>
|
||||
{project.projectCode} - {project.projectName}
|
||||
</SelectItem>
|
||||
))}
|
||||
@@ -147,8 +147,8 @@ export default function NumberingPage() {
|
||||
.filter(
|
||||
(t) =>
|
||||
!t.projectId ||
|
||||
String(t.project?.id ?? t.project?.uuid) === selectedProjectId ||
|
||||
t.project?.uuid === selectedProjectId
|
||||
String(t.project?.id ?? t.project?.publicId) === selectedProjectId ||
|
||||
t.project?.publicId === selectedProjectId
|
||||
)
|
||||
.map((template) => (
|
||||
<Card key={template.id} className="p-6 hover:shadow-md transition-shadow">
|
||||
|
||||
@@ -71,7 +71,7 @@ export default function CreateCirculationPage() {
|
||||
mutationFn: (data: CreateCirculationDto) => circulationService.create(data),
|
||||
onSuccess: (result) => {
|
||||
toast.success('Circulation created successfully');
|
||||
router.push(`/circulation/${result.uuid}`);
|
||||
router.push(`/circulation/${result.publicId}`);
|
||||
},
|
||||
onError: () => {
|
||||
toast.error('Failed to create circulation');
|
||||
@@ -85,7 +85,7 @@ export default function CreateCirculationPage() {
|
||||
const selectedAssignees = form.watch('assigneeIds');
|
||||
const selectedDocId = form.watch('correspondenceId');
|
||||
|
||||
const selectedDoc = correspondences?.data?.find((c: { uuid: string }) => c.uuid === selectedDocId);
|
||||
const selectedDoc = correspondences?.data?.find((c: { publicId: string }) => c.publicId === selectedDocId);
|
||||
|
||||
const toggleAssignee = (userUuid: string) => {
|
||||
const current = form.getValues('assigneeIds');
|
||||
@@ -147,19 +147,19 @@ export default function CreateCirculationPage() {
|
||||
<CommandList>
|
||||
<CommandEmpty>No document found.</CommandEmpty>
|
||||
<CommandGroup>
|
||||
{correspondences?.data?.map((doc: { uuid: string; correspondenceNumber: string }) => (
|
||||
{correspondences?.data?.map((doc: { publicId: string; correspondenceNumber: string }) => (
|
||||
<CommandItem
|
||||
key={doc.uuid}
|
||||
key={doc.publicId}
|
||||
value={doc.correspondenceNumber}
|
||||
onSelect={() => {
|
||||
form.setValue('correspondenceId', doc.uuid);
|
||||
form.setValue('correspondenceId', doc.publicId);
|
||||
setDocOpen(false);
|
||||
}}
|
||||
>
|
||||
<Check
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
doc.uuid === field.value ? 'opacity-100' : 'opacity-0'
|
||||
doc.publicId === field.value ? 'opacity-100' : 'opacity-0'
|
||||
)}
|
||||
/>
|
||||
{doc.correspondenceNumber}
|
||||
@@ -204,7 +204,7 @@ export default function CreateCirculationPage() {
|
||||
{selectedAssignees.length > 0 ? (
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{selectedAssignees.map((userUuid) => {
|
||||
const user = users.find((u) => u.uuid === userUuid);
|
||||
const user = users.find((u) => u.publicId === userUuid);
|
||||
return user ? (
|
||||
<Badge key={userUuid} variant="secondary" className="mr-1">
|
||||
{user.firstName || user.username}
|
||||
@@ -234,14 +234,14 @@ export default function CreateCirculationPage() {
|
||||
<CommandGroup>
|
||||
{users.map((user) => (
|
||||
<CommandItem
|
||||
key={user.uuid}
|
||||
key={user.publicId}
|
||||
value={user.username}
|
||||
onSelect={() => toggleAssignee(user.uuid)}
|
||||
onSelect={() => toggleAssignee(user.publicId)}
|
||||
>
|
||||
<Check
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
selectedAssignees.includes(user.uuid) ? 'opacity-100' : 'opacity-0'
|
||||
selectedAssignees.includes(user.publicId) ? 'opacity-100' : 'opacity-0'
|
||||
)}
|
||||
/>
|
||||
{user.firstName && user.lastName
|
||||
|
||||
Reference in New Issue
Block a user