fix(prisma new version leads to this fix)

This commit is contained in:
2025-12-18 00:46:04 +05:30
parent 3ad5bd633d
commit adb49a6683

View File

@@ -132,9 +132,7 @@ router.post("/backup", async (req: Request, res: Response): Promise<any> => {
// attempt to respond with error if possible
try {
if (!res.headersSent) {
res
.status(500)
.json({
res.status(500).json({
error: "Failed to create archive",
details: err.message,
});
@@ -187,9 +185,7 @@ router.post("/backup", async (req: Request, res: Response): Promise<any> => {
// if headers not sent, send 500; otherwise destroy
try {
if (!res.headersSent) {
res
.status(500)
.json({
res.status(500).json({
error: "Failed to finalize archive",
details: String(err),
});
@@ -222,9 +218,9 @@ router.get("/status", async (req: Request, res: Response): Promise<any> => {
return res.status(401).json({ error: "Unauthorized" });
}
const size = await prisma.$queryRawUnsafe<{ size: string }[]>(
"SELECT pg_size_pretty(pg_database_size(current_database())) as size"
);
const size = await prisma.$queryRaw<{ size: string }[]>`
SELECT pg_size_pretty(pg_database_size(current_database())) as size
`;
const patientsCount = await storage.getTotalPatientCount();
const lastBackup = await storage.getLastBackup(userId);