fix(prisma new version leads to this fix)
This commit is contained in:
@@ -132,9 +132,7 @@ 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)
|
|
||||||
.json({
|
|
||||||
error: "Failed to create archive",
|
error: "Failed to create archive",
|
||||||
details: err.message,
|
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
|
// if headers not sent, send 500; otherwise destroy
|
||||||
try {
|
try {
|
||||||
if (!res.headersSent) {
|
if (!res.headersSent) {
|
||||||
res
|
res.status(500).json({
|
||||||
.status(500)
|
|
||||||
.json({
|
|
||||||
error: "Failed to finalize archive",
|
error: "Failed to finalize archive",
|
||||||
details: String(err),
|
details: String(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);
|
||||||
|
|||||||
Reference in New Issue
Block a user