create public layout and admin and fix escrow and refund

This commit is contained in:
arifal
2026-05-12 00:05:30 +07:00
parent a07942c4b4
commit 958514d575
48 changed files with 1928 additions and 18 deletions
+30
View File
@@ -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 },