Skip to content

fix all tables category adding#1612

Merged
Artuomka merged 1 commit into
mainfrom
backend_table_categories_fix
Feb 19, 2026
Merged

fix all tables category adding#1612
Artuomka merged 1 commit into
mainfrom
backend_table_categories_fix

Conversation

@Artuomka

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 19, 2026 09:49
@Artuomka Artuomka merged commit 09ce826 into main Feb 19, 2026
18 of 20 checks passed
@Artuomka Artuomka deleted the backend_table_categories_fix branch February 19, 2026 09:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue with handling the "All Tables" category when creating or updating table categories. The "All Tables" category is a special virtual category with category_id: null that is not persisted to the database but should be included in the response.

Changes:

  • Modified the CreateOrUpdateTableCategoriesUseCase to filter out the "All Tables" category (with category_id: null) before validation and database operations
  • Ensured the "All Tables" category is included in the response if it was provided in the input

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
backend/src/entities/table-categories/use-cases/create-or-update-table-categories.use.case.ts Added logic to separate and handle the "All Tables" category, filter it from validation and DB operations, and include it in the response
backend/src/entities/table-categories/table-categories.controller.ts Added empty line (appears unintentional)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +26 to +27
const allTablesCategory = table_categories.find((category) => category.category_id === null);
const filteredCategories = table_categories.filter((category) => category.category_id !== null);

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

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

The code attempts to handle categories with category_id: null to support the "All Tables" category, but the CreateTableCategoryDto validation at the controller level requires category_id to be a non-empty string (with @IsString() and @IsNotEmpty() decorators). This means requests with category_id: null will be rejected by the validation pipe before reaching this use case. To fix this, update the CreateTableCategoryDto to make category_id optional and nullable by adding @IsOptional() and removing or conditionally applying the @IsNotEmpty() decorator, or alternatively use @ValidateIf to skip validation when category_id is null.

Copilot uses AI. Check for mistakes.
@MasterPassword() masterPwd: string,
@Body() requestBody: CreateTableCategoryDto[],
): Promise<Array<FoundTableCategoryRo>> {

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

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

This empty line appears to be unintentional whitespace. Consider removing it to maintain consistent code formatting.

Suggested change

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants