Browse Source

refactor: bulk api update

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 3 years ago
parent
commit
a1edc241f1
  1. 5
      packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts
  2. 10
      packages/nocodb/src/lib/noco/meta/api/dataApis/bulkDataAliasApis.ts
  3. 195
      scripts/sdk/swagger.json

5
packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts

@ -2053,9 +2053,8 @@ function extractFilterFromXwhere(
function extractCondition(nestedArrayConditions, aliasColObjMap) {
return nestedArrayConditions?.map(str => {
// eslint-disable-next-line prefer-const
let [logicOp, alias, op, value] = str
.match(/(?:~(and|or|not))?\((.*?),(\w+),(.*)\)/)
.slice(1);
let [logicOp, alias, op, value] =
str.match(/(?:~(and|or|not))?\((.*?),(\w+),(.*)\)/)?.slice(1) || [];
if (op === 'is') op = 'is' + value;
else if (op === 'in') value = value.split(',');

10
packages/nocodb/src/lib/noco/meta/api/dataApis/bulkDataAliasApis.ts

@ -91,23 +91,23 @@ async function getViewAndModelFromRequest(req) {
const router = Router({ mergeParams: true });
router.post(
'/api/v1/db/bulk-data/:orgs/:projectName/:tableAlias',
'/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias',
ncMetaAclMw(bulkDataInsert, 'bulkDataInsert')
);
router.patch(
'/api/v1/db/bulk-data/:orgs/:projectName/:tableAlias',
'/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias',
ncMetaAclMw(bulkDataUpdate, 'bulkDataUpdate')
);
router.patch(
'/api/v1/db/bulk-data/:orgs/:projectName/:tableAlias/all',
'/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias/all',
ncMetaAclMw(bulkDataUpdateAll, 'bulkDataUpdateAll')
);
router.delete(
'/api/v1/db/bulk-data/:orgs/:projectName/:tableAlias',
'/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias',
ncMetaAclMw(bulkDataDelete, 'bulkDataDelete')
);
router.delete(
'/api/v1/db/bulk-data/:orgs/:projectName/:tableAlias/all',
'/api/v1/db/data/bulk/:orgs/:projectName/:tableAlias/all',
ncMetaAclMw(bulkDataDeleteAll, 'bulkDataDeleteAll')
);

195
scripts/sdk/swagger.json

@ -4494,201 +4494,6 @@
]
},
"/api/v1/db/bulk-data/{orgs}/{projectName}/{tableName}/": {
"parameters": [
{
"schema": {
"type": "string"
},
"name": "orgs",
"in": "path",
"required": true
},
{
"schema": {
"type": "string"
},
"name": "projectName",
"in": "path",
"required": true
},
{
"schema": {
"type": "string"
},
"name": "tableName",
"in": "path",
"required": true
}
],
"delete": {
"summary": "",
"operationId": "db-table-row-bulk-delete",
"responses": {
"200": {
"description": "OK"
}
},
"tags": [
"DB Table Row"
],
"description": "",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {}
}
}
}
}
},
"post": {
"summary": "",
"operationId": "db-table-row-bulk-insert",
"responses": {
"200": {
"description": "OK"
}
},
"tags": [
"DB Table Row"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {}
}
}
}
}
},
"patch": {
"summary": "",
"operationId": "db-table-row-bulk-update",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {},
"examples": {}
}
}
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
},
"tags": [
"DB Table Row"
]
}
},
"/api/v1/db/bulk-data/{orgs}/{projectName}/{tableName}/all": {
"parameters": [
{
"schema": {
"type": "string"
},
"name": "orgs",
"in": "path",
"required": true
},
{
"schema": {
"type": "string"
},
"name": "projectName",
"in": "path",
"required": true
},
{
"schema": {
"type": "string"
},
"name": "tableName",
"in": "path",
"required": true
}
],
"patch": {
"summary": "",
"operationId": "db-table-row-bulk-update-all",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"description": "",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"parameters": [
{
"schema": {
"type": "string"
},
"in": "query",
"name": "where"
}
],
"tags": [
"DB Table Row"
]
},
"delete": {
"summary": "",
"operationId": "db-table-row-bulk-delete-all",
"responses": {
"200": {
"description": "OK",
"headers": {},
"content": {
"application/json": {
"schema": {}
}
}
}
},
"parameters": [
{
"schema": {
"type": "string"
},
"in": "query",
"name": "where"
}
],
"tags": [
"DB Table Row"
]
}
},
"/api/v1/db/storage/upload": {
"post": {
"summary": "Attachment",

Loading…
Cancel
Save