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 @@ -8,4 +8,5 @@ export class GetTableRowsDs {
tableName: string;
userId: string;
filters?: Record<string, unknown>;
uncached?: boolean;
}
8 changes: 8 additions & 0 deletions backend/src/entities/table/table.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ export class TableController {
@ApiQuery({ name: 'page', required: false })
@ApiQuery({ name: 'perPage', required: false })
@ApiQuery({ name: 'search', required: false })
@ApiQuery({
name: 'uncached',
required: false,
type: Boolean,
description: 'Invalidate table metadata cache before reading rows',
})
@UseGuards(TableReadGuard)
@Timeout(TimeoutDefaults.EXTENDED)
@Throttle({ default: { limit: 300, ttl: 60000 } })
Expand All @@ -270,6 +276,7 @@ export class TableController {
@Query('page') page: string,
@Query('perPage') perPage: string,
@Query('search') searchingFieldValue: string,
@Query('uncached') uncached: string,
@Query() query: Record<string, string>,
@SlugUuid('connectionId') connectionId: string,
@UserId() userId: string,
Expand Down Expand Up @@ -308,6 +315,7 @@ export class TableController {
tableName: tableName,
userId: userId,
filters: body?.filters,
uncached: uncached === 'true',
};
return await this.getTableRowsUseCase.execute(inputData, InTransactionEnum.OFF);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class GetTableRowsUseCase extends AbstractUseCase<GetTableRowsDs, FoundTa
protected async implementation(inputData: GetTableRowsDs): Promise<FoundTableRowsDs> {
let operationResult = OperationResultStatusEnum.unknown;

const { connectionId, masterPwd, page, perPage, query, tableName, userId, filters } = inputData;
const { connectionId, masterPwd, page, perPage, query, tableName, userId, filters, uncached } = inputData;
let { searchingFieldValue } = inputData;
const connection = await this._dbContext.connectionRepository.findAndDecryptConnection(connectionId, masterPwd);
validateConnection(connection);
Expand All @@ -78,6 +78,9 @@ export class GetTableRowsUseCase extends AbstractUseCase<GetTableRowsDs, FoundTa
const userEmail = await getUserEmailForAgent(connection, userId, this._dbContext.userRepository);

await validateSchemaCache(dao, userEmail);
if (uncached) {
dao.invalidateMetadataCache();
}

// eslint-disable-next-line prefer-const
let { tableSettings, tableCustomFields, tableWidgets } =
Expand Down
Loading