feature: treatment frontend wired with the newly implemented backend. no mocked data no more.
This commit is contained in:
@@ -22,7 +22,10 @@ const treatmentInclude = {
|
||||
orderBy: [{ sortOrder: 'asc' as const }],
|
||||
include: {
|
||||
attachments: { orderBy: [{ createdAt: 'asc' as const }] },
|
||||
sends: { orderBy: [{ sentAt: 'asc' as const }] },
|
||||
sends: {
|
||||
orderBy: [{ sentAt: 'asc' as const }],
|
||||
include: { organization: { select: { id: true, name: true } } },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -332,7 +335,10 @@ export class TreatmentsService {
|
||||
where: { id: caseId },
|
||||
include: {
|
||||
attachments: { orderBy: [{ createdAt: 'asc' }] },
|
||||
sends: { orderBy: [{ sentAt: 'asc' }] },
|
||||
sends: {
|
||||
orderBy: [{ sentAt: 'asc' }],
|
||||
include: { organization: { select: { id: true, name: true } } },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -459,7 +465,7 @@ export class TreatmentsService {
|
||||
mimeType: string;
|
||||
sizeBytes: number;
|
||||
}>;
|
||||
sends: Array<{ organizationId: string; sentAt: Date }>;
|
||||
sends: Array<{ organizationId: string; sentAt: Date; organization: { id: string; name: string } }>;
|
||||
}>;
|
||||
}) {
|
||||
const documents = treatment.cases.flatMap((c) =>
|
||||
@@ -491,7 +497,7 @@ export class TreatmentsService {
|
||||
mimeType: string;
|
||||
sizeBytes: number;
|
||||
}>;
|
||||
sends?: Array<{ organizationId: string; sentAt: Date }>;
|
||||
sends?: Array<{ organizationId: string; sentAt: Date; organization?: { id: string; name: string } }>;
|
||||
}) {
|
||||
return {
|
||||
id: c.id,
|
||||
@@ -501,6 +507,12 @@ export class TreatmentsService {
|
||||
notes: c.comment ?? null,
|
||||
sentAt: c.sentAt?.toISOString() ?? null,
|
||||
sendToOrganizationIds: c.sends?.map((s) => s.organizationId) ?? [],
|
||||
sends:
|
||||
c.sends?.map((s) => ({
|
||||
organizationId: s.organizationId,
|
||||
organizationName: s.organization?.name ?? 'Unknown organization',
|
||||
sentAt: s.sentAt.toISOString(),
|
||||
})) ?? [],
|
||||
attachmentMetas: (c.attachments ?? []).map((a) => this.mapAttachment(a)),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user