feat: integrate NAS file operations with project CRUD

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-03-23 10:19:15 +01:00
parent 49e668ee2a
commit b87081dd2c
2 changed files with 26 additions and 3 deletions

View File

@@ -97,7 +97,9 @@ export default async function projectsRoutes(fastify: FastifyInstance): Promise<
const id = parseId(request.params.id, reply);
if (id === null) return;
const result = await deleteProject(id);
const body = request.body as Record<string, unknown>;
const deleteFiles = !!body?.delete_files;
const result = await deleteProject(id, deleteFiles);
if (result && 'error' in result) {
if (result.error === 'not_found') return error(reply, 'Projekt nenalezen', 404);
if (result.error === 'has_order') return error(reply, 'Nelze smazat projekt propojený s objednávkou. Nejdříve smažte objednávku.', 400);