create public layout and admin and fix escrow and refund
This commit is contained in:
@@ -49,6 +49,36 @@ export const refundRepo = {
|
||||
});
|
||||
},
|
||||
|
||||
async countByStatus(
|
||||
status: "PENDING" | "APPROVED" | "REJECTED" | "PROCESSING" | "SUCCEEDED" | "FAILED"
|
||||
) {
|
||||
return prisma.refund.count({ where: { status } });
|
||||
},
|
||||
|
||||
/** Refund terbaru untuk satu status — dipakai dashboard admin. */
|
||||
async listRecent(
|
||||
status: "PENDING" | "APPROVED" | "REJECTED" | "PROCESSING" | "SUCCEEDED" | "FAILED",
|
||||
limit = 3
|
||||
) {
|
||||
return prisma.refund.findMany({
|
||||
where: { status },
|
||||
orderBy: { createdAt: "desc" },
|
||||
take: limit,
|
||||
select: {
|
||||
id: true,
|
||||
amount: true,
|
||||
reason: true,
|
||||
createdAt: true,
|
||||
booking: {
|
||||
select: {
|
||||
user: { select: { id: true, name: true } },
|
||||
trip: { select: { id: true, title: true } },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
async listByBooking(bookingId: string) {
|
||||
return prisma.refund.findMany({
|
||||
where: { bookingId },
|
||||
|
||||
Reference in New Issue
Block a user