From c98dda3d356dd40acb4859b455c43236a434ebba Mon Sep 17 00:00:00 2001 From: Artem Niehrieiev Date: Tue, 16 Sep 2025 10:06:44 +0000 Subject: [PATCH] feat: add permissions fields to FoundTableRowsDs and update use case logic --- .../application/data-structures/found-table-rows.ds.ts | 9 +++++++++ .../entities/table/use-cases/get-table-rows.use.case.ts | 3 +++ .../non-saas-tests/non-saas-table-oracledb-e2e.test.ts | 2 +- .../non-saas-table-oracledb-schema-e2e.test.ts | 2 +- .../ava-tests/saas-tests/table-oracle-agent-e2e.test.ts | 2 +- .../saas-tests/table-oracledb-schema-e2e.test.ts | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/backend/src/entities/table/application/data-structures/found-table-rows.ds.ts b/backend/src/entities/table/application/data-structures/found-table-rows.ds.ts index ccec6bdd2..bbcd5753d 100644 --- a/backend/src/entities/table/application/data-structures/found-table-rows.ds.ts +++ b/backend/src/entities/table/application/data-structures/found-table-rows.ds.ts @@ -61,6 +61,15 @@ export class FoundTableRowsDs { @ApiProperty() allow_csv_import: boolean; + @ApiProperty() + can_delete: boolean; + + @ApiProperty() + can_update: boolean; + + @ApiProperty() + can_add: boolean; + @ApiProperty({ type: CreatedTableFilterRO, isArray: true }) saved_filters: Array; } diff --git a/backend/src/entities/table/use-cases/get-table-rows.use.case.ts b/backend/src/entities/table/use-cases/get-table-rows.use.case.ts index 8d378eee0..5358b1756 100644 --- a/backend/src/entities/table/use-cases/get-table-rows.use.case.ts +++ b/backend/src/entities/table/use-cases/get-table-rows.use.case.ts @@ -241,6 +241,9 @@ export class GetTableRowsUseCase extends AbstractUseCase buildCreatedTableFilterRO(el)), + can_delete: tableSettings ? tableSettings.can_delete : true, + can_update: tableSettings ? tableSettings.can_update : true, + can_add: tableSettings ? tableSettings.can_add : true, }; const identitiesMap = new Map(); diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-e2e.test.ts index 85545d4f2..057a83c81 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-e2e.test.ts @@ -2089,7 +2089,7 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); + t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, String(43)); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { diff --git a/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-schema-e2e.test.ts b/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-schema-e2e.test.ts index b579de935..404930b6d 100644 --- a/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-schema-e2e.test.ts +++ b/backend/test/ava-tests/non-saas-tests/non-saas-table-oracledb-schema-e2e.test.ts @@ -2089,7 +2089,7 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); + t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, String(43)); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { diff --git a/backend/test/ava-tests/saas-tests/table-oracle-agent-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-oracle-agent-e2e.test.ts index 28f9a2f15..c1cca7aa0 100644 --- a/backend/test/ava-tests/saas-tests/table-oracle-agent-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-oracle-agent-e2e.test.ts @@ -1971,7 +1971,7 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); + t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, String(43)); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => { diff --git a/backend/test/ava-tests/saas-tests/table-oracledb-schema-e2e.test.ts b/backend/test/ava-tests/saas-tests/table-oracledb-schema-e2e.test.ts index 661647ce1..83d6ebd83 100644 --- a/backend/test/ava-tests/saas-tests/table-oracledb-schema-e2e.test.ts +++ b/backend/test/ava-tests/saas-tests/table-oracledb-schema-e2e.test.ts @@ -2087,7 +2087,7 @@ test.serial(`${currentTest} should add row in table and return result`, async (t t.is(getLogsRO.logs[addRowLogIndex].hasOwnProperty('affected_primary_key'), true); t.is(typeof getLogsRO.logs[addRowLogIndex].affected_primary_key, 'object'); t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.hasOwnProperty('id'), true); - t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, 43); + t.is(getLogsRO.logs[addRowLogIndex].affected_primary_key.id, String(43)); }); test.serial(`${currentTest} should throw an exception when connection id is not passed in request`, async (t) => {