π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(nocodb): add skipPks param in bulkDelete all api
Ramesh Mane033f3f049d51
diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.tsindex adeb2d748c..7f6d64dff0 100644--- a/packages/nocodb/src/db/BaseModelSqlv2.ts+++ b/packages/nocodb/src/db/BaseModelSqlv2.ts@@ -3608,7 +3608,12 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {}async bulkDeleteAll(- args: { where?: string; filterArr?: Filter[]; viewId?: string } = {},+ args: {+ where?: string;+ filterArr?: Filter[];+ viewId?: string;+ skipPks?: string;+ } = {},{ cookie, skip_hooks = false }: { cookie: NcRequest; skip_hooks?: boolean },) {return await new BaseModelDelete(this).bulkAll({diff --git a/packages/nocodb/src/db/BaseModelSqlv2/delete.ts b/packages/nocodb/src/db/BaseModelSqlv2/delete.tsindex 12251b7056..bc2594aa48 100644--- a/packages/nocodb/src/db/BaseModelSqlv2/delete.ts+++ b/packages/nocodb/src/db/BaseModelSqlv2/delete.ts@@ -41,7 +41,12 @@ export class BaseModelDelete {}: {cookie: NcRequest;skip_hooks?: boolean;- args: { where?: string; filterArr?: Filter[]; viewId?: string };+ args: {+ where?: string;+ filterArr?: Filter[];+ viewId?: string;+ skipPks?: string;+ };}) {const columns = await this.baseModel.model.getColumns(this.baseModel.context,@@ -52,6 +57,17 @@ export class BaseModelDelete {this.baseModel.context,columns,);++ // If skipPks provided then add it in qb+ if (args.skipPks) {+ qb.where((qb) => {+ args.skipPks.split(',').forEach((pk) => {+ qb.andWhereNot(_wherePk(this.baseModel.model.primaryKeys, pk));+ });+ return qb;+ });+ }+const { filters: filterObj } = extractFilterFromXwhere(this.baseModel.context,where,@@ -274,7 +290,12 @@ export class BaseModelDelete {async bulkAll(params: {cookie: NcRequest;skip_hooks?: boolean;- args: { where?: string; filterArr?: Filter[]; viewId?: string };+ args: {+ where?: string;+ filterArr?: Filter[];+ viewId?: string;+ skipPks?: string;+ };}) {const { skip_hooks = false, cookie } = params;const { metaQueries, execQueries, qb, filterObj, attachmentColumns } =diff --git a/packages/nocodb/src/schema/swagger.json b/packages/nocodb/src/schema/swagger.jsonindex 9043deffee..c22615e135 100644--- a/packages/nocodb/src/schema/swagger.json+++ b/packages/nocodb/src/schema/swagger.json@@ -12821,6 +12821,14 @@},"in": "query","name": "viewId"+ },+ {+ "schema": {+ "type": "string"+ },+ "in": "query",+ "name": "skipPks",+ "description": "Comma separated list of pks"}],"patch": {