Skip to content

[PB-6023]: feat: implement bulk folder creation#965

Open
jzunigax2 wants to merge 3 commits intomasterfrom
feat/bulk-create-folders
Open

[PB-6023]: feat: implement bulk folder creation#965
jzunigax2 wants to merge 3 commits intomasterfrom
feat/bulk-create-folders

Conversation

@jzunigax2
Copy link
Contributor

@jzunigax2 jzunigax2 commented Mar 3, 2026

  • Adds POST /folders/bulk to create up to 15 folders under the same parent in a single request
  • All-or-nothing: validates all names upfront, inserts in a single DB query if any fails, none are created

@jzunigax2 jzunigax2 force-pushed the feat/bulk-create-folders branch from 70aa9a1 to cb561d9 Compare March 4, 2026 14:29
@jzunigax2 jzunigax2 self-assigned this Mar 4, 2026
@jzunigax2 jzunigax2 marked this pull request as ready for review March 4, 2026 15:19
@jzunigax2 jzunigax2 requested a review from apsantiso as a code owner March 4, 2026 15:19
@jzunigax2 jzunigax2 requested a review from sg-gs March 4, 2026 15:21
async createBulkFolders(user: User, dto: CreateFolderDto): Promise<Folder[]> {
const folders = dto.folders;

const parentFolder = await this.folderRepository.findOne({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we filter by removed = false for consistency reasons?

const plainNames = folders.map((f) => f.plainName);
const uniqueNames = new Set(plainNames);
if (uniqueNames.size !== plainNames.length) {
throw new BadRequestException('Duplicate folder names in request');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't this a 409 conflict or am I remembering it wrong?

…tion for duplicate names and filter removed parent folders
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants