feat(core): Update PATCH /projects/:projectId/folders/:folderId endpoint to allow moving folder (no-changelog) (#13574)

This commit is contained in:
Ricardo Espinoza
2025-03-12 13:53:45 +01:00
committed by GitHub
parent 0066bf890f
commit 2275b1780a
8 changed files with 587 additions and 11 deletions

View File

@@ -5,9 +5,11 @@ import {
UpdateFolderDto,
} from '@n8n/api-types';
import { Response } from 'express';
import { UserError } from 'n8n-workflow';
import { Post, RestController, ProjectScope, Body, Get, Patch, Delete, Query } from '@/decorators';
import { FolderNotFoundError } from '@/errors/folder-not-found.error';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import type { ListQuery } from '@/requests';
@@ -69,6 +71,8 @@ export class ProjectController {
} catch (e) {
if (e instanceof FolderNotFoundError) {
throw new NotFoundError(e.message);
} else if (e instanceof UserError) {
throw new BadRequestError(e.message);
}
throw new InternalServerError(undefined, e);
}
@@ -79,7 +83,7 @@ export class ProjectController {
async deleteFolder(
req: AuthenticatedRequest<{ projectId: string; folderId: string }>,
_res: Response,
@Body payload: DeleteFolderDto,
@Query payload: DeleteFolderDto,
) {
const { projectId, folderId } = req.params;
@@ -88,6 +92,8 @@ export class ProjectController {
} catch (e) {
if (e instanceof FolderNotFoundError) {
throw new NotFoundError(e.message);
} else if (e instanceof UserError) {
throw new BadRequestError(e.message);
}
throw new InternalServerError(undefined, e);
}