feat: add Ko-fi donations tab to admin dashboard
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { Router } from "express";
|
||||
import { io } from "../index";
|
||||
import {
|
||||
type AuthenticatedRequest,
|
||||
authenticate,
|
||||
AuthenticatedRequest,
|
||||
requireAdmin,
|
||||
} from "../middleware/auth";
|
||||
import { prisma } from "../utils/prisma";
|
||||
import { asyncHandler } from "../middleware/errorHandler";
|
||||
import { io } from "../index";
|
||||
import { backfillUserHistory } from "../services/tautulli";
|
||||
import { prisma } from "../utils/prisma";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -229,4 +229,22 @@ router.get(
|
||||
}),
|
||||
);
|
||||
|
||||
router.get(
|
||||
"/kofi-payments",
|
||||
authenticate,
|
||||
requireAdmin,
|
||||
asyncHandler(async (_req: AuthenticatedRequest, res) => {
|
||||
const payments = await prisma.kofiPayment.findMany({
|
||||
orderBy: { createdAt: "desc" },
|
||||
take: 100,
|
||||
include: {
|
||||
user: {
|
||||
select: { plexUsername: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
res.json({ payments });
|
||||
}),
|
||||
);
|
||||
|
||||
export { router as adminRouter };
|
||||
|
||||
Reference in New Issue
Block a user