Browse Source

feat: bulkUpdateAll using viewId

Signed-off-by: mertmit <mertmit99@gmail.com>
test/pw-duplicate-check
mertmit 2 years ago
parent
commit
1b21cad9b5
  1. 2
      packages/nocodb-sdk/src/lib/Api.ts
  2. 20
      packages/nocodb/src/db/BaseModelSqlv2.ts
  3. 7
      packages/nocodb/src/schema/swagger.json

2
packages/nocodb-sdk/src/lib/Api.ts

@ -7249,6 +7249,7 @@ export class Api<
data: object,
query?: {
where?: string;
viewId?: string;
},
params: RequestParams = {}
) =>
@ -7289,6 +7290,7 @@ export class Api<
data: object,
query?: {
where?: string;
viewId?: string;
},
params: RequestParams = {}
) =>

20
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -2378,7 +2378,7 @@ class BaseModelSqlv2 {
}
async bulkUpdateAll(
args: { where?: string; filterArr?: Filter[] } = {},
args: { where?: string; filterArr?: Filter[]; viewId?: string } = {},
data,
{ cookie }: { cookie?: any } = {},
) {
@ -2400,8 +2400,7 @@ class BaseModelSqlv2 {
const aliasColObjMap = await this.model.getAliasColObjMap();
const filterObj = extractFilterFromXwhere(where, aliasColObjMap);
await conditionV2(
[
const conditionObj = [
new Filter({
children: args.filterArr || [],
is_group: true,
@ -2412,10 +2411,19 @@ class BaseModelSqlv2 {
is_group: true,
logical_op: 'and',
}),
],
qb,
this.dbDriver,
];
if (args.viewId) {
conditionObj.push(
new Filter({
children:
(await Filter.rootFilterList({ viewId: args.viewId })) || [],
is_group: true,
}),
);
}
await conditionV2(conditionObj, qb, this.dbDriver);
qb.update(updateData);

7
packages/nocodb/src/schema/swagger.json

@ -10059,6 +10059,13 @@
},
"in": "query",
"name": "where"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "viewId"
}
],
"patch": {

Loading…
Cancel
Save