fix: Restore backup bug
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
import { FastifyRequest, FastifyReply } from 'fastify';
|
||||
import { Pool } from 'pg';
|
||||
import { logger } from '../../../core/logging/logger';
|
||||
import { BackupService } from '../domain/backup.service';
|
||||
import { BackupRestoreService } from '../domain/backup-restore.service';
|
||||
import {
|
||||
@@ -192,7 +193,7 @@ export class BackupController {
|
||||
try {
|
||||
const result = await this.restoreService.executeRestore({
|
||||
backupId: request.params.id,
|
||||
createSafetyBackup: request.body.createSafetyBackup,
|
||||
createSafetyBackup: request.body?.createSafetyBackup ?? true,
|
||||
});
|
||||
|
||||
if (result.success) {
|
||||
@@ -211,9 +212,15 @@ export class BackupController {
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : 'Failed to execute restore';
|
||||
logger.error('Restore execution failed', {
|
||||
backupId: request.params.id,
|
||||
error: errorMessage,
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
});
|
||||
reply.status(400).send({
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Failed to execute restore',
|
||||
error: errorMessage,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ You are a senior software engineer specializsing in NodeJS, Typescript, front en
|
||||
*** CONTEXT ***
|
||||
- This is a modern web app for managing a vehicle fleet. It has both a desktop and mobile versions of the site that both need to maintain feature parity. It's currently deployed via docker compose but in the future will be deployed via k8s.
|
||||
- Read README.md CLAUDE.md and AI-INDEX.md and follow relevant instructions to understand this code repository in the context of this change.
|
||||
- There is an error when you try and create a backup.
|
||||
- Start with this file. /Users/egullickson/Documents/Technology/coding/motovaultpro/backend/src/features/admin/backup/api/backup.controller.ts
|
||||
- There is an error when you try and restore a backup.
|
||||
- Start with this file. /Users/egullickson/Documents/Technology/coding/motovaultpro/backend/src/features/backup/api/backup.controller.ts
|
||||
|
||||
*** CHANGES TO IMPLEMENT ***
|
||||
- Research this code base and ask iterative questions to compile a complete plan.
|
||||
|
||||
Reference in New Issue
Block a user