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