route added
This commit is contained in:
@@ -199,18 +199,19 @@ enum PdfCategory {
|
||||
}
|
||||
|
||||
model Payment {
|
||||
id Int @id @default(autoincrement())
|
||||
claimId Int @unique
|
||||
patientId Int
|
||||
userId Int
|
||||
updatedById Int?
|
||||
totalBilled Decimal @db.Decimal(10, 2)
|
||||
totalPaid Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
totalDue Decimal @db.Decimal(10, 2)
|
||||
status PaymentStatus @default(PENDING)
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id Int @id @default(autoincrement())
|
||||
claimId Int @unique
|
||||
patientId Int
|
||||
userId Int
|
||||
updatedById Int?
|
||||
totalBilled Decimal @db.Decimal(10, 2)
|
||||
totalPaid Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
totalDue Decimal @db.Decimal(10, 2)
|
||||
status PaymentStatus @default(PENDING)
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@ -60,14 +60,6 @@ export const updatePaymentSchema = (
|
||||
.partial();
|
||||
export type UpdatePayment = z.infer<typeof updatePaymentSchema>;
|
||||
|
||||
// Input for updating a payment with new transactions + updated service payments
|
||||
export type UpdatePaymentInput = {
|
||||
newTransactions: ServiceLineTransactionInput[];
|
||||
totalPaid: Decimal;
|
||||
totalDue: Decimal;
|
||||
status: PaymentStatus;
|
||||
};
|
||||
|
||||
// ========== EXTENDED TYPES ==========
|
||||
|
||||
// Payment with full nested data
|
||||
@@ -91,18 +83,21 @@ export type PaymentWithExtras = Prisma.PaymentGetPayload<{
|
||||
paymentMethod: string;
|
||||
};
|
||||
|
||||
export const newTransactionPayloadSchema = z.object({
|
||||
paymentId: z.number(),
|
||||
status: PaymentStatusSchema,
|
||||
serviceLineTransactions: z.array(
|
||||
z.object({
|
||||
serviceLineId: z.number(),
|
||||
transactionId: z.string().optional(),
|
||||
paidAmount: z.number(),
|
||||
adjustedAmount: z.number().optional(),
|
||||
method: PaymentMethodSchema,
|
||||
receivedDate: z.coerce.date(),
|
||||
payerName: z.string().optional(),
|
||||
notes: z.string().optional(),
|
||||
})
|
||||
),
|
||||
});
|
||||
|
||||
export type NewTransactionPayload = {
|
||||
paymentId: number;
|
||||
status: PaymentStatus;
|
||||
serviceLineTransactions: {
|
||||
serviceLineId: number;
|
||||
transactionId?: string;
|
||||
paidAmount: number;
|
||||
adjustedAmount?: number;
|
||||
method: PaymentMethod;
|
||||
receivedDate: Date;
|
||||
payerName?: string;
|
||||
notes?: string;
|
||||
}[];
|
||||
};
|
||||
export type NewTransactionPayload = z.infer<typeof newTransactionPayloadSchema>;
|
||||
|
||||
Reference in New Issue
Block a user