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. 36
      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 = {}
) =>

36
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,22 +2400,30 @@ class BaseModelSqlv2 {
const aliasColObjMap = await this.model.getAliasColObjMap();
const filterObj = extractFilterFromXwhere(where, aliasColObjMap);
await conditionV2(
[
new Filter({
children: args.filterArr || [],
is_group: true,
logical_op: 'and',
}),
const conditionObj = [
new Filter({
children: args.filterArr || [],
is_group: true,
logical_op: 'and',
}),
new Filter({
children: filterObj,
is_group: true,
logical_op: 'and',
}),
];
if (args.viewId) {
conditionObj.push(
new Filter({
children: filterObj,
children:
(await Filter.rootFilterList({ viewId: args.viewId })) || [],
is_group: true,
logical_op: 'and',
}),
],
qb,
this.dbDriver,
);
);
}
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