feat: cloud storage updates, claims storage, appointment and insurance routes

This commit is contained in:
Gitead
2026-04-27 00:29:11 -04:00
parent 3e899376c3
commit da7038e051
8 changed files with 138 additions and 95 deletions

View File

@@ -9,6 +9,7 @@ import { prisma as db } from "@repo/db/client";
export interface IStorage {
getClaim(id: number): Promise<Claim | undefined>;
getActiveClaimByAppointmentId(appointmentId: number): Promise<ClaimWithServiceLines | null>;
getRecentClaimsByPatientId(
patientId: number,
limit: number,
@@ -54,6 +55,17 @@ export const claimsStorage: IStorage = {
});
},
async getActiveClaimByAppointmentId(appointmentId: number): Promise<ClaimWithServiceLines | null> {
return db.claim.findFirst({
where: {
appointmentId,
status: { notIn: ["CANCELLED", "VOID"] },
},
orderBy: { createdAt: "desc" },
include: { serviceLines: true, claimFiles: true, staff: true },
}) as Promise<ClaimWithServiceLines | null>;
},
async getClaimsByAppointmentId(appointmentId: number): Promise<Claim[]> {
return await db.claim.findMany({ where: { appointmentId } });
},