Browse Source

refactor: bring back db in data api and remove new version of the old data api paths

pull/6644/head
Pranav C 1 year ago
parent
commit
66c3cb442c
  1. 2
      packages/nc-gui/components/smartsheet/ApiSnippet.vue
  2. 2
      packages/nc-gui/components/smartsheet/details/Api.vue
  3. 5
      packages/nocodb/src/controllers/bulk-data-alias.controller.ts
  4. 4
      packages/nocodb/src/controllers/data-alias-export.controller.ts
  5. 7
      packages/nocodb/src/controllers/data-alias-nested.controller.ts
  6. 20
      packages/nocodb/src/controllers/data-alias.controller.ts
  7. 40
      packages/nocodb/src/schema/swagger.json
  8. 30
      packages/nocodb/src/services/api-docs/swagger/templates/paths.ts
  9. 10
      packages/nocodb/tests/unit/rest/tests/tableRow.test.ts

2
packages/nc-gui/components/smartsheet/ApiSnippet.vue

@ -84,7 +84,7 @@ const selectedLangName = ref(langs[0].name)
const apiUrl = computed( const apiUrl = computed(
() => () =>
new URL( new URL(
`/api/v1/data/noco/${base.value.id}/${meta.value?.title}/views/${view.value?.title}`, `/api/v1/db/data/noco/${base.value.id}/${meta.value?.title}/views/${view.value?.title}`,
(appInfo.value && appInfo.value.ncSiteUrl) || '/', (appInfo.value && appInfo.value.ncSiteUrl) || '/',
).href, ).href,
) )

2
packages/nc-gui/components/smartsheet/details/Api.vue

@ -84,7 +84,7 @@ const selectedLangName = ref(langs[0].name)
const apiUrl = computed( const apiUrl = computed(
() => () =>
new URL( new URL(
`/api/v1/data/noco/${base.value?.id}/${meta.value?.title}/views/${view.value?.title}`, `/api/v1/db/data/noco/${base.value?.id}/${meta.value?.title}/views/${view.value?.title}`,
(appInfo.value && appInfo.value.ncSiteUrl) || '/', (appInfo.value && appInfo.value.ncSiteUrl) || '/',
).href, ).href,
) )

5
packages/nocodb/src/controllers/bulk-data-alias.controller.ts

@ -22,7 +22,6 @@ export class BulkDataAliasController {
@Post([ @Post([
'/api/v1/db/data/bulk/:orgs/:baseName/:tableName', '/api/v1/db/data/bulk/:orgs/:baseName/:tableName',
'/api/v1/data/bulk/:orgs/:baseName/:tableName',
]) ])
@HttpCode(200) @HttpCode(200)
@Acl('bulkDataInsert') @Acl('bulkDataInsert')
@ -45,7 +44,6 @@ export class BulkDataAliasController {
@Patch([ @Patch([
'/api/v1/db/data/bulk/:orgs/:baseName/:tableName', '/api/v1/db/data/bulk/:orgs/:baseName/:tableName',
'/api/v1/data/bulk/:orgs/:baseName/:tableName',
]) ])
@Acl('bulkDataUpdate') @Acl('bulkDataUpdate')
async bulkDataUpdate( async bulkDataUpdate(
@ -65,7 +63,6 @@ export class BulkDataAliasController {
// todo: Integrate with filterArrJson bulkDataUpdateAll // todo: Integrate with filterArrJson bulkDataUpdateAll
@Patch([ @Patch([
'/api/v1/db/data/bulk/:orgs/:baseName/:tableName/all', '/api/v1/db/data/bulk/:orgs/:baseName/:tableName/all',
'/api/v1/data/bulk/:orgs/:baseName/:tableName/all',
]) ])
@Acl('bulkDataUpdateAll') @Acl('bulkDataUpdateAll')
async bulkDataUpdateAll( async bulkDataUpdateAll(
@ -85,7 +82,6 @@ export class BulkDataAliasController {
@Delete([ @Delete([
'/api/v1/db/data/bulk/:orgs/:baseName/:tableName', '/api/v1/db/data/bulk/:orgs/:baseName/:tableName',
'/api/v1/data/bulk/:orgs/:baseName/:tableName',
]) ])
@Acl('bulkDataDelete') @Acl('bulkDataDelete')
async bulkDataDelete( async bulkDataDelete(
@ -106,7 +102,6 @@ export class BulkDataAliasController {
@Delete([ @Delete([
'/api/v1/db/data/bulk/:orgs/:baseName/:tableName/all', '/api/v1/db/data/bulk/:orgs/:baseName/:tableName/all',
'/api/v1/data/bulk/:orgs/:baseName/:tableName/all',
]) ])
@Acl('bulkDataDeleteAll') @Acl('bulkDataDeleteAll')
async bulkDataDeleteAll( async bulkDataDeleteAll(

4
packages/nocodb/src/controllers/data-alias-export.controller.ts

@ -15,8 +15,6 @@ export class DataAliasExportController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/export/excel', '/api/v1/db/data/:orgs/:baseName/:tableName/export/excel',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/export/excel', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/export/excel',
'/api/v1/data/:orgs/:baseName/:tableName/export/excel',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/export/excel',
]) ])
@Acl('exportExcel') @Acl('exportExcel')
async excelDataExport(@Request() req, @Response() res) { async excelDataExport(@Request() req, @Response() res) {
@ -44,8 +42,6 @@ export class DataAliasExportController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/export/csv', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/export/csv',
'/api/v1/db/data/:orgs/:baseName/:tableName/export/csv', '/api/v1/db/data/:orgs/:baseName/:tableName/export/csv',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/export/csv',
'/api/v1/data/:orgs/:baseName/:tableName/export/csv',
]) ])
@Acl('exportCsv') @Acl('exportCsv')
async csvDataExport(@Request() req, @Response() res) { async csvDataExport(@Request() req, @Response() res) {

7
packages/nocodb/src/controllers/data-alias-nested.controller.ts

@ -21,7 +21,6 @@ export class DataAliasNestedController {
// todo: handle case where the given column is not ltar // todo: handle case where the given column is not ltar
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/mm/:columnName', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/mm/:columnName',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId/mm/:columnName',
]) ])
@Acl('mmList') @Acl('mmList')
async mmList( async mmList(
@ -42,7 +41,6 @@ export class DataAliasNestedController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/mm/:columnName/exclude', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/mm/:columnName/exclude',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId/mm/:columnName/exclude',
]) ])
@Acl('mmExcludedList') @Acl('mmExcludedList')
async mmExcludedList( async mmExcludedList(
@ -63,7 +61,6 @@ export class DataAliasNestedController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/hm/:columnName/exclude', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/hm/:columnName/exclude',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId/hm/:columnName/exclude',
]) ])
@Acl('hmExcludedList') @Acl('hmExcludedList')
async hmExcludedList( async hmExcludedList(
@ -84,7 +81,6 @@ export class DataAliasNestedController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/bt/:columnName/exclude', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/bt/:columnName/exclude',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId/bt/:columnName/exclude',
]) ])
@Acl('btExcludedList') @Acl('btExcludedList')
async btExcludedList( async btExcludedList(
@ -107,7 +103,6 @@ export class DataAliasNestedController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/hm/:columnName', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/hm/:columnName',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId/hm/:columnName',
]) ])
@Acl('hmList') @Acl('hmList')
async hmList( async hmList(
@ -128,7 +123,6 @@ export class DataAliasNestedController {
@Delete([ @Delete([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/:relationType/:columnName/:refRowId', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/:relationType/:columnName/:refRowId',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId/:relationType/:columnName/:refRowId',
]) ])
@Acl('relationDataRemove') @Acl('relationDataRemove')
async relationDataRemove( async relationDataRemove(
@ -154,7 +148,6 @@ export class DataAliasNestedController {
// todo: Give proper error message when reference row is already related and handle duplicate ref row id in hm // todo: Give proper error message when reference row is already related and handle duplicate ref row id in hm
@Post([ @Post([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/:relationType/:columnName/:refRowId', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/:relationType/:columnName/:refRowId',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId/:relationType/:columnName/:refRowId',
]) ])
@Acl('relationDataAdd') @Acl('relationDataAdd')
@HttpCode(200) @HttpCode(200)

20
packages/nocodb/src/controllers/data-alias.controller.ts

@ -27,8 +27,6 @@ export class DataAliasController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName', '/api/v1/db/data/:orgs/:baseName/:tableName',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName',
'/api/v1/data/:orgs/:baseName/:tableName',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName',
]) ])
@Acl('dataList') @Acl('dataList')
async dataList( async dataList(
@ -61,8 +59,6 @@ export class DataAliasController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/find-one', '/api/v1/db/data/:orgs/:baseName/:tableName/find-one',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/find-one', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/find-one',
'/api/v1/data/:orgs/:baseName/:tableName/find-one',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/find-one',
]) ])
@Acl('dataFindOne') @Acl('dataFindOne')
async dataFindOne( async dataFindOne(
@ -82,8 +78,6 @@ export class DataAliasController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/groupby', '/api/v1/db/data/:orgs/:baseName/:tableName/groupby',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/groupby', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/groupby',
'/api/v1/data/:orgs/:baseName/:tableName/groupby',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/groupby',
]) ])
@Acl('dataGroupBy') @Acl('dataGroupBy')
async dataGroupBy( async dataGroupBy(
@ -103,8 +97,6 @@ export class DataAliasController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/count', '/api/v1/db/data/:orgs/:baseName/:tableName/count',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/count', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/count',
'/api/v1/data/:orgs/:baseName/:tableName/count',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/count',
]) ])
@Acl('dataCount') @Acl('dataCount')
async dataCount( async dataCount(
@ -127,8 +119,6 @@ export class DataAliasController {
@Post([ @Post([
'/api/v1/db/data/:orgs/:baseName/:tableName', '/api/v1/db/data/:orgs/:baseName/:tableName',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName',
'/api/v1/data/:orgs/:baseName/:tableName',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName',
]) ])
@HttpCode(200) @HttpCode(200)
@Acl('dataInsert') @Acl('dataInsert')
@ -153,8 +143,6 @@ export class DataAliasController {
@Patch([ @Patch([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/:rowId', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/:rowId',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/:rowId',
]) ])
@Acl('dataUpdate') @Acl('dataUpdate')
async dataUpdate( async dataUpdate(
@ -179,8 +167,6 @@ export class DataAliasController {
@Delete([ @Delete([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/:rowId', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/:rowId',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/:rowId',
]) ])
@Acl('dataDelete') @Acl('dataDelete')
async dataDelete( async dataDelete(
@ -202,8 +188,6 @@ export class DataAliasController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/:rowId', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/:rowId',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/:rowId',
]) ])
@Acl('dataRead') @Acl('dataRead')
async dataRead( async dataRead(
@ -229,8 +213,6 @@ export class DataAliasController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/exist', '/api/v1/db/data/:orgs/:baseName/:tableName/:rowId/exist',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/:rowId/exist', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/:rowId/exist',
'/api/v1/data/:orgs/:baseName/:tableName/:rowId/exist',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/:rowId/exist',
]) ])
@Acl('dataExist') @Acl('dataExist')
async dataExist( async dataExist(
@ -257,8 +239,6 @@ export class DataAliasController {
@Get([ @Get([
'/api/v1/db/data/:orgs/:baseName/:tableName/group/:columnId', '/api/v1/db/data/:orgs/:baseName/:tableName/group/:columnId',
'/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/group/:columnId', '/api/v1/db/data/:orgs/:baseName/:tableName/views/:viewName/group/:columnId',
'/api/v1/data/:orgs/:baseName/:tableName/group/:columnId',
'/api/v1/data/:orgs/:baseName/:tableName/views/:viewName/group/:columnId',
]) ])
@Acl('groupedDataList') @Acl('groupedDataList')
async groupedDataList( async groupedDataList(

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

@ -8653,7 +8653,7 @@
"x-internal": true "x-internal": true
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -8907,7 +8907,7 @@
] ]
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/find-one": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/find-one": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -8997,7 +8997,7 @@
} }
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/groupby": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/groupby": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -9089,7 +9089,7 @@
} }
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/views/{viewName}/group/{columnId}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/views/{viewName}/group/{columnId}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -9267,7 +9267,7 @@
} }
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/group/{columnId}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/group/{columnId}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -9435,7 +9435,7 @@
} }
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/views/{viewName}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/views/{viewName}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -9669,7 +9669,7 @@
"description": "Create a new row in the given Table View" "description": "Create a new row in the given Table View"
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/views/{viewName}/find-one": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/views/{viewName}/find-one": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -9773,7 +9773,7 @@
} }
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/views/{viewName}/groupby": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/views/{viewName}/groupby": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -9876,7 +9876,7 @@
} }
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/views/{viewName}/count": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/views/{viewName}/count": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -9970,7 +9970,7 @@
} }
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/views/{viewName}/{rowId}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/views/{viewName}/{rowId}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -10146,7 +10146,7 @@
] ]
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/views/{viewName}/{rowId}/exist": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/views/{viewName}/{rowId}/exist": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -10227,7 +10227,7 @@
] ]
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/{rowId}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/{rowId}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -10402,7 +10402,7 @@
] ]
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/{rowId}/exist": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/{rowId}/exist": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -10475,7 +10475,7 @@
] ]
} }
}, },
"/api/v1/data/bulk/{orgs}/{baseName}/{tableName}": { "/api/v1/db/data/bulk/{orgs}/{baseName}/{tableName}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -10733,7 +10733,7 @@
] ]
} }
}, },
"/api/v1/data/bulk/{orgs}/{baseName}/{tableName}/all": { "/api/v1/db/data/bulk/{orgs}/{baseName}/{tableName}/all": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -10890,7 +10890,7 @@
] ]
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/views/{viewName}/export/{type}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/views/{viewName}/export/{type}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -10976,7 +10976,7 @@
] ]
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/export/{type}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/export/{type}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -11054,7 +11054,7 @@
] ]
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/{rowId}/{relationType}/{columnName}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/{rowId}/{relationType}/{columnName}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -11166,7 +11166,7 @@
"description": "List all nested relations rows" "description": "List all nested relations rows"
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId}": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -11391,7 +11391,7 @@
] ]
} }
}, },
"/api/v1/data/{orgs}/{baseName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude": { "/api/v1/db/data/{orgs}/{baseName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {

30
packages/nocodb/src/services/api-docs/swagger/templates/paths.ts

@ -25,7 +25,7 @@ export const getModelPaths = async (ctx: {
columns: SwaggerColumn[]; columns: SwaggerColumn[];
baseName: string; baseName: string;
}): Promise<{ [path: string]: any }> => ({ }): Promise<{ [path: string]: any }> => ({
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}`]: { [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}`]: {
get: { get: {
summary: `${ctx.tableName} list`, summary: `${ctx.tableName} list`,
operationId: `${ctx.tableName.toLowerCase()}-db-table-row-list`, operationId: `${ctx.tableName.toLowerCase()}-db-table-row-list`,
@ -84,7 +84,7 @@ export const getModelPaths = async (ctx: {
} }
: {}), : {}),
}, },
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/{rowId}`]: { [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/{rowId}`]: {
parameters: [rowIdParam], parameters: [rowIdParam],
...(ctx.type === ModelTypes.TABLE ...(ctx.type === ModelTypes.TABLE
? { ? {
@ -149,7 +149,7 @@ export const getModelPaths = async (ctx: {
} }
: {}), : {}),
}, },
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/count`]: { [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/count`]: {
get: { get: {
summary: `${ctx.tableName} count`, summary: `${ctx.tableName} count`,
operationId: `${ctx.tableName.toLowerCase()}-count`, operationId: `${ctx.tableName.toLowerCase()}-count`,
@ -168,7 +168,7 @@ export const getModelPaths = async (ctx: {
}, },
}, },
}, },
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/find-one`]: { [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/find-one`]: {
get: { get: {
summary: `${ctx.tableName} find-one`, summary: `${ctx.tableName} find-one`,
operationId: `${ctx.tableName.toLowerCase()}-db-table-row-find-one`, operationId: `${ctx.tableName.toLowerCase()}-db-table-row-find-one`,
@ -189,7 +189,7 @@ export const getModelPaths = async (ctx: {
}, },
}, },
}, },
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/groupby`]: { [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/groupby`]: {
get: { get: {
summary: `${ctx.tableName} groupby`, summary: `${ctx.tableName} groupby`,
operationId: `${ctx.tableName.toLowerCase()}-groupby`, operationId: `${ctx.tableName.toLowerCase()}-groupby`,
@ -230,7 +230,7 @@ export const getModelPaths = async (ctx: {
}, },
...(ctx.type === ModelTypes.TABLE ...(ctx.type === ModelTypes.TABLE
? { ? {
[`/api/v1/data/bulk/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}`]: { [`/api/v1/db/data/bulk/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}`]: {
post: { post: {
summary: `${ctx.tableName} bulk insert`, summary: `${ctx.tableName} bulk insert`,
description: description:
@ -304,7 +304,7 @@ export const getModelPaths = async (ctx: {
}, },
}, },
}, },
[`/api/v1/data/bulk/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/all`]: [`/api/v1/db/data/bulk/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/all`]:
{ {
parameters: [whereParam], parameters: [whereParam],
patch: { patch: {
@ -352,7 +352,7 @@ export const getModelPaths = async (ctx: {
...(isRelationExist(ctx.columns) ...(isRelationExist(ctx.columns)
? { ? {
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/{rowId}/{relationType}/{columnName}`]: [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/{rowId}/{relationType}/{columnName}`]:
{ {
parameters: [ parameters: [
rowIdParam, rowIdParam,
@ -376,7 +376,7 @@ export const getModelPaths = async (ctx: {
parameters: [limitParam, offsetParam], parameters: [limitParam, offsetParam],
}, },
}, },
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/{rowId}/{relationType}/{columnName}/{refRowId}`]: [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/{rowId}/{relationType}/{columnName}/{refRowId}`]:
{ {
parameters: [ parameters: [
rowIdParam, rowIdParam,
@ -417,7 +417,7 @@ export const getModelPaths = async (ctx: {
tags: [ctx.tableName], tags: [ctx.tableName],
}, },
}, },
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/{rowId}/{relationType}/{columnName}/exclude`]: [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/{rowId}/{relationType}/{columnName}/exclude`]:
{ {
parameters: [ parameters: [
rowIdParam, rowIdParam,
@ -446,7 +446,7 @@ export const getModelPaths = async (ctx: {
: {}), : {}),
} }
: {}), : {}),
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/export/{type}`]: { [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/export/{type}`]: {
parameters: [exportTypeParam], parameters: [exportTypeParam],
get: { get: {
summary: 'Rows export', summary: 'Rows export',
@ -478,7 +478,7 @@ export const getViewPaths = async (ctx: {
baseName: string; baseName: string;
columns: SwaggerColumn[]; columns: SwaggerColumn[];
}): Promise<any> => ({ }): Promise<any> => ({
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/views/${ctx.viewName}`]: [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/views/${ctx.viewName}`]:
{ {
get: { get: {
summary: `${ctx.viewName} list`, summary: `${ctx.viewName} list`,
@ -535,7 +535,7 @@ export const getViewPaths = async (ctx: {
} }
: {}), : {}),
}, },
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/views/${ctx.viewName}/count`]: [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/views/${ctx.viewName}/count`]:
{ {
get: { get: {
summary: `${ctx.viewName} count`, summary: `${ctx.viewName} count`,
@ -562,7 +562,7 @@ export const getViewPaths = async (ctx: {
}, },
...(ctx.type === ModelTypes.TABLE ...(ctx.type === ModelTypes.TABLE
? { ? {
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/views/${ctx.viewName}/{rowId}`]: [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/views/${ctx.viewName}/{rowId}`]:
{ {
parameters: [rowIdParam], parameters: [rowIdParam],
get: { get: {
@ -625,7 +625,7 @@ export const getViewPaths = async (ctx: {
}, },
} }
: {}), : {}),
[`/api/v1/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/views/${ctx.viewName}/export/{type}`]: [`/api/v1/db/data/${ctx.orgs}/${ctx.baseName}/${ctx.tableName}/views/${ctx.viewName}/export/{type}`]:
{ {
parameters: [exportTypeParam], parameters: [exportTypeParam],
get: { get: {

10
packages/nocodb/tests/unit/rest/tests/tableRow.test.ts

@ -1440,7 +1440,7 @@ function tableTest() {
// console.log(formulaColumn); // console.log(formulaColumn);
// const response = await request(context.app) // const response = await request(context.app)
// .get(`/api/v1/data/noco/${sakilaProject.id}/${customerTable.id}`) // .get(`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}`)
// .set('xc-auth', context.token) // .set('xc-auth', context.token)
// .query({ // .query({
// sortArrJson: JSON.stringify([ // sortArrJson: JSON.stringify([
@ -1939,7 +1939,7 @@ function tableTest() {
// const rows = await listRow({ base, table }); // const rows = await listRow({ base, table });
// await request(context.app) // await request(context.app)
// .delete(`/api/v1/data/bulk/noco/${base.id}/${table.id}/all`) // .delete(`/api/v1/db/data/bulk/noco/${base.id}/${table.id}/all`)
// .set('xc-auth', context.token) // .set('xc-auth', context.token)
// .query({ filterArr: [ // .query({ filterArr: [
// { // {
@ -1976,7 +1976,7 @@ function tableTest() {
// (column) => column.title === 'Rentals' // (column) => column.title === 'Rentals'
// )!; // )!;
// const response = await request(context.app) // const response = await request(context.app)
// .get(`/api/v1/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}`) // .get(`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}`)
// .query({ // .query({
// fields: visibleColumns.map((c) => c.title), // fields: visibleColumns.map((c) => c.title),
// }) // })
@ -2002,12 +2002,12 @@ function tableTest() {
// const refId = 1; // const refId = 1;
// await request(context.app) // await request(context.app)
// .post(`/api/v1/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/${refId}`) // .post(`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/${refId}`)
// .set('xc-auth', context.token) // .set('xc-auth', context.token)
// .expect(400) // .expect(400)
// await request(context.app) // await request(context.app)
// .post(`/api/v1/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/${refId}`) // .post(`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/${refId}`)
// .set('xc-auth', context.token) // .set('xc-auth', context.token)
// .expect(400) // .expect(400)
// }) // })

Loading…
Cancel
Save