Browse Source

refactor: nested data api corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 2 years ago
parent
commit
f156b63656
  1. 20
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/belongsToCell.vue
  2. 19
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue
  3. 21
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listItems.vue
  4. 8
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue
  5. 24
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue
  6. 287
      packages/nocodb-sdk/src/lib/Api.ts
  7. 68
      packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasNestedApis.ts
  8. 9
      packages/nocodb/src/lib/noco/meta/api/dataApis/index.ts
  9. 2
      packages/nocodb/src/lib/noco/meta/api/index.ts
  10. 38
      scripts/sdk/swagger.json

20
packages/nc-gui/components/project/spreadsheet/components/virtualCell/belongsToCell.vue

@ -34,6 +34,7 @@
:column="column" :column="column"
:primary-col="parentPrimaryCol" :primary-col="parentPrimaryCol"
:primary-key="parentPrimaryKey" :primary-key="parentPrimaryKey"
:parent-meta="meta"
:api="parentApi" :api="parentApi"
:query-params="{ :query-params="{
...parentQueryParams, ...parentQueryParams,
@ -278,14 +279,18 @@ export default {
return return
} }
const id = this.meta.columns.filter(c => c.pk).map(c => this.row[c.title]).join('___') const id = this.meta.columns.filter(c => c.pk).map(c => this.row[c.title]).join('___')
// todo: audit // todo: audit
await this.$api.data.nestedDelete( await this.$api.dbTableRow.nestedDelete(
this.meta.id, 'noco',
this.projectName,
this.meta.title,
id, id,
this.column.id,
'bt', 'bt',
this.column.title,
parent[this.parentPrimaryKey] parent[this.parentPrimaryKey]
) )
this.$emit('loadTableData') this.$emit('loadTableData')
if (this.isForm && this.$refs.childList) { if (this.isForm && this.$refs.childList) {
this.$refs.childList.loadData() this.$refs.childList.loadData()
@ -346,12 +351,13 @@ export default {
this.newRecordModal = false this.newRecordModal = false
return return
} }
await this.$api.dbTableRow.nestedAdd(
await this.$api.data.nestedAdd( 'noco',
this.meta.id, this.projectName,
this.meta.title,
id, id,
this.column.id,
'bt', 'bt',
this.column.title,
pid pid
) )

19
packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue

@ -179,7 +179,6 @@ export default {
methods: { methods: {
async loadData() { async loadData() {
if ((!this.isForm && this.isPublic) && this.$route.params.id) { if ((!this.isForm && this.isPublic) && this.$route.params.id) {
if (this.column && this.column.colOptions && this.rowId) { if (this.column && this.column.colOptions && this.rowId) {
this.data = (await this.$api.public.dataNestedList( this.data = (await this.$api.public.dataNestedList(
this.$route.params.id, this.$route.params.id,
@ -198,26 +197,24 @@ export default {
return return
} }
if (this.column && this.column.colOptions) { if (this.column && this.column.colOptions) {
this.data = (await this.$api.data.nestedList( this.data = (await this.$api.dbTableRow.nestedList(
this.column.fk_model_id, 'noco',
this.projectName,
this.parentMeta.title,
this.rowId, this.rowId,
this.column.id,
this.column.colOptions.type, this.column.colOptions.type,
this.column.title,
{ {
query: {
limit: this.size, limit: this.size,
offset: this.size * (this.page - 1) offset: this.size * (this.page - 1)
// ...this.queryParams
}
})) }))
} else { } else {
this.data = (await this.$api.data.list( this.data = (await this.$api.dbTableRow.list(
this.meta.id, { 'noco',
query: { this.projectName, this.meta.title, {
limit: this.size, limit: this.size,
offset: this.size * (this.page - 1), offset: this.size * (this.page - 1),
...this.queryParams ...this.queryParams
}
})) }))
} }
} }

21
packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listItems.vue

@ -144,7 +144,10 @@ export default {
this.data = (await this.$api.public.dataRelationList( this.data = (await this.$api.public.dataRelationList(
this.$route.params.id, this.$route.params.id,
this.column.id, this.column.id,
{ password: this.password }, { {}, {
headers: {
'xc-password': this.password
},
query: { query: {
limit: this.size, limit: this.size,
offset: this.size * (this.page - 1), offset: this.size * (this.page - 1),
@ -156,21 +159,23 @@ export default {
// eslint-disable-next-line no-lonely-if // eslint-disable-next-line no-lonely-if
if (this.column && this.column.colOptions && this.rowId) { if (this.column && this.column.colOptions && this.rowId) {
this.data = (await this.$api.data.nestedExcludedList( this.data = (await this.$api.dbTableRow.nestedChildrenExcludedList(
this.column.fk_model_id, 'noco',
this.projectName,
this.parentMeta.title,
this.rowId, this.rowId,
this.column.id,
this.column.colOptions.type, this.column.colOptions.type,
this.column.title,
{ {
query: {
limit: this.size, limit: this.size,
offset: this.size * (this.page - 1), offset: this.size * (this.page - 1),
where: this.query && `(${this.primaryCol},like,${this.query})` where: this.query && `(${this.primaryCol},like,${this.query})`
}
})) }))
} else { } else {
this.data = (await this.$api.data.list( this.data = (await this.$api.dbTableRow.list(
this.meta.id, { 'noco',
this.projectName,
this.meta.title, {
query: { query: {
limit: this.size, limit: this.size,
offset: this.size * (this.page - 1), offset: this.size * (this.page - 1),

8
packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue

@ -382,11 +382,13 @@ export default {
const id = this.childMeta.columns.filter(c => c.pk).map(c => child[c.title]).join('___') const id = this.childMeta.columns.filter(c => c.pk).map(c => child[c.title]).join('___')
this.newRecordModal = false this.newRecordModal = false
await this.$api.data.nestedAdd( await this.$api.dbTableRow.nestedAdd(
this.meta.id, 'noco',
this.projectName,
this.meta.title,
this.parentId, this.parentId,
this.column.id,
'hm', 'hm',
this.column.title,
id id
) )

24
packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue

@ -44,6 +44,7 @@
:meta="childMeta" :meta="childMeta"
:primary-col="childPrimaryCol" :primary-col="childPrimaryCol"
:primary-key="childPrimaryKey" :primary-key="childPrimaryKey"
:parent-meta="meta"
:api="api" :api="api"
:mm="mm" :mm="mm"
:tn="mm && mm.rtn" :tn="mm && mm.rtn"
@ -316,13 +317,17 @@ export default {
await Promise.all([this.loadChildMeta(), this.loadAssociateTableMeta()]) await Promise.all([this.loadChildMeta(), this.loadAssociateTableMeta()])
const cid = this.childMeta.columns.filter(c => c.pk).map(c => child[c.title]).join('___') const cid = this.childMeta.columns.filter(c => c.pk).map(c => child[c.title]).join('___')
const pid = this.meta.columns.filter(c => c.pk).map(c => this.row[c.title]).join('___') const pid = this.meta.columns.filter(c => c.pk).map(c => this.row[c.title]).join('___')
await this.$api.data.nestedDelete(
this.meta.id, await this.$api.dbTableRow.nestedDelete(
'noco',
this.projectName,
this.meta.title,
pid, pid,
this.column.id,
'mm', 'mm',
this.column.title,
cid cid
) )
this.$emit('loadTableData') this.$emit('loadTableData')
if ((this.childListModal || this.isForm) && this.$refs.childList) { if ((this.childListModal || this.isForm) && this.$refs.childList) {
this.$refs.childList.loadData() this.$refs.childList.loadData()
@ -400,20 +405,17 @@ export default {
// const vcidCol = this.assocMeta.columns.find(c => c.id === this.column.colOptions.fk_mm_parent_column_id).title // const vcidCol = this.assocMeta.columns.find(c => c.id === this.column.colOptions.fk_mm_parent_column_id).title
// const vpidCol = this.assocMeta.columns.find(c => c.id === this.column.colOptions.fk_mm_child_column_id).title // const vpidCol = this.assocMeta.columns.find(c => c.id === this.column.colOptions.fk_mm_child_column_id).title
await this.$api.data.nestedAdd( await this.$api.dbTableRow.nestedAdd(
this.meta.id, 'noco',
this.projectName,
this.meta.title,
pid, pid,
this.column.id,
'mm', 'mm',
this.column.title,
cid cid
) )
try { try {
// await this.$api.data.create(this.assocMeta.id, {
// [vcidCol]: parseIfInteger(cid),
// [vpidCol]: parseIfInteger(pid)
// })
this.$emit('loadTableData') this.$emit('loadTableData')
} catch (e) { } catch (e) {
// todo: handle // todo: handle

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

@ -2467,6 +2467,157 @@ export class Api<
...params, ...params,
}), }),
/**
* @description CSV or Excel export
*
* @tags DB table row
* @name CsvExport
* @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/export/{type}
* @response `200` `any` OK
*/
csvExport: (
orgs: string,
projectName: string,
tableName: string,
viewName: string,
type: 'csv' | 'excel',
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/export/${type}`,
method: 'GET',
wrapped: true,
...params,
}),
/**
* @description CSV or Excel export
*
* @tags DB table row
* @name CsvExport2
* @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/export/{type}
* @originalName csvExport
* @duplicate
* @response `200` `any` OK
*/
csvExport2: (
orgs: string,
projectName: string,
tableName: string,
type: 'csv' | 'excel',
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/export/${type}`,
method: 'GET',
wrapped: true,
...params,
}),
/**
* No description
*
* @tags DB table row
* @name NestedList
* @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}
* @response `200` `any` OK
*/
nestedList: (
orgs: string,
projectName: string,
tableName: string,
rowId: string,
relationType: 'mm' | 'hm',
columnName: string,
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}`,
method: 'GET',
query: query,
format: 'json',
...params,
}),
/**
* No description
*
* @tags DB table row
* @name NestedAdd
* @request POST:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId}
* @response `200` `any` OK
*/
nestedAdd: (
orgs: string,
projectName: string,
tableName: string,
rowId: string,
relationType: 'mm' | 'hm',
columnName: string,
refRowId: string,
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/${refRowId}`,
method: 'POST',
query: query,
format: 'json',
...params,
}),
/**
* No description
*
* @tags DB table row
* @name NestedDelete
* @request DELETE:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId}
* @response `200` `any` OK
*/
nestedDelete: (
orgs: string,
projectName: string,
tableName: string,
rowId: string,
relationType: 'mm' | 'hm',
columnName: string,
refRowId: string,
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/${refRowId}`,
method: 'DELETE',
format: 'json',
...params,
}),
/**
* No description
*
* @tags DB table row
* @name NestedChildrenExcludedList
* @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude
* @response `200` `any` OK
*/
nestedChildrenExcludedList: (
orgs: string,
projectName: string,
tableName: string,
rowId: string,
relationType: 'mm' | 'hm',
columnName: string,
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/exclude`,
method: 'GET',
query: query,
format: 'json',
...params,
}),
/** /**
* No description * No description
* *
@ -2707,110 +2858,7 @@ export class Api<
...params, ...params,
}), }),
}; };
data = {
/**
* @description CSV or Excel export
*
* @tags Data
* @name CsvExport
* @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/export/{type}
* @response `200` `any` OK
*/
csvExport: (
orgs: string,
projectName: string,
tableName: string,
viewName: string,
type: 'csv' | 'excel',
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/export/${type}`,
method: 'GET',
wrapped: true,
...params,
}),
/**
* @description CSV or Excel export
*
* @tags Data
* @name CsvExport2
* @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/export/{type}
* @originalName csvExport
* @duplicate
* @response `200` `any` OK
*/
csvExport2: (
orgs: string,
projectName: string,
tableName: string,
type: 'csv' | 'excel',
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/export/${type}`,
method: 'GET',
wrapped: true,
...params,
}),
};
public = { public = {
/**
* No description
*
* @tags Public
* @name DataNestedList
* @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}
* @response `200` `any` OK
*/
dataNestedList: (
orgs: string,
projectName: string,
tableName: string,
rowId: string,
relationType: 'mm' | 'hm',
columnName: string,
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}`,
method: 'GET',
query: query,
format: 'json',
...params,
}),
/**
* No description
*
* @tags Public
* @name DataNestedList2
* @request POST:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId}
* @originalName dataNestedList
* @duplicate
* @response `200` `any` OK
*/
dataNestedList2: (
orgs: string,
projectName: string,
tableName: string,
rowId: string,
relationType: 'mm' | 'hm',
columnName: string,
refRowId: string,
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/${refRowId}`,
method: 'POST',
query: query,
format: 'json',
...params,
}),
/** /**
* No description * No description
* *
@ -2858,13 +2906,11 @@ export class Api<
* No description * No description
* *
* @tags Public * @tags Public
* @name DataNestedList3 * @name DataNestedList
* @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/{rowId}/{relationType}/{columnName} * @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/{rowId}/{relationType}/{columnName}
* @originalName dataNestedList
* @duplicate
* @response `200` `any` OK * @response `200` `any` OK
*/ */
dataNestedList3: ( dataNestedList: (
sharedViewUuid: string, sharedViewUuid: string,
rowId: string, rowId: string,
relationType: 'mm' | 'hm', relationType: 'mm' | 'hm',
@ -2981,33 +3027,6 @@ export class Api<
...params, ...params,
}), }),
}; };
dbData = {
/**
* No description
*
* @tags DB Data
* @name DataNestedExcludedChildrenList
* @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude
* @response `200` `any` OK
*/
dataNestedExcludedChildrenList: (
orgs: string,
projectName: string,
tableName: string,
rowId: string,
relationType: 'mm' | 'hm',
columnName: string,
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/exclude`,
method: 'GET',
query: query,
format: 'json',
...params,
}),
};
utils = { utils = {
/** /**
* No description * No description

68
packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasNestedApis.ts

@ -3,7 +3,6 @@ import Model from '../../../../noco-models/Model';
import Base from '../../../../noco-models/Base'; import Base from '../../../../noco-models/Base';
import NcConnectionMgrv2 from '../../../common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '../../../common/NcConnectionMgrv2';
import { PagedResponseImpl } from '../../helpers/PagedResponse'; import { PagedResponseImpl } from '../../helpers/PagedResponse';
import View from '../../../../noco-models/View';
import ncMetaAclMw from '../../helpers/ncMetaAclMw'; import ncMetaAclMw from '../../helpers/ncMetaAclMw';
import { getViewAndModelFromRequestByAliasOrId } from './helpers'; import { getViewAndModelFromRequestByAliasOrId } from './helpers';
import { NcError } from '../../helpers/catchError'; import { NcError } from '../../helpers/catchError';
@ -44,12 +43,7 @@ export async function mmList(req: Request, res: Response, next) {
} }
export async function mmExcludedList(req: Request, res: Response, next) { export async function mmExcludedList(req: Request, res: Response, next) {
const view = await View.get(req.params.viewId); const { model, view } = await getViewAndModelFromRequestByAliasOrId(req);
const model = await Model.getByIdOrName({
id: view?.fk_model_id || req.params.viewId
});
if (!model) return next(new Error('Table not found')); if (!model) return next(new Error('Table not found'));
const base = await Base.get(model.base_id); const base = await Base.get(model.base_id);
@ -86,11 +80,7 @@ export async function mmExcludedList(req: Request, res: Response, next) {
} }
export async function hmExcludedList(req: Request, res: Response, next) { export async function hmExcludedList(req: Request, res: Response, next) {
const view = await View.get(req.params.viewId); const { model, view } = await getViewAndModelFromRequestByAliasOrId(req);
const model = await Model.getByIdOrName({
id: view?.fk_model_id || req.params.viewId
});
if (!model) return next(new Error('Table not found')); if (!model) return next(new Error('Table not found'));
@ -129,12 +119,7 @@ export async function hmExcludedList(req: Request, res: Response, next) {
} }
export async function btExcludedList(req: Request, res: Response, next) { export async function btExcludedList(req: Request, res: Response, next) {
const view = await View.get(req.params.viewId); const { model, view } = await getViewAndModelFromRequestByAliasOrId(req);
const model = await Model.getByIdOrName({
id: view?.fk_model_id || req.params.viewId
});
if (!model) return next(new Error('Table not found')); if (!model) return next(new Error('Table not found'));
const base = await Base.get(model.base_id); const base = await Base.get(model.base_id);
@ -172,12 +157,7 @@ export async function btExcludedList(req: Request, res: Response, next) {
} }
export async function hmList(req: Request, res: Response, next) { export async function hmList(req: Request, res: Response, next) {
const view = await View.get(req.params.viewId); const { model, view } = await getViewAndModelFromRequestByAliasOrId(req);
const model = await Model.getByIdOrName({
id: view?.fk_model_id || req.params.viewId
});
if (!model) return next(new Error('Table not found')); if (!model) return next(new Error('Table not found'));
const base = await Base.get(model.base_id); const base = await Base.get(model.base_id);
@ -212,11 +192,7 @@ export async function hmList(req: Request, res: Response, next) {
//@ts-ignore //@ts-ignore
async function relationDataDelete(req, res) { async function relationDataDelete(req, res) {
const view = await View.get(req.params.viewId); const { model, view } = await getViewAndModelFromRequestByAliasOrId(req);
const model = await Model.getByIdOrName({
id: view?.fk_model_id || req.params.viewId
});
if (!model) NcError.notFound('Table not found'); if (!model) NcError.notFound('Table not found');
@ -232,7 +208,7 @@ async function relationDataDelete(req, res) {
await baseModel.removeChild({ await baseModel.removeChild({
colId: column.id, colId: column.id,
childId: req.params.childId, childId: req.params.refRowId,
rowId: req.params.rowId rowId: req.params.rowId
}); });
@ -241,12 +217,7 @@ async function relationDataDelete(req, res) {
//@ts-ignore //@ts-ignore
async function relationDataAdd(req, res) { async function relationDataAdd(req, res) {
const view = await View.get(req.params.viewId); const { model, view } = await getViewAndModelFromRequestByAliasOrId(req);
const model = await Model.getByIdOrName({
id: view?.fk_model_id || req.params.viewId
});
if (!model) NcError.notFound('Table not found'); if (!model) NcError.notFound('Table not found');
const base = await Base.get(model.base_id); const base = await Base.get(model.base_id);
@ -260,7 +231,7 @@ async function relationDataAdd(req, res) {
const column = await getColumnByIdOrName(req.params.columnName, model); const column = await getColumnByIdOrName(req.params.columnName, model);
await baseModel.addChild({ await baseModel.addChild({
colId: column.id, colId: column.id,
childId: req.params.childId, childId: req.params.refRowId,
rowId: req.params.rowId rowId: req.params.rowId
}); });
@ -270,9 +241,9 @@ async function relationDataAdd(req, res) {
async function getColumnByIdOrName(columnNameOrId: string, model: Model) { async function getColumnByIdOrName(columnNameOrId: string, model: Model) {
const column = (await model.getColumns()).find( const column = (await model.getColumns()).find(
c => c =>
column.title === columnNameOrId || c.title === columnNameOrId ||
c.id === columnNameOrId || c.id === columnNameOrId ||
column.column_name === columnNameOrId c.column_name === columnNameOrId
); );
if (!column) if (!column)
@ -284,25 +255,34 @@ async function getColumnByIdOrName(columnNameOrId: string, model: Model) {
const router = Router({ mergeParams: true }); const router = Router({ mergeParams: true });
router.get( router.get(
'/api/v1/db/data/:orgs/:projectName/:tableName/mm/:columnName/exclude', '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/mm/:columnName/exclude',
ncMetaAclMw(mmExcludedList, 'mmExcludedList') ncMetaAclMw(mmExcludedList, 'mmExcludedList')
); );
router.get( router.get(
'/api/v1/db/data/:orgs/:projectName/:tableName/hm/:columnName/exclude', '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/hm/:columnName/exclude',
ncMetaAclMw(hmExcludedList, 'hmExcludedList') ncMetaAclMw(hmExcludedList, 'hmExcludedList')
); );
router.get( router.get(
'/api/v1/db/data/:orgs/:projectName/:tableName/bt/:columnName/exclude', '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/bt/:columnName/exclude',
ncMetaAclMw(btExcludedList, 'btExcludedList') ncMetaAclMw(btExcludedList, 'btExcludedList')
); );
router.post( router.post(
'/api/v1/db/data/:orgs/:projectName/:tableName/:relationType/:columnName/:refRowId', '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/:relationType/:columnName/:refRowId',
ncMetaAclMw(relationDataAdd, 'relationDataAdd') ncMetaAclMw(relationDataAdd, 'relationDataAdd')
); );
router.delete( router.delete(
'/api/v1/db/data/:orgs/:projectName/:tableName/:relationType/:columnName/:refRowId', '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/:relationType/:columnName/:refRowId',
ncMetaAclMw(relationDataDelete, 'relationDataDelete') ncMetaAclMw(relationDataDelete, 'relationDataDelete')
); );
router.get(
'/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/mm/:columnName',
ncMetaAclMw(mmList, 'mmList')
);
router.get(
'/api/v1/db/data/:orgs/:projectName/:tableName/:rowId/hm/:columnName',
ncMetaAclMw(hmList, 'hmList')
);
export default router; export default router;

9
packages/nocodb/src/lib/noco/meta/api/dataApis/index.ts

@ -2,5 +2,12 @@ import dataApis from './dataApis';
import oldDataApis from './oldDataApis'; import oldDataApis from './oldDataApis';
import dataAliasApis from './dataAliasApis'; import dataAliasApis from './dataAliasApis';
import bulkDataAliasApis from './bulkDataAliasApis'; import bulkDataAliasApis from './bulkDataAliasApis';
import dataAliasNestedApis from './dataAliasNestedApis';
export { dataApis, oldDataApis, dataAliasApis, bulkDataAliasApis }; export {
dataApis,
oldDataApis,
dataAliasApis,
bulkDataAliasApis,
dataAliasNestedApis
};

2
packages/nocodb/src/lib/noco/meta/api/index.ts

@ -30,6 +30,7 @@ import hookFilterApis from './hookFilterApis';
import { import {
bulkDataAliasApis, bulkDataAliasApis,
dataAliasApis, dataAliasApis,
dataAliasNestedApis,
dataApis, dataApis,
oldDataApis oldDataApis
} from './dataApis'; } from './dataApis';
@ -52,6 +53,7 @@ export default function(router: Router, server) {
router.use(dataApis); router.use(dataApis);
router.use(bulkDataAliasApis); router.use(bulkDataAliasApis);
router.use(dataAliasApis); router.use(dataAliasApis);
router.use(dataAliasNestedApis);
router.use(oldDataApis); router.use(oldDataApis);
router.use(sortApis); router.use(sortApis);
router.use(filterApis); router.use(filterApis);

38
scripts/sdk/swagger.json

@ -2357,6 +2357,7 @@
} }
} }
}, },
"/api/v1/db/data/{orgs}/{projectName}/{tableName}": { "/api/v1/db/data/{orgs}/{projectName}/{tableName}": {
"parameters": [ "parameters": [
{ {
@ -2972,10 +2973,10 @@
], ],
"get": { "get": {
"summary": "", "summary": "",
"operationId": "data-csv-export", "operationId": "db-table-row-csv-export",
"description": "CSV or Excel export", "description": "CSV or Excel export",
"tags": [ "tags": [
"Data" "DB table row"
], ],
"wrapped": true, "wrapped": true,
"responses": { "responses": {
@ -3039,10 +3040,10 @@
], ],
"get": { "get": {
"summary": "", "summary": "",
"operationId": "data-csv-export", "operationId": "db-table-row-csv-export",
"description": "CSV or Excel export", "description": "CSV or Excel export",
"tags": [ "tags": [
"Data" "DB table row"
], ],
"wrapped": true, "wrapped": true,
"responses": { "responses": {
@ -3121,7 +3122,7 @@
], ],
"get": { "get": {
"summary": "", "summary": "",
"operationId": "data-nested-list", "operationId": "db-table-row-nested-list",
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -3133,7 +3134,7 @@
} }
}, },
"tags": [ "tags": [
"Public" "DB table row"
], ],
"parameters": [ "parameters": [
{ {
@ -3218,7 +3219,7 @@
], ],
"post": { "post": {
"summary": "", "summary": "",
"operationId": "data-nested-list", "operationId": "db-table-row-nested-add",
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -3230,7 +3231,7 @@
} }
}, },
"tags": [ "tags": [
"Public" "DB table row"
], ],
"parameters": [ "parameters": [
{ {
@ -3248,6 +3249,23 @@
"name": "offset" "name": "offset"
} }
] ]
},
"delete": {
"summary": "",
"operationId": "db-table-row-nested-delete",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"tags": [
"DB table row"
]
} }
}, },
"/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude": { "/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude": {
@ -3307,7 +3325,7 @@
], ],
"get": { "get": {
"summary": "", "summary": "",
"operationId": "data-nested-excluded-children-list", "operationId": "db-table-row-nested-children-excluded-list",
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -3319,7 +3337,7 @@
} }
}, },
"tags": [ "tags": [
"DB Data" "DB table row"
], ],
"parameters": [ "parameters": [
{ {

Loading…
Cancel
Save