Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export class TableFiltersController {
if (!tableName) {
throw new BadRequestException(Messages.TABLE_NAME_MISSING);
}
if (!body.filters) {
throw new BadRequestException(Messages.FILTERS_MISSING);
}
const inputData: CreateTableFiltersDto = {
table_name: tableName,
connection_id: connectionId,
Expand Down Expand Up @@ -121,6 +124,6 @@ export class TableFiltersController {
table_name: tableName,
connection_id: connectionId,
};
return await this.deleteTableFiltersUseCase.execute(inputData, InTransactionEnum.ON);
return await this.deleteTableFiltersUseCase.execute(inputData, InTransactionEnum.OFF);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Inject, Injectable, NotFoundException } from '@nestjs/common';
import { Inject, Injectable } from '@nestjs/common';
import AbstractUseCase from '../../../common/abstract-use.case.js';
import { IGlobalDatabaseContext } from '../../../common/application/global-database-context.interface.js';
import { BaseType } from '../../../common/data-injection.tokens.js';
import { Messages } from '../../../exceptions/text/messages.js';

import { FindTableFiltersDs } from '../application/data-structures/find-table-filters.ds.js';
import { CreatedTableFiltersRO } from '../application/response-objects/created-table-filters.ro.js';
import { IFindTableFilters } from './table-filters-use-cases.interface.js';
Expand All @@ -26,7 +26,9 @@ export class FindTableFiltersUseCase
connection_id,
);
if (!foundTableFilters) {
throw new NotFoundException(Messages.TABLE_FILTERS_NOT_FOUND);
return {
filters: null,
} as CreatedTableFiltersRO;
}
return {
id: foundTableFilters.id,
Expand Down
1 change: 1 addition & 0 deletions backend/src/exceptions/text/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ export const Messages = {
EMAIL_CHANGED: 'Email changed',
EMAIL_SEND_FAILED: (email: string) => `Email sending to ${email} failed`,
EMAIL_VERIFICATION_REQUESTED: 'Email verification requested',
FILTERS_MISSING: 'Filters are missing',
USER_EMAIL_NOT_FOUND: (email: string) =>
`User ${email} is not found in our system, please ask the user to create an account first`,
USER_EMAIL_NOT_FOUND_AND_INVITED: (email: string) =>
Expand Down
3 changes: 2 additions & 1 deletion backend/test/ava-tests/saas-tests/table-filters-e2e-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ test.serial(`${currentTest} should delete table filters`, async (t) => {
.set('Content-Type', 'application/json')
.set('Accept', 'application/json');

t.is(getTableFiltersResponse.status, 404);
t.is(getTableFiltersResponse.status, 200);
t.is(getTableFiltersResponse.body.filters, null);
} catch (e) {
console.error(e);
t.fail();
Expand Down