feat: cloud storage updates, claims storage, appointment and insurance routes
This commit is contained in:
@@ -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 } });
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user