From bf048ce29448dc894041bbbbd51b67b13bc9419e Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 12 Apr 2022 01:36:51 +0530 Subject: [PATCH] refactor: new api design Signed-off-by: Pranav C --- .../spreadsheet/components/columnFilter.vue | 16 +- .../spreadsheet/components/sortListMenu.vue | 4 +- .../project/spreadsheet/rowsXcDataTable.vue | 11 +- packages/nc-gui/mixins/device.js | 4 +- packages/nc-gui/store/project.js | 8 +- packages/nocodb-sdk/src/lib/Api.ts | 2018 +++++++-------- packages/nocodb/package.json | 2 +- packages/nocodb/src/lib/noco-models/User.ts | 7 + .../src/lib/noco/meta/api/apiTokenApis.ts | 6 +- .../nocodb/src/lib/noco/meta/api/auditApis.ts | 24 +- .../nocodb/src/lib/noco/meta/api/cacheApis.ts | 4 +- .../src/lib/noco/meta/api/columnApis.ts | 29 +- .../noco/meta/api/dataApis/dataAliasApis.ts | 28 +- .../meta/api/dataApis/dataAliasNestedApis.ts | 308 +++ .../lib/noco/meta/api/dataApis/dataApis.ts | 4 +- .../lib/noco/meta/api/dataApis/oldDataApis.ts | 2 +- .../src/lib/noco/meta/api/filterApis.ts | 52 +- .../src/lib/noco/meta/api/formViewApis.ts | 14 +- .../lib/noco/meta/api/formViewColumnApis.ts | 4 +- .../src/lib/noco/meta/api/galleryViewApis.ts | 33 +- .../src/lib/noco/meta/api/gridViewApis.ts | 2 +- .../lib/noco/meta/api/gridViewColumnApis.ts | 6 +- .../nocodb/src/lib/noco/meta/api/hookApis.ts | 27 +- .../src/lib/noco/meta/api/hookFilterApis.ts | 2 +- .../src/lib/noco/meta/api/metaDiffApis.ts | 7 +- .../lib/noco/meta/api/modelVisibilityApis.ts | 2 +- .../src/lib/noco/meta/api/pluginApis.ts | 22 +- .../src/lib/noco/meta/api/projectApis.ts | 19 +- .../src/lib/noco/meta/api/projectUserApis.ts | 2 +- .../meta/api/publicApis/publicDataApis.ts | 2 +- .../meta/api/publicApis/publicMetaApis.ts | 22 +- .../src/lib/noco/meta/api/sharedBaseApis.ts | 22 +- .../nocodb/src/lib/noco/meta/api/sortApis.ts | 24 +- .../nocodb/src/lib/noco/meta/api/tableApis.ts | 21 +- .../noco/meta/api/userApi/initStrategies.ts | 7 +- .../src/lib/noco/meta/api/userApi/userApis.ts | 51 +- .../nocodb/src/lib/noco/meta/api/utilApis.ts | 7 +- .../nocodb/src/lib/noco/meta/api/viewApis.ts | 32 +- .../src/lib/noco/meta/api/viewColumnApis.ts | 14 +- scripts/sdk/swagger.json | 2214 ++++++++--------- 40 files changed, 2594 insertions(+), 2489 deletions(-) create mode 100644 packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasNestedApis.ts diff --git a/packages/nc-gui/components/project/spreadsheet/components/columnFilter.vue b/packages/nc-gui/components/project/spreadsheet/components/columnFilter.vue index 47f9ba6959..d5d0310682 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/columnFilter.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/columnFilter.vue @@ -321,19 +321,19 @@ export default { for (const [i, filter] of Object.entries(this.filters)) { if (filter.status === 'delete') { if (this.hookId || hookId) { - await this.$api.dbTableFilter.delete(this.hookId || hookId, filter.id) + await this.$api.dbTableFilter.delete(filter.id) } else { - await this.$api.dbTableFilter.delete(this.viewId, filter.id) + await this.$api.dbTableFilter.delete(filter.id) } } else if (filter.status === 'update') { if (filter.id) { if (this.hookId || hookId) { - await this.$api.dbTableFilter.update(this.hookId || hookId, filter.id, { + await this.$api.dbTableFilter.update(filter.id, { ...filter, fk_parent_id: this.parentId }) } else { - await this.$api.dbTableFilter.update(this.viewId, filter.id, { + await this.$api.dbTableFilter.update(filter.id, { ...filter, fk_parent_id: this.parentId }) @@ -363,12 +363,12 @@ export default { let filters = [] if (this.viewId && this._isUIAllowed('filterSync')) { filters = this.parentId - ? (await this.$api.dbTableFilter.childrenRead(this.viewId, this.parentId)) + ? (await this.$api.dbTableFilter.childrenRead(this.parentId)) : (await this.$api.dbTableFilter.read(this.viewId)) } if (this.hookId && this._isUIAllowed('filterSync')) { filters = this.parentId - ? (await this.$api.dbTableWebhookFilter.childrenRead(this.hookId, this.parentId)) + ? (await this.$api.dbTableFilter.childrenRead(this.parentId)) : (await this.$api.dbTableWebhookFilter.read(this.hookId)) } @@ -406,7 +406,7 @@ export default { } else if (!this.autoApply) { filter.status = 'update' } else if (filter.id) { - await this.$api.dbTableFilter.update(this.viewId, filter.id, { + await this.$api.dbTableFilter.update(filter.id, { ...filter, fk_parent_id: this.parentId }) @@ -430,7 +430,7 @@ export default { if (!this.autoApply) { this.$set(filter, 'status', 'delete') } else { - await this.$api.dbTableFilter.delete(this.viewId, filter.id) + await this.$api.dbTableFilter.delete(filter.id) await this.loadFilter() this.$emit('updated') } diff --git a/packages/nc-gui/components/project/spreadsheet/components/sortListMenu.vue b/packages/nc-gui/components/project/spreadsheet/components/sortListMenu.vue index 2b6870d640..f4154558c6 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/sortListMenu.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/sortListMenu.vue @@ -148,7 +148,7 @@ export default { async saveOrUpdate(sort, i) { if (!this.shared && this._isUIAllowed('sortSync')) { if (sort.id) { - await this.$api.dbTableSort.update(this.viewId, sort.id, sort) + await this.$api.dbTableSort.update(sort.id, sort) } else { this.$set(this.sortList, i, (await this.$api.dbTableSort.create(this.viewId, sort))) } @@ -161,7 +161,7 @@ export default { }, async deleteSort(sort, i) { if (!this.shared && sort.id && this._isUIAllowed('sortSync')) { - await this.$api.dbTableSort.delete(this.viewId, sort.id) + await this.$api.dbTableSort.delete(sort.id) await this.loadSortList() } else { this.sortList.splice(i, 1) diff --git a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue index 75844f818d..d4efdd8036 100644 --- a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue +++ b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue @@ -973,8 +973,7 @@ export default { if (this.nodes.newTable && !this.nodes.tableCreated) { const columns = this.sqlUi.getNewTableColumns().filter(col => this.nodes.newTable.columns.includes(col.column_name)) await this.$api.dbTable.create( - this.$store.state.project.projectId, - this.$store.state.project.project.bases[0].id, + this.projectId, { table_name: this.nodes.table_name, title: this.nodes.title, @@ -1050,7 +1049,11 @@ export default { }, {}) // const insertedData = await this.api.insert(insertObj) - const insertedData = (await this.$api.data.create(this.meta.id, insertObj)) + const insertedData = (await this.$api.dbTableRow.create( + 'noco', + this.projectName, + this.meta.title, insertObj + )) this.data.splice(row, 1, { row: insertedData, @@ -1309,7 +1312,7 @@ export default { const { list, pageInfo - } = (await this.$api.dbViewRow.list('noco', this.$store.getters['project/GtrProjectName'], this.meta.title, this.selectedView.title, + } = (await this.$api.dbViewRow.list('noco', this.projectName, this.meta.title, this.selectedView.title, { ...this.queryParams, ...(this._isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(this.sortList) }), diff --git a/packages/nc-gui/mixins/device.js b/packages/nc-gui/mixins/device.js index 09e062e8cf..9e40525e7e 100644 --- a/packages/nc-gui/mixins/device.js +++ b/packages/nc-gui/mixins/device.js @@ -52,7 +52,9 @@ export default { return zhLan.some(l => browserLan.includes(l)) }, ...mapGetters({ - _isUIAllowed: 'users/GtrIsUIAllowed' + _isUIAllowed: 'users/GtrIsUIAllowed', + projectName: 'project/GtrProjectName', + projectId: 'project/GtrProjectId' }) }, mounted() { diff --git a/packages/nc-gui/store/project.js b/packages/nc-gui/store/project.js index 931fe19538..d43cb088af 100644 --- a/packages/nc-gui/store/project.js +++ b/packages/nc-gui/store/project.js @@ -192,10 +192,13 @@ export const getters = { return data }, GtrProjectName(state) { - return state.project && state.project.title// state.unserializedList && state.unserializedList[0] ? state.unserializedList[0].projectJson.title : "__project__"; + return state.project && state.project.title + }, + GtrProjectId(state) { + return state.project && state.project.id }, GtrProjectPrefix(state) { - return state.project && state.project.prefix//state.unserializedList && state.unserializedList[0] ? state.unserializedList[0].projectJson.prefix : null; + return state.project && state.project.prefix }, GtrApiEnvironment(state) { @@ -368,7 +371,6 @@ export const actions = { const tables = (await this.$api.dbTable.list( state.projectId, - state.project.bases[0].id, { includeM2M: rootState.windows.includeM2M || '' })).list diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index 9ddcf95453..898fe65392 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -34,6 +34,12 @@ export interface UserType { createDate?: string; } +export interface PageReqQueryParamsType { + offset?: number; + limit?: number; + query?: string; +} + export interface UserListType { users: { list: UserType; pageInfo: PaginatedType }; } @@ -944,27 +950,6 @@ export class Api< ...params, }), - /** - * No description - * - * @tags Auth - * @name TokenVerify - * @summary Password Verify - * @request POST:/auth/token/verify - * @response `200` `void` OK - */ - tokenVerify: ( - data: { token?: string; email?: string }, - params: RequestParams = {} - ) => - this.request({ - path: `/auth/token/verify`, - method: 'POST', - body: data, - type: ContentType.Json, - ...params, - }), - /** * No description * @@ -987,7 +972,7 @@ export class Api< * @tags Auth * @name ProjectUserList * @summary Project Users - * @request GET:/projects/{projectId}/users + * @request GET:/api/v1/db/meta/projects/{projectId}/users * @response `200` `{ users?: { list: (UserType)[], pageInfo: PaginatedType } }` OK */ projectUserList: (projectId: string, params: RequestParams = {}) => @@ -995,7 +980,7 @@ export class Api< { users?: { list: UserType[]; pageInfo: PaginatedType } }, any >({ - path: `/projects/${projectId}/users`, + path: `/api/v1/db/meta/projects/${projectId}/users`, method: 'GET', format: 'json', ...params, @@ -1007,7 +992,7 @@ export class Api< * @tags Auth * @name ProjectUserAdd * @summary Project User Add - * @request POST:/projects/{projectId}/users + * @request POST:/api/v1/db/meta/projects/{projectId}/users * @response `200` `any` OK */ projectUserAdd: ( @@ -1016,7 +1001,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/users`, + path: `/api/v1/db/meta/projects/${projectId}/users`, method: 'POST', body: data, type: ContentType.Json, @@ -1030,7 +1015,7 @@ export class Api< * @tags Auth * @name ProjectUserUpdate * @summary Project User Update - * @request PUT:/projects/{projectId}/users/{userId} + * @request PATCH:/api/v1/db/meta/projects/{projectId}/users/{userId} * @response `200` `any` OK */ projectUserUpdate: ( @@ -1040,8 +1025,8 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/users/${userId}`, - method: 'PUT', + path: `/api/v1/db/meta/projects/${projectId}/users/${userId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -1054,7 +1039,7 @@ export class Api< * @tags Auth * @name ProjectUserRemove * @summary Project User Remove - * @request DELETE:/projects/{projectId}/users/{userId} + * @request DELETE:/api/v1/db/meta/projects/{projectId}/users/{userId} * @response `200` `any` OK */ projectUserRemove: ( @@ -1063,7 +1048,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/users/${userId}`, + path: `/api/v1/db/meta/projects/${projectId}/users/${userId}`, method: 'DELETE', format: 'json', ...params, @@ -1076,7 +1061,7 @@ export class Api< * @tags Project * @name MetaGet * @summary Project Info - * @request GET:/projects/{projectId}/info + * @request GET:/api/v1/db/meta/projects/{projectId}/info * @response `200` `{ Node?: string, Arch?: string, Platform?: string, Docker?: boolean, Database?: string, ProjectOnRootDB?: string, RootDB?: string, PackageVersion?: string }` OK */ metaGet: (projectId: string, params: RequestParams = {}) => @@ -1093,7 +1078,7 @@ export class Api< }, any >({ - path: `/projects/${projectId}/info`, + path: `/api/v1/db/meta/projects/${projectId}/info`, method: 'GET', format: 'json', ...params, @@ -1105,7 +1090,7 @@ export class Api< * @tags Project * @name ModelVisibilityList * @summary UI ACL - * @request GET:/projects/{projectId}/modelVisibility + * @request GET:/api/v1/db/meta/projects/{projectId}/visibility-rules * @response `200` `(any)[]` OK */ modelVisibilityList: ( @@ -1114,7 +1099,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/modelVisibility`, + path: `/api/v1/db/meta/projects/${projectId}/visibility-rules`, method: 'GET', query: query, format: 'json', @@ -1126,7 +1111,7 @@ export class Api< * * @tags Project * @name ModelVisibilitySet - * @request POST:/projects/{projectId}/modelVisibility + * @request POST:/api/v1/db/meta/projects/{projectId}/visibility-rules * @response `200` `any` OK */ modelVisibilitySet: ( @@ -1135,7 +1120,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/modelVisibility`, + path: `/api/v1/db/meta/projects/${projectId}/visibility-rules`, method: 'POST', body: data, type: ContentType.Json, @@ -1148,7 +1133,7 @@ export class Api< * * @tags Project * @name List - * @request GET:/projects/ + * @request GET:/api/v1/db/meta/projects/ * @response `201` `ProjectListType` */ list: ( @@ -1156,7 +1141,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/`, + path: `/api/v1/db/meta/projects/`, method: 'GET', query: query, ...params, @@ -1167,7 +1152,7 @@ export class Api< * * @tags Project * @name Create - * @request POST:/projects/ + * @request POST:/api/v1/db/meta/projects/ * @response `200` `ProjectType` OK */ create: ( @@ -1175,7 +1160,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/`, + path: `/api/v1/db/meta/projects/`, method: 'POST', body: data, type: ContentType.Json, @@ -1188,12 +1173,12 @@ export class Api< * * @tags Project * @name Read - * @request GET:/projects/{projectId} + * @request GET:/api/v1/db/meta/projects/{projectId} * @response `200` `object` OK */ read: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}`, + path: `/api/v1/db/meta/projects/${projectId}`, method: 'GET', format: 'json', ...params, @@ -1204,12 +1189,12 @@ export class Api< * * @tags Project * @name Delete - * @request DELETE:/projects/{projectId} + * @request DELETE:/api/v1/db/meta/projects/{projectId} * @response `200` `void` OK */ delete: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}`, + path: `/api/v1/db/meta/projects/${projectId}`, method: 'DELETE', ...params, }), @@ -1219,12 +1204,12 @@ export class Api< * * @tags Project * @name SharedBaseGet - * @request GET:/projects/{projectId}/sharedBase + * @request GET:/api/v1/db/meta/projects/{projectId}/shared * @response `200` `{ uuid?: string, url?: string }` OK */ sharedBaseGet: (projectId: string, params: RequestParams = {}) => this.request<{ uuid?: string; url?: string }, any>({ - path: `/projects/${projectId}/sharedBase`, + path: `/api/v1/db/meta/projects/${projectId}/shared`, method: 'GET', format: 'json', ...params, @@ -1235,12 +1220,12 @@ export class Api< * * @tags Project * @name SharedBaseDisable - * @request DELETE:/projects/{projectId}/sharedBase + * @request DELETE:/api/v1/db/meta/projects/{projectId}/shared * @response `200` `void` OK */ sharedBaseDisable: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/sharedBase`, + path: `/api/v1/db/meta/projects/${projectId}/shared`, method: 'DELETE', ...params, }), @@ -1250,7 +1235,7 @@ export class Api< * * @tags Project * @name SharedBaseCreate - * @request POST:/projects/{projectId}/sharedBase + * @request POST:/api/v1/db/meta/projects/{projectId}/shared * @response `200` `{ url?: string, uuid?: string }` OK */ sharedBaseCreate: ( @@ -1259,7 +1244,7 @@ export class Api< params: RequestParams = {} ) => this.request<{ url?: string; uuid?: string }, any>({ - path: `/projects/${projectId}/sharedBase`, + path: `/api/v1/db/meta/projects/${projectId}/shared`, method: 'POST', body: data, type: ContentType.Json, @@ -1272,7 +1257,7 @@ export class Api< * * @tags Project * @name SharedBaseUpdate - * @request PUT:/projects/{projectId}/sharedBase + * @request PATCH:/api/v1/db/meta/projects/{projectId}/shared * @response `200` `void` OK */ sharedBaseUpdate: ( @@ -1281,8 +1266,8 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/sharedBase`, - method: 'PUT', + path: `/api/v1/db/meta/projects/${projectId}/shared`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, @@ -1293,12 +1278,12 @@ export class Api< * * @tags Project * @name MetaDiffSync - * @request POST:/projects/{projectId}/metaDiff + * @request POST:/api/v1/db/meta/projects/{projectId}/meta-diff * @response `200` `any` OK */ metaDiffSync: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/metaDiff`, + path: `/api/v1/db/meta/projects/${projectId}/meta-diff`, method: 'POST', format: 'json', ...params, @@ -1309,12 +1294,12 @@ export class Api< * * @tags Project * @name MetaDiffGet - * @request GET:/projects/{projectId}/metaDiff + * @request GET:/api/v1/db/meta/projects/{projectId}/meta-diff * @response `200` `any` OK */ metaDiffGet: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/metaDiff`, + path: `/api/v1/db/meta/projects/${projectId}/meta-diff`, method: 'GET', format: 'json', ...params, @@ -1325,7 +1310,7 @@ export class Api< * * @tags Project * @name AuditList - * @request GET:project/{projectId}/audits + * @request GET:/api/v1/db/meta/project/{projectId}/audits * @response `200` `{ list: (AuditType)[], pageInfo: PaginatedType }` OK */ auditList: ( @@ -1334,48 +1319,30 @@ export class Api< params: RequestParams = {} ) => this.request<{ list: AuditType[]; pageInfo: PaginatedType }, any>({ - path: `project/${projectId}/audits`, + path: `/api/v1/db/meta/project/${projectId}/audits`, method: 'GET', query: query, format: 'json', ...params, }), }; - public = { - /** - * @description Read project details - * - * @tags Public - * @name SharedBaseGet - * @request GET:/public/sharedBase/{sharedBaseUuid} - * @response `200` `{ project_id?: string }` OK - */ - sharedBaseGet: (sharedBaseUuid: string, params: RequestParams = {}) => - this.request<{ project_id?: string }, any>({ - path: `/public/sharedBase/${sharedBaseUuid}`, - method: 'GET', - format: 'json', - ...params, - }), - + dbTable = { /** * No description * - * @tags Public - * @name DataList - * @request POST:/public/data/{uuid}/list - * @response `200` `any` OK + * @tags DB Table + * @name Create + * @request POST:/api/v1/db/meta/projects/{projectId}/tables + * @response `200` `TableType` OK */ - dataList: ( - uuid: string, - data: { password?: string; sorts?: SortType[]; filters?: FilterType[] }, - query?: { limit?: string; offset?: string }, + create: ( + projectId: string, + data: TableReqType, params: RequestParams = {} ) => - this.request({ - path: `/public/data/${uuid}/list`, + this.request({ + path: `/api/v1/db/meta/projects/${projectId}/tables`, method: 'POST', - query: query, body: data, type: ContentType.Json, format: 'json', @@ -1385,47 +1352,40 @@ export class Api< /** * No description * - * @tags Public - * @name DataNestedList - * @request GET:/public/data/{uuid}/{rowId}/{relationType}/{columnId} - * @response `200` `any` OK + * @tags DB Table + * @name List + * @request GET:/api/v1/db/meta/projects/{projectId}/tables + * @response `200` `TableListType` */ - dataNestedList: ( - uuid: string, - rowId: string, - relationType: 'mm' | 'hm', - columnId: string, - query?: { limit?: string; offset?: string }, + list: ( + projectId: string, + query?: { + page?: number; + pageSize?: number; + sort?: string; + includeM2M?: boolean; + }, params: RequestParams = {} ) => - this.request({ - path: `/public/data/${uuid}/${rowId}/${relationType}/${columnId}`, + this.request({ + path: `/api/v1/db/meta/projects/${projectId}/tables`, method: 'GET', query: query, - format: 'json', ...params, }), /** * No description * - * @tags Public - * @name DataNestedExcludedList - * @request GET:/public/data/{uuid}/{rowId}/{relationType}/{columnId}/exclude - * @response `200` `any` OK + * @tags DB Table + * @name Read + * @request GET:/api/v1/db/meta/tables/{tableId} + * @response `200` `TableInfoType` OK */ - dataNestedExcludedList: ( - uuid: string, - rowId: string, - relationType: 'mm' | 'hm', - columnId: string, - query?: { limit?: string; offset?: string }, - params: RequestParams = {} - ) => - this.request({ - path: `/public/data/${uuid}/${rowId}/${relationType}/${columnId}/exclude`, + read: (tableId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}`, method: 'GET', - query: query, format: 'json', ...params, }), @@ -1433,21 +1393,21 @@ export class Api< /** * No description * - * @tags Public - * @name DataCreate - * @request POST:/public/data/{uuid}/create + * @tags DB Table + * @name Update + * @request PATCH:/api/v1/db/meta/tables/{tableId} * @response `200` `any` OK */ - dataCreate: ( - uuid: string, - data: { data?: any; password?: string }, + update: ( + tableId: string, + data: { title?: string }, params: RequestParams = {} ) => this.request({ - path: `/public/data/${uuid}/create`, - method: 'POST', + path: `/api/v1/db/meta/tables/${tableId}`, + method: 'PATCH', body: data, - type: ContentType.FormData, + type: ContentType.Json, format: 'json', ...params, }), @@ -1455,47 +1415,92 @@ export class Api< /** * No description * - * @tags Public - * @name CsvExport - * @request POST:/public/data/{uuid}/export/{type} - * @response `200` `any` OK + * @tags DB Table + * @name Delete + * @request DELETE:/api/v1/db/meta/tables/{tableId} + * @response `200` `void` OK */ - csvExport: ( - uuid: string, - type: 'csv' | 'excel', - data: { password?: string; filters?: FilterType[]; sorts?: SortType[] }, + delete: (tableId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}`, + method: 'DELETE', + ...params, + }), + + /** + * No description + * + * @tags DB Table + * @name Reorder + * @request POST:/api/v1/db/meta/tables/{tableId}/reorder + * @response `200` `void` OK + */ + reorder: ( + tableId: string, + data: { order?: string }, params: RequestParams = {} ) => - this.request({ - path: `/public/data/${uuid}/export/${type}`, + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/reorder`, method: 'POST', body: data, type: ContentType.Json, - wrapped: true, + ...params, + }), + }; + dbTableColumn = { + /** + * @description Read project details + * + * @tags DB Table column + * @name List + * @summary Column List + * @request GET:/api/v1/db/meta/tables/{tableId}/columns + * @response `200` `ColumnListType` + * @response `201` `ColumnType` Created + */ + list: (tableId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/columns`, + method: 'GET', ...params, }), /** * No description * - * @tags Public - * @name DataRelationList - * @request POST:/public/data/{uuid}/relationTable/{relationColumnId} - * @response `200` `any` OK + * @tags DB Table column + * @name Create + * @summary Column create + * @request POST:/api/v1/db/meta/tables/{tableId}/columns + * @response `200` `void` OK */ - dataRelationList: ( - uuid: string, - relationColumnId: string, - data: { password?: string }, - query?: { limit?: string; offset?: string }, + create: ( + tableId: string, + data: ColumnReqType, params: RequestParams = {} ) => - this.request({ - path: `/public/data/${uuid}/relationTable/${relationColumnId}`, + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/columns`, method: 'POST', - query: query, body: data, type: ContentType.Json, + ...params, + }), + + /** + * @description Read project details + * + * @tags DB Table column + * @name Read + * @summary Column Read + * @request GET:/api/v1/db/meta/tables/{tableId}/columns/{columnId} + * @response `200` `ColumnType` OK + */ + read: (tableId: string, columnId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/columns/${columnId}`, + method: 'GET', format: 'json', ...params, }), @@ -1503,45 +1508,74 @@ export class Api< /** * No description * - * @tags Public - * @name SharedViewMetaGet - * @request POST:/public/meta/{uuid} - * @response `200` `object` OK + * @tags DB Table column + * @name Update + * @summary Column Update + * @request PATCH:/api/v1/db/meta/tables/{tableId}/columns/{columnId} + * @response `200` `ColumnType` OK */ - sharedViewMetaGet: ( - uuid: string, - data: { password?: string }, + update: ( + tableId: string, + columnId: string, + data: ColumnReqType, params: RequestParams = {} ) => - this.request({ - path: `/public/meta/${uuid}`, - method: 'POST', + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/columns/${columnId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', ...params, }), - }; - dbView = { + /** * No description * - * @tags DB View - * @name Upload - * @summary Attachment - * @request POST:/projects/{projectId}/views/{viewId}/upload + * @tags DB Table column + * @name Delete + * @request DELETE:/api/v1/db/meta/tables/{tableId}/columns/{columnId} + * @response `200` `void` OK */ - upload: ( - projectId: string, - viewId: string, - data: { files?: any; json?: string }, + delete: (tableId: string, columnId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/columns/${columnId}`, + method: 'DELETE', + ...params, + }), + + /** + * No description + * + * @tags DB Table column + * @name PrimaryColumnSet + * @request POST:/api/v1/db/meta/tables/{tableId}/columns/{columnId}/primary + * @response `200` `void` OK + */ + primaryColumnSet: ( + tableId: string, + columnId: string, params: RequestParams = {} ) => - this.request({ - path: `/projects/${projectId}/views/${viewId}/upload`, + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/columns/${columnId}/primary`, method: 'POST', - body: data, - type: ContentType.FormData, + ...params, + }), + }; + dbView = { + /** + * No description + * + * @tags DB View + * @name List + * @request GET:/api/v1/db/meta/tables/{tableId}/views + * @response `200` `ViewListType` + */ + list: (tableId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/views`, + method: 'GET', ...params, }), @@ -1550,7 +1584,7 @@ export class Api< * * @tags DB View * @name Update - * @request PUT:/views/{viewId} + * @request PATCH:/api/v1/db/meta/views/{viewId} * @response `200` `void` OK */ update: ( @@ -1564,8 +1598,8 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/views/${viewId}`, - method: 'PUT', + path: `/api/v1/db/meta/views/${viewId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, @@ -1576,12 +1610,12 @@ export class Api< * * @tags DB View * @name Delete - * @request DELETE:/views/{viewId} + * @request DELETE:/api/v1/db/meta/views/{viewId} * @response `200` `void` OK */ delete: (viewId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}`, + path: `/api/v1/db/meta/views/${viewId}`, method: 'DELETE', ...params, }), @@ -1591,7 +1625,7 @@ export class Api< * * @tags DB View * @name ShowAllColumn - * @request POST:/views/{viewId}/showAll + * @request POST:/api/v1/db/meta/views/{viewId}/showAll * @response `200` `void` OK */ showAllColumn: ( @@ -1600,7 +1634,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/views/${viewId}/showAll`, + path: `/api/v1/db/meta/views/${viewId}/showAll`, method: 'POST', query: query, ...params, @@ -1611,7 +1645,7 @@ export class Api< * * @tags DB View * @name HideAllColumn - * @request POST:/views/{viewId}/hideAll + * @request POST:/api/v1/db/meta/views/{viewId}/hideAll * @response `200` `void` OK */ hideAllColumn: ( @@ -1620,7 +1654,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/views/${viewId}/hideAll`, + path: `/api/v1/db/meta/views/${viewId}/hideAll`, method: 'POST', query: query, ...params, @@ -1631,12 +1665,12 @@ export class Api< * * @tags DB View * @name GridCreate - * @request POST:/tables/{tableId}/grids + * @request POST:/api/v1/db/meta/tables/{tableId}/grids * @response `200` `GridType` OK */ gridCreate: (tableId: string, data: GridType, params: RequestParams = {}) => this.request({ - path: `/tables/${tableId}/grids`, + path: `/api/v1/db/meta/tables/${tableId}/grids`, method: 'POST', body: data, type: ContentType.Json, @@ -1648,14 +1682,17 @@ export class Api< * No description * * @tags DB View - * @name GridUpdate - * @request PUT:/tables/{tableId}/grids/{gridId} - * @response `200` `void` OK + * @name FormCreate + * @request POST:/api/v1/db/meta/tables/{tableId}/forms + * @response `200` `FormType` OK */ - gridUpdate: (tableId: string, gridId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/grids/${gridId}`, - method: 'PUT', + formCreate: (tableId: string, data: FormType, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/forms`, + method: 'POST', + body: data, + type: ContentType.Json, + format: 'json', ...params, }), @@ -1663,62 +1700,14 @@ export class Api< * No description * * @tags DB View - * @name GridDelete - * @request DELETE:/tables/{tableId}/grids/{gridId} + * @name FormUpdate + * @request PATCH:/api/v1/db/meta/forms/{formId} * @response `200` `void` OK */ - gridDelete: (tableId: string, gridId: string, params: RequestParams = {}) => + formUpdate: (formId: string, data: FormType, params: RequestParams = {}) => this.request({ - path: `/tables/${tableId}/grids/${gridId}`, - method: 'DELETE', - ...params, - }), - - /** - * No description - * - * @tags DB View - * @name GridRead - * @request GET:/tables/{tableId}/grids/{gridId} - * @response `200` `void` OK - */ - gridRead: (tableId: string, gridId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/grids/${gridId}`, - method: 'GET', - ...params, - }), - - /** - * No description - * - * @tags DB View - * @name FormCreate - * @request POST:/tables/{tableId}/forms - * @response `200` `FormType` OK - */ - formCreate: (tableId: string, data: FormType, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/forms`, - method: 'POST', - body: data, - type: ContentType.Json, - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB View - * @name FormUpdate - * @request PUT:/forms/{formId} - * @response `200` `void` OK - */ - formUpdate: (formId: string, data: FormType, params: RequestParams = {}) => - this.request({ - path: `/forms/${formId}`, - method: 'PUT', + path: `/api/v1/db/meta/forms/${formId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, @@ -1729,12 +1718,12 @@ export class Api< * * @tags DB View * @name FormRead - * @request GET:/forms/{formId} + * @request GET:/api/v1/db/meta/forms/{formId} * @response `200` `FormType` OK */ formRead: (formId: string, params: RequestParams = {}) => this.request({ - path: `/forms/${formId}`, + path: `/api/v1/db/meta/forms/${formId}`, method: 'GET', format: 'json', ...params, @@ -1745,17 +1734,17 @@ export class Api< * * @tags DB View * @name FormColumnUpdate - * @request PUT:/formColumns/{columnId} + * @request PATCH:/api/v1/db/meta/form/columns/{formViewColumnId} * @response `200` `any` OK */ formColumnUpdate: ( - columnId: string, + formViewColumnId: string, data: FormColumnType, params: RequestParams = {} ) => this.request({ - path: `/formColumns/${columnId}`, - method: 'PUT', + path: `/api/v1/db/meta/form/columns/${formViewColumnId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -1767,12 +1756,12 @@ export class Api< * * @tags DB View * @name GridColumnsList - * @request GET:/grid/{gidId}/gridColumns + * @request GET:/api/v1/db/meta/grids/{gidId}/grid/columns * @response `200` `(GridColumnType)[]` OK */ gridColumnsList: (gidId: string, params: RequestParams = {}) => this.request({ - path: `/grid/${gidId}/gridColumns`, + path: `/api/v1/db/meta/grids/${gidId}/grid/columns`, method: 'GET', format: 'json', ...params, @@ -1783,7 +1772,7 @@ export class Api< * * @tags DB View * @name GridColumnUpdate - * @request PUT:/gridColumns/{columnId} + * @request PATCH:/api/v1/db/meta/grid/columns/{columnId} * @response `200` `any` OK */ gridColumnUpdate: ( @@ -1792,8 +1781,8 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/gridColumns/${columnId}`, - method: 'PUT', + path: `/api/v1/db/meta/grid/columns/${columnId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -1805,7 +1794,7 @@ export class Api< * * @tags DB View * @name GalleryCreate - * @request POST:/tables/{tableId}/galleries + * @request POST:/api/v1/db/meta/tables/{tableId}/galleries * @response `200` `object` OK */ galleryCreate: ( @@ -1814,7 +1803,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/tables/${tableId}/galleries`, + path: `/api/v1/db/meta/tables/${tableId}/galleries`, method: 'POST', body: data, type: ContentType.Json, @@ -1827,7 +1816,7 @@ export class Api< * * @tags DB View * @name GalleryUpdate - * @request PUT:/galleries/{galleryId} + * @request PATCH:/api/v1/db/meta/galleries/{galleryId} * @response `200` `void` OK */ galleryUpdate: ( @@ -1836,39 +1825,24 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/galleries/${galleryId}`, - method: 'PUT', + path: `/api/v1/db/meta/galleries/${galleryId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, }), - /** - * No description - * - * @tags DB View - * @name GalleryDelete - * @request DELETE:/galleries/{galleryId} - * @response `200` `void` OK - */ - galleryDelete: (galleryId: string, params: RequestParams = {}) => - this.request({ - path: `/galleries/${galleryId}`, - method: 'DELETE', - ...params, - }), - /** * No description * * @tags DB View * @name GalleryRead - * @request GET:/galleries/{galleryId} + * @request GET:/api/v1/db/meta/galleries/{galleryId} * @response `200` `GalleryType` OK */ galleryRead: (galleryId: string, params: RequestParams = {}) => this.request({ - path: `/galleries/${galleryId}`, + path: `/api/v1/db/meta/galleries/${galleryId}`, method: 'GET', format: 'json', ...params, @@ -1878,150 +1852,138 @@ export class Api< * No description * * @tags DB View - * @name KanbanCreate - * @request POST:/tables/{tableId}/kanbans - * @response `200` `void` OK + * @name Upload + * @summary Attachment + * @request POST:/projects/{projectId}/views/{viewId}/upload */ - kanbanCreate: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/kanbans`, + upload: ( + projectId: string, + viewId: string, + data: { files?: any; json?: string }, + params: RequestParams = {} + ) => + this.request({ + path: `/projects/${projectId}/views/${viewId}/upload`, method: 'POST', + body: data, + type: ContentType.FormData, ...params, }), - + }; + dbViewShare = { /** * No description * - * @tags DB View - * @name KanbanUpdate - * @request PUT:/tables/{tableId}/kanbans/{kanbanId} - * @response `200` `void` OK + * @tags DB View Share + * @name List + * @summary Shared view list + * @request GET:/api/v1/db/meta/tables/{tableId}/share + * @response `200` `(any)[]` OK */ - kanbanUpdate: ( - tableId: string, - kanbanId: string, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/kanbans/${kanbanId}`, - method: 'PUT', + list: (tableId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/tables/${tableId}/share`, + method: 'GET', + format: 'json', ...params, }), /** * No description * - * @tags DB View - * @name KanbanDelete - * @request DELETE:/tables/{tableId}/kanbans/{kanbanId} - * @response `200` `void` OK + * @tags DB View Share + * @name Create + * @request POST:/api/v1/db/meta/views/{viewId}/share + * @response `200` `{ uuid?: string }` OK */ - kanbanDelete: ( - tableId: string, - kanbanId: string, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/kanbans/${kanbanId}`, - method: 'DELETE', + create: (viewId: string, params: RequestParams = {}) => + this.request<{ uuid?: string }, any>({ + path: `/api/v1/db/meta/views/${viewId}/share`, + method: 'POST', + format: 'json', ...params, }), /** * No description * - * @tags DB View - * @name KanbanRead - * @request GET:/tables/{tableId}/kanbans/{kanbanId} - * @response `200` `void` OK + * @tags DB View Share + * @name Update + * @request PATCH:/api/v1/db/meta/views/{viewId}/share + * @response `200` `SharedViewType` OK */ - kanbanRead: ( - tableId: string, - kanbanId: string, + update: ( + viewId: string, + data: { password?: string }, params: RequestParams = {} ) => - this.request({ - path: `/tables/${tableId}/kanbans/${kanbanId}`, - method: 'GET', + this.request({ + path: `/api/v1/db/meta/views/${viewId}/share`, + method: 'PATCH', + body: data, + type: ContentType.Json, + format: 'json', ...params, }), /** * No description * - * @tags DB View - * @name List - * @request GET:/tables/{tableId}/views - * @response `200` `ViewListType` + * @tags DB View Share + * @name Delete + * @request DELETE:/api/v1/db/meta/views/{viewId}/share + * @response `200` `void` OK */ - list: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/views`, - method: 'GET', + delete: (viewId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/views/${viewId}/share`, + method: 'DELETE', ...params, }), }; - dbTable = { + dbViewColumn = { /** * No description * - * @tags DB Table - * @name Create - * @request POST:/projects/{projectId}/{baseId}/tables - * @response `200` `TableType` OK + * @tags DB View Column + * @name List + * @request GET:/api/v1/db/meta/views/{viewId}/columns */ - create: ( - projectId: string, - baseId: string, - data: TableReqType, - params: RequestParams = {} - ) => - this.request({ - path: `/projects/${projectId}/${baseId}/tables`, - method: 'POST', - body: data, - type: ContentType.Json, - format: 'json', + list: (viewId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/views/${viewId}/columns`, + method: 'GET', ...params, }), /** * No description * - * @tags DB Table - * @name List - * @request GET:/projects/{projectId}/{baseId}/tables - * @response `200` `TableListType` + * @tags DB View Column + * @name Create + * @request POST:/api/v1/db/meta/views/{viewId}/columns + * @response `200` `void` OK */ - list: ( - projectId: string, - baseId: string, - query?: { - page?: number; - pageSize?: number; - sort?: string; - includeM2M?: boolean; - }, - params: RequestParams = {} - ) => - this.request({ - path: `/projects/${projectId}/${baseId}/tables`, - method: 'GET', - query: query, + create: (viewId: string, data: any, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/views/${viewId}/columns`, + method: 'POST', + body: data, + type: ContentType.Json, ...params, }), /** * No description * - * @tags DB Table + * @tags DB View Column * @name Read - * @request GET:/tables/{tableId} - * @response `200` `TableInfoType` OK + * @request GET:/api/v1/db/meta/views/{viewId}/columns/{columnId} + * @response `200` `any` OK */ - read: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}`, + read: (viewId: string, columnId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/views/${viewId}/columns/${columnId}`, method: 'GET', format: 'json', ...params, @@ -2030,399 +1992,103 @@ export class Api< /** * No description * - * @tags DB Table + * @tags DB View Column * @name Update - * @request PUT:/tables/{tableId} - * @response `200` `any` OK + * @request PATCH:/api/v1/db/meta/views/{viewId}/columns/{columnId} + * @response `200` `void` OK */ update: ( - tableId: string, - data: { title?: string }, + viewId: string, + columnId: string, + data: any, params: RequestParams = {} ) => - this.request({ - path: `/tables/${tableId}`, - method: 'PUT', + this.request({ + path: `/api/v1/db/meta/views/${viewId}/columns/${columnId}`, + method: 'PATCH', body: data, type: ContentType.Json, - format: 'json', ...params, }), - + }; + dbTableSort = { /** * No description * - * @tags DB Table - * @name Delete - * @request DELETE:/tables/{tableId} - * @response `200` `void` OK + * @tags DB Table Sort + * @name List + * @request GET:/api/v1/db/meta/views/{viewId}/sorts + * @response `200` `{ uuid?: string, url?: string }` OK */ - delete: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}`, - method: 'DELETE', + list: (viewId: string, params: RequestParams = {}) => + this.request<{ uuid?: string; url?: string }, any>({ + path: `/api/v1/db/meta/views/${viewId}/sorts`, + method: 'GET', + format: 'json', ...params, }), /** * No description * - * @tags DB Table - * @name Reorder - * @request POST:/tables/{tableId}/reorder + * @tags DB Table Sort + * @name Create + * @request POST:/api/v1/db/meta/views/{viewId}/sorts * @response `200` `void` OK */ - reorder: ( - tableId: string, - data: { order?: string }, - params: RequestParams = {} - ) => + create: (viewId: string, data: SortType, params: RequestParams = {}) => this.request({ - path: `/tables/${tableId}/reorder`, + path: `/api/v1/db/meta/views/${viewId}/sorts`, method: 'POST', body: data, type: ContentType.Json, ...params, }), - }; - dbTableColumn = { + /** - * @description Read project details + * No description * - * @tags DB Table column - * @name List - * @summary Column List - * @request GET:/tables/{tableId}/columns - * @response `200` `ColumnListType` - * @response `201` `ColumnType` Created + * @tags DB Table Sort + * @name Get + * @request GET:/api/v1/db/meta/sorts/{sortId} + * @response `200` `SortType` OK */ - list: (tableId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/columns`, + get: (sortId: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/db/meta/sorts/${sortId}`, method: 'GET', + format: 'json', ...params, }), /** * No description * - * @tags DB Table column - * @name Create - * @summary Column create - * @request POST:/tables/{tableId}/columns + * @tags DB Table Sort + * @name Update + * @request PATCH:/api/v1/db/meta/sorts/{sortId} * @response `200` `void` OK */ - create: ( - tableId: string, - data: ColumnReqType, - params: RequestParams = {} - ) => + update: (sortId: string, data: SortType, params: RequestParams = {}) => this.request({ - path: `/tables/${tableId}/columns`, - method: 'POST', + path: `/api/v1/db/meta/sorts/${sortId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, }), /** - * @description Read project details + * No description * - * @tags DB Table column - * @name Read - * @summary Column Read - * @request GET:/tables/{tableId}/columns/{columnId} - * @response `200` `ColumnType` OK + * @tags DB Table Sort + * @name Delete + * @request DELETE:/api/v1/db/meta/sorts/{sortId} + * @response `200` `void` OK */ - read: (tableId: string, columnId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/columns/${columnId}`, - method: 'GET', - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB Table column - * @name Update - * @summary Column Update - * @request PUT:/tables/{tableId}/columns/{columnId} - * @response `200` `ColumnType` OK - */ - update: ( - tableId: string, - columnId: string, - data: ColumnReqType, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/columns/${columnId}`, - method: 'PUT', - body: data, - type: ContentType.Json, - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB Table column - * @name Delete - * @request DELETE:/tables/{tableId}/columns/{columnId} - * @response `200` `void` OK - */ - delete: (tableId: string, columnId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${tableId}/columns/${columnId}`, - method: 'DELETE', - ...params, - }), - - /** - * No description - * - * @tags DB Table column - * @name PrimaryColumnSet - * @request POST:/tables/{tableId}/columns/{columnId}/primary - * @response `200` `void` OK - */ - primaryColumnSet: ( - tableId: string, - columnId: string, - params: RequestParams = {} - ) => - this.request({ - path: `/tables/${tableId}/columns/${columnId}/primary`, - method: 'POST', - ...params, - }), - }; - dbViewColumn = { - /** - * No description - * - * @tags DB View Column - * @name List - * @request GET:/views/{viewId}/columns - */ - list: (viewId: string, params: RequestParams = {}) => - this.request({ - path: `/views/${viewId}/columns`, - method: 'GET', - ...params, - }), - - /** - * No description - * - * @tags DB View Column - * @name Create - * @request POST:/views/{viewId}/columns - * @response `200` `void` OK - */ - create: (viewId: string, data: any, params: RequestParams = {}) => - this.request({ - path: `/views/${viewId}/columns`, - method: 'POST', - body: data, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags DB View Column - * @name Read - * @request GET:/views/{viewId}/columns/{columnId} - * @response `200` `any` OK - */ - read: (viewId: string, columnId: string, params: RequestParams = {}) => - this.request({ - path: `/views/${viewId}/columns/${columnId}`, - method: 'GET', - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB View Column - * @name Update - * @request PUT:/views/{viewId}/columns/{columnId} - * @response `200` `void` OK - */ - update: ( - viewId: string, - columnId: string, - data: any, - params: RequestParams = {} - ) => - this.request({ - path: `/views/${viewId}/columns/${columnId}`, - method: 'PUT', - body: data, - type: ContentType.Json, - ...params, - }), - }; - dbViewShare = { - /** - * No description - * - * @tags DB View Share - * @name Create - * @request POST:/views/{viewId}/share - * @response `200` `{ uuid?: string }` OK - */ - create: (viewId: string, params: RequestParams = {}) => - this.request<{ uuid?: string }, any>({ - path: `/views/${viewId}/share`, - method: 'POST', - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB View Share - * @name Update - * @request PUT:/views/{viewId}/share - * @response `200` `SharedViewType` OK - */ - update: ( - viewId: string, - data: { password?: string }, - params: RequestParams = {} - ) => - this.request({ - path: `/views/${viewId}/share`, - method: 'PUT', - body: data, - type: ContentType.Json, - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB View Share - * @name Delete - * @request DELETE:/views/{viewId}/share - * @response `200` `void` OK - */ - delete: (viewId: string, params: RequestParams = {}) => - this.request({ - path: `/views/${viewId}/share`, - method: 'DELETE', - ...params, - }), - - /** - * No description - * - * @tags DB View Share - * @name List - * @request GET:/tables/{viewId}/share - * @response `200` `(any)[]` OK - */ - list: (viewId: string, params: RequestParams = {}) => - this.request({ - path: `/tables/${viewId}/share`, - method: 'GET', - format: 'json', - ...params, - }), - }; - dbTableSort = { - /** - * No description - * - * @tags DB Table Sort - * @name List - * @request GET:/views/{viewId}/sorts - * @response `200` `{ uuid?: string, url?: string }` OK - */ - list: (viewId: string, params: RequestParams = {}) => - this.request<{ uuid?: string; url?: string }, any>({ - path: `/views/${viewId}/sorts`, - method: 'GET', - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB Table Sort - * @name Create - * @request POST:/views/{viewId}/sorts - * @response `200` `void` OK - */ - create: (viewId: string, data: SortType, params: RequestParams = {}) => - this.request({ - path: `/views/${viewId}/sorts`, - method: 'POST', - body: data, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags DB Table Sort - * @name Get - * @request GET:/views/{viewId}/sorts/{sortId} - * @response `200` `SortType` OK - */ - get: (viewId: string, sortId: string, params: RequestParams = {}) => - this.request({ - path: `/views/${viewId}/sorts/${sortId}`, - method: 'GET', - format: 'json', - ...params, - }), - - /** - * No description - * - * @tags DB Table Sort - * @name Update - * @request PUT:/views/{viewId}/sorts/{sortId} - * @response `200` `void` OK - */ - update: ( - viewId: string, - sortId: string, - data: SortType, - params: RequestParams = {} - ) => - this.request({ - path: `/views/${viewId}/sorts/${sortId}`, - method: 'PUT', - body: data, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags DB Table Sort - * @name Delete - * @request DELETE:/views/{viewId}/sorts/{sortId} - * @response `200` `void` OK - */ - delete: (viewId: string, sortId: string, params: RequestParams = {}) => + delete: (sortId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/sorts/${sortId}`, + path: `/api/v1/db/meta/sorts/${sortId}`, method: 'DELETE', ...params, }), @@ -2433,12 +2099,12 @@ export class Api< * * @tags DB Table Filter * @name Read - * @request GET:/views/{viewId}/filters + * @request GET:/api/v1/db/meta/views/{viewId}/filters * @response `200` `FilterListType` */ read: (viewId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters`, + path: `/api/v1/db/meta/views/${viewId}/filters`, method: 'GET', ...params, }), @@ -2448,12 +2114,12 @@ export class Api< * * @tags DB Table Filter * @name Create - * @request POST:/views/{viewId}/filters + * @request POST:/api/v1/db/meta/views/{viewId}/filters * @response `200` `void` OK */ create: (viewId: string, data: FilterType, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters`, + path: `/api/v1/db/meta/views/${viewId}/filters`, method: 'POST', body: data, type: ContentType.Json, @@ -2465,12 +2131,12 @@ export class Api< * * @tags DB Table Filter * @name Get - * @request GET:/views/{viewId}/filters/{filterId} + * @request GET:/api/v1/db/meta/filters/{filterId} * @response `200` `FilterType` OK */ - get: (viewId: string, filterId: string, params: RequestParams = {}) => + get: (filterId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters/${filterId}`, + path: `/api/v1/db/meta/filters/${filterId}`, method: 'GET', format: 'json', ...params, @@ -2481,18 +2147,13 @@ export class Api< * * @tags DB Table Filter * @name Update - * @request PUT:/views/{viewId}/filters/{filterId} + * @request PATCH:/api/v1/db/meta/filters/{filterId} * @response `200` `void` OK */ - update: ( - viewId: string, - filterId: string, - data: FilterType, - params: RequestParams = {} - ) => + update: (filterId: string, data: FilterType, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters/${filterId}`, - method: 'PUT', + path: `/api/v1/db/meta/filters/${filterId}`, + method: 'PATCH', body: data, type: ContentType.Json, ...params, @@ -2503,12 +2164,12 @@ export class Api< * * @tags DB Table Filter * @name Delete - * @request DELETE:/views/{viewId}/filters/{filterId} + * @request DELETE:/api/v1/db/meta/filters/{filterId} * @response `200` `void` OK */ - delete: (viewId: string, filterId: string, params: RequestParams = {}) => + delete: (filterId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters/${filterId}`, + path: `/api/v1/db/meta/filters/${filterId}`, method: 'DELETE', ...params, }), @@ -2518,16 +2179,12 @@ export class Api< * * @tags DB Table Filter * @name ChildrenRead - * @request GET:/views/{viewId}/filters/{filterParentId}/children + * @request GET:/api/v1/db/meta/filters/{filterParentId}/children * @response `200` `FilterType` OK */ - childrenRead: ( - viewId: string, - filterParentId: string, - params: RequestParams = {} - ) => + childrenRead: (filterParentId: string, params: RequestParams = {}) => this.request({ - path: `/views/${viewId}/filters/${filterParentId}/children`, + path: `/api/v1/db/meta/filters/${filterParentId}/children`, method: 'GET', format: 'json', ...params, @@ -2539,12 +2196,12 @@ export class Api< * * @tags DB Table Webhook Filter * @name Read - * @request GET:/hooks/{hookId}/filters + * @request GET:/api/v1/db/meta/hooks/{hookId}/filters * @response `200` `FilterListType` */ read: (hookId: string, params: RequestParams = {}) => this.request({ - path: `/hooks/${hookId}/filters`, + path: `/api/v1/db/meta/hooks/${hookId}/filters`, method: 'GET', ...params, }), @@ -2554,29 +2211,83 @@ export class Api< * * @tags DB Table Webhook Filter * @name Create - * @request POST:/hooks/{hookId}/filters + * @request POST:/api/v1/db/meta/hooks/{hookId}/filters * @response `200` `void` OK */ create: (hookId: string, data: FilterType, params: RequestParams = {}) => this.request({ - path: `/hooks/${hookId}/filters`, + path: `/api/v1/db/meta/hooks/${hookId}/filters`, + method: 'POST', + body: data, + type: ContentType.Json, + ...params, + }), + }; + dbTableRow = { + /** + * No description + * + * @tags DB Table Row + * @name List + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName} + * @response `200` `any` OK + */ + list: ( + orgs: string, + projectName: string, + tableName: string, + query?: { fields?: any[]; sort?: any[]; where?: string }, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}`, + method: 'GET', + query: query, + format: 'json', + ...params, + }), + + /** + * No description + * + * @tags DB Table Row + * @name Create + * @request POST:/api/v1/db/data/{orgs}/{projectName}/{tableName} + * @response `200` `any` OK + */ + create: ( + orgs: string, + projectName: string, + tableName: string, + data: any, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}`, method: 'POST', body: data, type: ContentType.Json, + format: 'json', ...params, }), /** * No description * - * @tags DB Table Webhook Filter - * @name Get - * @request GET:/hooks/{viewId}/filters/{filterId} - * @response `200` `FilterType` OK + * @tags DB Table Row + * @name Read + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId} + * @response `201` `any` Created */ - get: (viewId: string, filterId: string, params: RequestParams = {}) => - this.request({ - path: `/hooks/${viewId}/filters/${filterId}`, + read: ( + orgs: string, + projectName: string, + tableName: string, + rowId: string, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}`, method: 'GET', format: 'json', ...params, @@ -2585,36 +2296,45 @@ export class Api< /** * No description * - * @tags DB Table Webhook Filter + * @tags DB Table Row * @name Update - * @request PUT:/hooks/{viewId}/filters/{filterId} - * @response `200` `void` OK + * @request PATCH:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId} + * @response `200` `any` OK */ update: ( - viewId: string, - filterId: string, - data: FilterType, + orgs: string, + projectName: string, + tableName: string, + rowId: string, + data: any, params: RequestParams = {} ) => - this.request({ - path: `/hooks/${viewId}/filters/${filterId}`, - method: 'PUT', + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}`, + method: 'PATCH', body: data, type: ContentType.Json, + format: 'json', ...params, }), /** * No description * - * @tags DB Table Webhook Filter - * @name Delete - * @request DELETE:/hooks/{viewId}/filters/{filterId} + * @tags DB Table Row + * @name ModelDelete + * @request DELETE:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId} * @response `200` `void` OK */ - delete: (viewId: string, filterId: string, params: RequestParams = {}) => + modelDelete: ( + orgs: string, + projectName: string, + tableName: string, + rowId: string, + params: RequestParams = {} + ) => this.request({ - path: `/hooks/${viewId}/filters/${filterId}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}`, method: 'DELETE', ...params, }), @@ -2622,36 +2342,23 @@ export class Api< /** * No description * - * @tags DB Table Webhook Filter - * @name ChildrenRead - * @request GET:/hooks/{viewId}/filters/{filterParentId}/children - * @response `200` `FilterType` OK + * @tags DB Table Row + * @name BulkCreate + * @request POST:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName} + * @response `200` `any` OK */ - childrenRead: ( - viewId: string, - filterParentId: string, + bulkCreate: ( + orgs: string, + projectName: string, + tableName: string, + data: any, params: RequestParams = {} ) => - this.request({ - path: `/hooks/${viewId}/filters/${filterParentId}/children`, - method: 'GET', - format: 'json', - ...params, - }), - }; - data = { - /** - * No description - * - * @tags Data - * @name List - * @request GET:/data/{tableId} - * @response `200` `any` OK - */ - list: (tableId: string, params: RequestParams = {}) => this.request({ - path: `/data/${tableId}`, - method: 'GET', + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}`, + method: 'POST', + body: data, + type: ContentType.Json, format: 'json', ...params, }), @@ -2659,15 +2366,23 @@ export class Api< /** * No description * - * @tags Data - * @name Create - * @request POST:/data/{tableId} + * @tags DB Table Row + * @name BulkCreate2 + * @request PATCH:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName} + * @originalName bulkCreate + * @duplicate * @response `200` `any` OK */ - create: (tableId: string, data: any, params: RequestParams = {}) => + bulkCreate2: ( + orgs: string, + projectName: string, + tableName: string, + data: any, + params: RequestParams = {} + ) => this.request({ - path: `/data/${tableId}`, - method: 'POST', + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -2675,43 +2390,53 @@ export class Api< }), /** - * @description CSV or Excel export + * No description * - * @tags Data - * @name CsvExport - * @request GET:/data/{tableId}/export/{type} + * @tags DB Table Row + * @name BulkCreate3 + * @request DELETE:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName} + * @originalName bulkCreate + * @duplicate * @response `200` `any` OK */ - csvExport: ( - tableId: string, - type: 'csv' | 'excel', + bulkCreate3: ( + orgs: string, + projectName: string, + tableName: string, + data: any, params: RequestParams = {} ) => this.request({ - path: `/data/${tableId}/export/${type}`, - method: 'GET', - wrapped: true, + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}`, + method: 'DELETE', + body: data, + type: ContentType.Json, + format: 'json', ...params, }), /** * No description * - * @tags Data - * @name NestedList - * @request GET:/data/{tableId}/{rowId}/{relationType}/{colId} - * @response `201` `any` Created + * @tags DB Table Row + * @name Create2 + * @request PATCH:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/all + * @originalName create + * @duplicate + * @response `200` `any` OK */ - nestedList: ( - tableId: string, - rowId: string, - colId: string, - relationType: string, + create2: ( + orgs: string, + projectName: string, + tableName: string, + data: any, params: RequestParams = {} ) => this.request({ - path: `/data/${tableId}/${rowId}/${relationType}/${colId}`, - method: 'GET', + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}/all`, + method: 'PATCH', + body: data, + type: ContentType.Json, format: 'json', ...params, }), @@ -2719,21 +2444,25 @@ export class Api< /** * No description * - * @tags Data - * @name NestedExcludedList - * @request GET:/data/{tableId}/{rowId}/{relationType}/{colId}/exclude - * @response `201` `any` Created + * @tags DB Table Row + * @name Create3 + * @request DELETE:/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/all + * @originalName create + * @duplicate + * @response `200` `any` OK */ - nestedExcludedList: ( - tableId: string, - rowId: string, - colId: string, - relationType: string, + create3: ( + orgs: string, + projectName: string, + tableName: string, + data: any, params: RequestParams = {} ) => this.request({ - path: `/data/${tableId}/${rowId}/${relationType}/${colId}/exclude`, - method: 'GET', + path: `/api/v1/db/data/bulk/${orgs}/${projectName}/${tableName}/all`, + method: 'DELETE', + body: data, + type: ContentType.Json, format: 'json', ...params, }), @@ -2741,60 +2470,69 @@ export class Api< /** * No description * - * @tags Data - * @name NestedAdd - * @request POST:/data/{tableId}/{rowId}/{relationType}/{colId}/{referenceTableRowId} - * @response `201` `any` Created + * @tags DB Table Row + * @name BulkDelete + * @request DELETE:/bulkData/{orgs}/{projectName}/{tableName}/ + * @response `200` `void` OK */ - nestedAdd: ( - tableId: string, - rowId: string, - colId: string, - relationType: string, - referenceTableRowId: string, + bulkDelete: ( + orgs: string, + projectName: string, + tableName: string, + data: any[], params: RequestParams = {} ) => - this.request({ - path: `/data/${tableId}/${rowId}/${relationType}/${colId}/${referenceTableRowId}`, - method: 'POST', - format: 'json', + this.request({ + path: `/bulkData/${orgs}/${projectName}/${tableName}/`, + method: 'DELETE', + body: data, + type: ContentType.Json, ...params, }), /** * No description * - * @tags Data - * @name NestedDelete - * @request DELETE:/data/{tableId}/{rowId}/{relationType}/{colId}/{referenceTableRowId} + * @tags DB Table Row + * @name BulkInsert + * @request POST:/bulkData/{orgs}/{projectName}/{tableName}/ * @response `200` `void` OK */ - nestedDelete: ( - tableId: string, - rowId: string, - colId: string, - relationType: string, - referenceTableRowId: string, + bulkInsert: ( + orgs: string, + projectName: string, + tableName: string, + data: any[], params: RequestParams = {} ) => this.request({ - path: `/data/${tableId}/${rowId}/${relationType}/${colId}/${referenceTableRowId}`, - method: 'DELETE', + path: `/bulkData/${orgs}/${projectName}/${tableName}/`, + method: 'POST', + body: data, + type: ContentType.Json, ...params, }), /** * No description * - * @tags Data - * @name Read - * @request GET:/data/{tableId}/{rowId} - * @response `201` `any` Created + * @tags DB Table Row + * @name BulkUpdate + * @request PATCH:/bulkData/{orgs}/{projectName}/{tableName}/ + * @response `200` `any` OK */ - read: (tableId: string, rowId: string, params: RequestParams = {}) => + bulkUpdate: ( + orgs: string, + projectName: string, + tableName: string, + data: object[], + params: RequestParams = {} + ) => this.request({ - path: `/data/${tableId}/${rowId}`, - method: 'GET', + path: `/bulkData/${orgs}/${projectName}/${tableName}/`, + method: 'PATCH', + body: data, + type: ContentType.Json, format: 'json', ...params, }), @@ -2802,20 +2540,23 @@ export class Api< /** * No description * - * @tags Data - * @name Update - * @request PUT:/data/{tableId}/{rowId} + * @tags DB Table Row + * @name BulkUpdateAll + * @request PATCH:/bulkData/{orgs}/{projectName}/{tableName}/all * @response `200` `any` OK */ - update: ( - tableId: string, - rowId: string, - data: any, + bulkUpdateAll: ( + orgs: string, + projectName: string, + tableName: string, + data: object, + query?: { where?: string }, params: RequestParams = {} ) => this.request({ - path: `/data/${tableId}/${rowId}`, - method: 'PUT', + path: `/bulkData/${orgs}/${projectName}/${tableName}/all`, + method: 'PATCH', + query: query, body: data, type: ContentType.Json, format: 'json', @@ -2825,36 +2566,45 @@ export class Api< /** * No description * - * @tags Data - * @name Delete - * @request DELETE:/data/{tableId}/{rowId} - * @response `200` `void` OK + * @tags DB Table Row + * @name BulkDeleteAll + * @request DELETE:/bulkData/{orgs}/{projectName}/{tableName}/all + * @response `200` `any` OK */ - delete: (tableId: string, rowId: string, params: RequestParams = {}) => - this.request({ - path: `/data/${tableId}/${rowId}`, + bulkDeleteAll: ( + orgs: string, + projectName: string, + tableName: string, + query?: { where?: string }, + params: RequestParams = {} + ) => + this.request({ + path: `/bulkData/${orgs}/${projectName}/${tableName}/all`, method: 'DELETE', + query: query, + format: 'json', ...params, }), }; - dbTableRow = { + dbViewRow = { /** * No description * - * @tags DB Table Row + * @tags DB View Row * @name List - * @request GET:/data/{orgs}/{projectName}/{tableAlias} + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName} * @response `200` `any` OK */ list: ( orgs: string, projectName: string, - tableAlias: string, - query?: { fields?: any[]; sort?: any[]; where?: string }, + tableName: string, + viewName: string, + query?: { fields?: any[]; sort?: any[]; where?: string; nested?: any }, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}`, method: 'GET', query: query, format: 'json', @@ -2864,20 +2614,21 @@ export class Api< /** * No description * - * @tags DB Table Row + * @tags DB View Row * @name Create - * @request POST:/data/{orgs}/{projectName}/{tableAlias} + * @request POST:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName} * @response `200` `any` OK */ create: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, + viewName: string, data: any, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}`, method: 'POST', body: data, type: ContentType.Json, @@ -2888,135 +2639,196 @@ export class Api< /** * No description * - * @tags DB Table Row + * @tags DB View Row * @name Read - * @request GET:/data/{orgs}/{projectName}/{tableAlias}/{rowId} + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId} * @response `201` `any` Created */ read: ( orgs: string, projectName: string, - tableAlias: string, + tableName: string, + viewName: string, rowId: string, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/${rowId}`, + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/${rowId}`, method: 'GET', format: 'json', ...params, }), - + + /** + * No description + * + * @tags DB View Row + * @name Update + * @request PATCH:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId} + * @response `200` `any` OK + */ + update: ( + orgs: string, + projectName: string, + tableName: string, + viewName: string, + rowId: string, + data: any, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/${rowId}`, + method: 'PATCH', + body: data, + type: ContentType.Json, + format: 'json', + ...params, + }), + + /** + * No description + * + * @tags DB View Row + * @name Delete + * @request DELETE:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId} + * @response `200` `void` OK + */ + delete: ( + orgs: string, + projectName: string, + tableName: string, + viewName: string, + rowId: string, + params: RequestParams = {} + ) => + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/${rowId}`, + method: 'DELETE', + ...params, + }), + }; + data = { /** - * No description + * @description CSV or Excel export * - * @tags DB Table Row - * @name Update - * @request PUT:/data/{orgs}/{projectName}/{tableAlias}/{rowId} + * @tags Data + * @name CsvExport + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/export/{type} * @response `200` `any` OK */ - update: ( + csvExport: ( orgs: string, projectName: string, - tableAlias: string, - rowId: string, - data: any, + tableName: string, + viewName: string, + type: 'csv' | 'excel', params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/${rowId}`, - method: 'PUT', - body: data, - type: ContentType.Json, - format: 'json', + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/views/${viewName}/export/${type}`, + method: 'GET', + wrapped: true, ...params, }), /** - * No description + * @description CSV or Excel export * - * @tags DB Table Row - * @name ModelDelete - * @request DELETE:/data/{orgs}/{projectName}/{tableAlias}/{rowId} - * @response `200` `void` OK + * @tags Data + * @name CsvExport2 + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/export/{type} + * @originalName csvExport + * @duplicate + * @response `200` `any` OK */ - modelDelete: ( + csvExport2: ( orgs: string, projectName: string, - tableAlias: string, - rowId: string, + tableName: string, + type: 'csv' | 'excel', params: RequestParams = {} ) => - this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/${rowId}`, - method: 'DELETE', + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/export/${type}`, + method: 'GET', + wrapped: true, ...params, }), - + }; + public = { /** * No description * - * @tags DB Table Row - * @name BulkDelete - * @request DELETE:/bulkData/{orgs}/{projectName}/{tableAlias}/ - * @response `200` `void` OK + * @tags Public + * @name DataNestedList + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName} + * @response `200` `any` OK */ - bulkDelete: ( + dataNestedList: ( orgs: string, projectName: string, - tableAlias: string, - data: any[], + tableName: string, + rowId: string, + relationType: 'mm' | 'hm', + columnName: string, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => - this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/`, - method: 'DELETE', - body: data, - type: ContentType.Json, + this.request({ + 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 BulkInsert - * @request POST:/bulkData/{orgs}/{projectName}/{tableAlias}/ - * @response `200` `void` OK + * @tags Public + * @name DataNestedList2 + * @request POST:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId} + * @originalName dataNestedList + * @duplicate + * @response `200` `any` OK */ - bulkInsert: ( + dataNestedList2: ( orgs: string, projectName: string, - tableAlias: string, - data: any[], + tableName: string, + rowId: string, + relationType: 'mm' | 'hm', + columnName: string, + refRowId: string, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => - this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/`, + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/${refRowId}`, method: 'POST', - body: data, - type: ContentType.Json, + query: query, + format: 'json', ...params, }), /** * No description * - * @tags DB Table Row - * @name BulkUpdate - * @request PATCH:/bulkData/{orgs}/{projectName}/{tableAlias}/ + * @tags Public + * @name DataList + * @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/rows * @response `200` `any` OK */ - bulkUpdate: ( - orgs: string, - projectName: string, - tableAlias: string, - data: object[], + dataList: ( + sharedViewUuid: string, + data: { password?: string; sorts?: SortType[]; filters?: FilterType[] }, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/`, - method: 'PATCH', + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows`, + method: 'GET', + query: query, body: data, type: ContentType.Json, format: 'json', @@ -3026,25 +2838,21 @@ export class Api< /** * No description * - * @tags DB Table Row - * @name BulkUpdateAll - * @request PATCH:/bulkData/{orgs}/{projectName}/{tableAlias}/all + * @tags Public + * @name SharedViewCreate + * @request POST:/api/v1/db/public/shared-view/{sharedViewUuid}/rows * @response `200` `any` OK */ - bulkUpdateAll: ( - orgs: string, - projectName: string, - tableAlias: string, - data: object, - query?: { where?: string }, + sharedViewCreate: ( + sharedViewUuid: string, + data: { data?: any; password?: string }, params: RequestParams = {} ) => this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/all`, - method: 'PATCH', - query: query, + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows`, + method: 'POST', body: data, - type: ContentType.Json, + type: ContentType.FormData, format: 'json', ...params, }), @@ -3052,45 +2860,47 @@ export class Api< /** * No description * - * @tags DB Table Row - * @name BulkDeleteAll - * @request DELETE:/bulkData/{orgs}/{projectName}/{tableAlias}/all + * @tags Public + * @name DataNestedList3 + * @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/{rowId}/{relationType}/{columnName} + * @originalName dataNestedList + * @duplicate * @response `200` `any` OK */ - bulkDeleteAll: ( - orgs: string, - projectName: string, - tableAlias: string, - query?: { where?: string }, + dataNestedList3: ( + sharedViewUuid: string, + rowId: string, + relationType: 'mm' | 'hm', + columnName: string, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => this.request({ - path: `/bulkData/${orgs}/${projectName}/${tableAlias}/all`, - method: 'DELETE', + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows/${rowId}/${relationType}/${columnName}`, + method: 'GET', query: query, format: 'json', ...params, }), - }; - dbViewRow = { + /** * No description * - * @tags DB View Row - * @name List - * @request GET:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName} + * @tags Public + * @name DataNestedExcludedList + * @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/{rowId}/{relationType}/{columnName}/exclude * @response `200` `any` OK */ - list: ( - orgs: string, - projectName: string, - tableAlias: string, - viewName: string, - query?: { fields?: any[]; sort?: any[]; where?: string; nested?: any }, + dataNestedExcludedList: ( + sharedViewUuid: string, + rowId: string, + relationType: 'mm' | 'hm', + columnName: string, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}`, + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows/${rowId}/${relationType}/${columnName}/exclude`, method: 'GET', query: query, format: 'json', @@ -3100,47 +2910,47 @@ export class Api< /** * No description * - * @tags DB View Row - * @name Create - * @request POST:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName} + * @tags Public + * @name CsvExport + * @request POST:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/export/{type} * @response `200` `any` OK */ - create: ( - orgs: string, - projectName: string, - tableAlias: string, - viewName: string, - data: any, + csvExport: ( + sharedViewUuid: string, + type: 'csv' | 'excel', + data: { password?: string; filters?: FilterType[]; sorts?: SortType[] }, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}`, + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows/export/${type}`, method: 'POST', body: data, type: ContentType.Json, - format: 'json', + wrapped: true, ...params, }), /** * No description * - * @tags DB View Row - * @name Read - * @request GET:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/{rowId} - * @response `201` `any` Created + * @tags Public + * @name DataRelationList + * @request POST:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/nested/{columnName} + * @response `200` `any` OK */ - read: ( - orgs: string, - projectName: string, - tableAlias: string, - viewName: string, - rowId: string, + dataRelationList: ( + sharedViewUuid: string, + columnName: string, + data: { password?: string }, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}/${rowId}`, - method: 'GET', + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows/nested/${columnName}`, + method: 'POST', + query: query, + body: data, + type: ContentType.Json, format: 'json', ...params, }), @@ -3148,48 +2958,65 @@ export class Api< /** * No description * - * @tags DB View Row - * @name Update - * @request PUT:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/{rowId} - * @response `200` `any` OK + * @tags Public + * @name SharedViewMetaGet + * @request POST:/api/v1/db/public/shared-view/{sharedViewUuid}/meta + * @response `200` `object` OK */ - update: ( - orgs: string, - projectName: string, - tableAlias: string, - viewName: string, - rowId: string, - data: any, + sharedViewMetaGet: ( + sharedViewUuid: string, + data: { password?: string }, params: RequestParams = {} ) => - this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}/${rowId}`, - method: 'PUT', + this.request({ + path: `/api/v1/db/public/shared-view/${sharedViewUuid}/meta`, + method: 'POST', body: data, type: ContentType.Json, format: 'json', ...params, }), + /** + * @description Read project details + * + * @tags Public + * @name SharedBaseGet + * @request GET:/api/v1/db/public/shared-base/{sharedBaseUuid}/meta + * @response `200` `{ project_id?: string }` OK + */ + sharedBaseGet: (sharedBaseUuid: string, params: RequestParams = {}) => + this.request<{ project_id?: string }, any>({ + path: `/api/v1/db/public/shared-base/${sharedBaseUuid}/meta`, + method: 'GET', + format: 'json', + ...params, + }), + }; + dbData = { /** * No description * - * @tags DB View Row - * @name Delete - * @request DELETE:/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/{rowId} - * @response `200` `void` OK + * @tags DB Data + * @name DataNestedExcludedChildrenList + * @request GET:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude + * @response `200` `any` OK */ - delete: ( + dataNestedExcludedChildrenList: ( orgs: string, projectName: string, - tableAlias: string, - viewName: string, + tableName: string, rowId: string, + relationType: 'mm' | 'hm', + columnName: string, + query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => - this.request({ - path: `/data/${orgs}/${projectName}/${tableAlias}/views/${viewName}/${rowId}`, - method: 'DELETE', + this.request({ + path: `/api/v1/db/data/${orgs}/${projectName}/${tableName}/${rowId}/${relationType}/${columnName}/exclude`, + method: 'GET', + query: query, + format: 'json', ...params, }), }; @@ -3199,7 +3026,7 @@ export class Api< * * @tags Utils * @name CommentList - * @request GET:/audits/comments + * @request GET:/api/v1/db/meta/audits/comments * @response `201` `any` Created */ commentList: ( @@ -3207,7 +3034,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/audits/comments`, + path: `/api/v1/db/meta/audits/comments`, method: 'GET', query: query, format: 'json', @@ -3219,7 +3046,7 @@ export class Api< * * @tags Utils * @name CommentRow - * @request POST:/audits/comments + * @request POST:/api/v1/db/meta/audits/comments * @response `200` `void` OK */ commentRow: ( @@ -3227,7 +3054,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/audits/comments`, + path: `/api/v1/db/meta/audits/comments`, method: 'POST', body: data, type: ContentType.Json, @@ -3239,7 +3066,7 @@ export class Api< * * @tags Utils * @name CommentCount - * @request GET:/audits/comments/count + * @request GET:/api/v1/db/meta/meta/audits/comments/count * @response `201` `any` Created */ commentCount: ( @@ -3247,7 +3074,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/audits/comments/count`, + path: `/api/v1/db/meta/meta/audits/comments/count`, method: 'GET', query: query, format: 'json', @@ -3259,10 +3086,11 @@ export class Api< * * @tags Utils * @name AuditRowUpdate - * @request POST:/audits/rowUpdate + * @request POST:/api/v1/db/meta/audits/rows/{rowId}/update * @response `200` `void` OK */ auditRowUpdate: ( + rowId: string, data: { fk_model_id?: string; column_name?: string; @@ -3273,7 +3101,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/audits/rowUpdate`, + path: `/api/v1/db/meta/audits/rows/${rowId}/update`, method: 'POST', body: data, type: ContentType.Json, @@ -3285,12 +3113,12 @@ export class Api< * * @tags Utils * @name TestConnection - * @request POST:/testConnection + * @request POST:/api/v1/db/meta/connection/test * @response `200` `{ code?: number, message?: string }` OK */ testConnection: (data: any, params: RequestParams = {}) => this.request<{ code?: number; message?: string }, any>({ - path: `/testConnection`, + path: `/api/v1/db/meta/connection/test`, method: 'POST', body: data, type: ContentType.Json, @@ -3303,12 +3131,12 @@ export class Api< * * @tags Utils * @name AppInfo - * @request GET:/appInfo + * @request GET:/api/v1/db/meta/nocodb/info * @response `200` `any` OK */ appInfo: (params: RequestParams = {}) => this.request({ - path: `/appInfo`, + path: `/api/v1/db/meta/nocodb/info`, method: 'GET', format: 'json', ...params, @@ -3320,11 +3148,11 @@ export class Api< * @tags Utils * @name CacheGet * @summary Your GET endpoint - * @request GET:/cache + * @request GET:/api/v1/db/meta/cache */ cacheGet: (params: RequestParams = {}) => this.request({ - path: `/cache`, + path: `/api/v1/db/meta/cache`, method: 'GET', ...params, }), @@ -3334,12 +3162,12 @@ export class Api< * * @tags Utils * @name CacheDelete - * @request DELETE:/cache + * @request DELETE:/api/v1/db/meta/cache * @response `200` `void` OK */ cacheDelete: (params: RequestParams = {}) => this.request({ - path: `/cache`, + path: `/api/v1/db/meta/cache`, method: 'DELETE', ...params, }), @@ -3350,12 +3178,12 @@ export class Api< * * @tags DB Table Webhook * @name List - * @request GET:/tables/{tableId}/hooks + * @request GET:/api/v1/db/meta/tables/{tableId}/hooks * @response `200` `{ list: (HookType)[], pageInfo: PaginatedType }` OK */ list: (tableId: string, params: RequestParams = {}) => this.request<{ list: HookType[]; pageInfo: PaginatedType }, any>({ - path: `/tables/${tableId}/hooks`, + path: `/api/v1/db/meta/tables/${tableId}/hooks`, method: 'GET', format: 'json', ...params, @@ -3366,12 +3194,12 @@ export class Api< * * @tags DB Table Webhook * @name Create - * @request POST:/tables/{tableId}/hooks + * @request POST:/api/v1/db/meta/tables/{tableId}/hooks * @response `200` `AuditType` OK */ create: (tableId: string, data: AuditType, params: RequestParams = {}) => this.request({ - path: `/tables/${tableId}/hooks`, + path: `/api/v1/db/meta/tables/${tableId}/hooks`, method: 'POST', body: data, type: ContentType.Json, @@ -3384,7 +3212,7 @@ export class Api< * * @tags DB Table Webhook * @name Test - * @request POST:/tables/{tableId}/hooks/test + * @request POST:/api/v1/db/meta/tables/{tableId}/hooks/test * @response `200` `any` OK */ test: ( @@ -3393,7 +3221,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/tables/${tableId}/hooks/test`, + path: `/api/v1/db/meta/tables/${tableId}/hooks/test`, method: 'POST', body: data, type: ContentType.Json, @@ -3401,18 +3229,41 @@ export class Api< ...params, }), + /** + * No description + * + * @tags DB Table Webhook + * @name SamplePayloadGet + * @request GET:/api/v1/db/meta/tables/{tableId}/hooks/samplePayload/{operation} + * @response `200` `{ plugins?: { list: (PluginType)[], pageInfo: PaginatedType } }` OK + */ + samplePayloadGet: ( + tableId: string, + operation: 'update' | 'delete' | 'insert', + params: RequestParams = {} + ) => + this.request< + { plugins?: { list: PluginType[]; pageInfo: PaginatedType } }, + any + >({ + path: `/api/v1/db/meta/tables/${tableId}/hooks/samplePayload/${operation}`, + method: 'GET', + format: 'json', + ...params, + }), + /** * No description * * @tags DB Table Webhook * @name Update - * @request PUT:/hooks/{hookId} + * @request PATCH:/api/v1/db/meta/hooks/{hookId} * @response `200` `HookType` OK */ update: (hookId: string, data: HookType, params: RequestParams = {}) => this.request({ - path: `/hooks/${hookId}`, - method: 'PUT', + path: `/api/v1/db/meta/hooks/${hookId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -3424,38 +3275,15 @@ export class Api< * * @tags DB Table Webhook * @name Delete - * @request DELETE:/hooks/{hookId} + * @request DELETE:/api/v1/db/meta/hooks/{hookId} * @response `200` `void` OK */ delete: (hookId: string, params: RequestParams = {}) => this.request({ - path: `/hooks/${hookId}`, + path: `/api/v1/db/meta/hooks/${hookId}`, method: 'DELETE', ...params, }), - - /** - * No description - * - * @tags DB Table Webhook - * @name SamplePayloadGet - * @request GET:/tables/{tableId}/hooks/samplePayload/{operation} - * @response `200` `{ plugins?: { list: (PluginType)[], pageInfo: PaginatedType } }` OK - */ - samplePayloadGet: ( - tableId: string, - operation: 'update' | 'delete' | 'insert', - params: RequestParams = {} - ) => - this.request< - { plugins?: { list: PluginType[]; pageInfo: PaginatedType } }, - any - >({ - path: `/tables/${tableId}/hooks/samplePayload/${operation}`, - method: 'GET', - format: 'json', - ...params, - }), }; plugin = { /** @@ -3463,12 +3291,12 @@ export class Api< * * @tags Plugin * @name List - * @request GET:/plugins + * @request GET:/api/v1/db/meta/plugins * @response `200` `{ list?: (PluginType)[], pageInfo?: PaginatedType }` OK */ list: (params: RequestParams = {}) => this.request<{ list?: PluginType[]; pageInfo?: PaginatedType }, any>({ - path: `/plugins`, + path: `/api/v1/db/meta/plugins`, method: 'GET', format: 'json', ...params, @@ -3479,12 +3307,12 @@ export class Api< * * @tags Plugin * @name Status - * @request GET:/plugins/{pluginTitle}/status + * @request GET:/api/v1/db/meta/plugins/{pluginTitle}/status * @response `200` `boolean` OK */ status: (pluginTitle: string, params: RequestParams = {}) => this.request({ - path: `/plugins/${pluginTitle}/status`, + path: `/api/v1/db/meta/plugins/${pluginTitle}/status`, method: 'GET', format: 'json', ...params, @@ -3495,7 +3323,7 @@ export class Api< * * @tags Plugin * @name Test - * @request POST:/plugins/test + * @request POST:/api/v1/db/meta/plugins/test * @response `200` `any` OK * @response `400` `void` Bad Request * @response `401` `void` Unauthorized @@ -3505,7 +3333,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/plugins/test`, + path: `/api/v1/db/meta/plugins/test`, method: 'POST', body: data, type: ContentType.Json, @@ -3518,13 +3346,13 @@ export class Api< * * @tags Plugin * @name Update - * @request PUT:/plugins/{pluginId} + * @request PATCH:/api/v1/db/meta/plugins/{pluginId} * @response `200` `PluginType` OK */ update: (pluginId: string, data: PluginType, params: RequestParams = {}) => this.request({ - path: `/plugins/${pluginId}`, - method: 'PUT', + path: `/api/v1/db/meta/plugins/${pluginId}`, + method: 'PATCH', body: data, type: ContentType.Json, format: 'json', @@ -3536,12 +3364,12 @@ export class Api< * * @tags Plugin * @name Read - * @request GET:/plugins/{pluginId} + * @request GET:/api/v1/db/meta/plugins/{pluginId} * @response `200` `PluginType` OK */ read: (pluginId: string, params: RequestParams = {}) => this.request({ - path: `/plugins/${pluginId}`, + path: `/api/v1/db/meta/plugins/${pluginId}`, method: 'GET', format: 'json', ...params, @@ -3554,12 +3382,12 @@ export class Api< * @tags Api token * @name List * @summary Your GET endpoint - * @request GET:/projects/{projectId}/apiTokens + * @request GET:/api/v1/db/meta/projects/{projectId}/apiTokens * @response `200` `(ApiTokenType)[]` OK */ list: (projectId: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/apiTokens`, + path: `/api/v1/db/meta/projects/${projectId}/apiTokens`, method: 'GET', format: 'json', ...params, @@ -3570,7 +3398,7 @@ export class Api< * * @tags Api token * @name Create - * @request POST:/projects/{projectId}/apiTokens + * @request POST:/api/v1/db/meta/projects/{projectId}/apiTokens * @response `200` `void` OK * @response `201` `ApiTokenType` Created */ @@ -3580,7 +3408,7 @@ export class Api< params: RequestParams = {} ) => this.request({ - path: `/projects/${projectId}/apiTokens`, + path: `/api/v1/db/meta/projects/${projectId}/apiTokens`, method: 'POST', body: data, type: ContentType.Json, @@ -3592,12 +3420,12 @@ export class Api< * * @tags Api token * @name Delete - * @request DELETE:/projects/{projectId}/apiTokens/{token} + * @request DELETE:/api/v1/db/meta/projects/{projectId}/apiTokens/{token} * @response `200` `void` OK */ delete: (projectId: string, token: string, params: RequestParams = {}) => this.request({ - path: `/projects/${projectId}/apiTokens/${token}`, + path: `/api/v1/db/meta/projects/${projectId}/apiTokens/${token}`, method: 'DELETE', ...params, }), diff --git a/packages/nocodb/package.json b/packages/nocodb/package.json index 8ebc269333..97dda45b4a 100644 --- a/packages/nocodb/package.json +++ b/packages/nocodb/package.json @@ -154,7 +154,7 @@ "nc-lib-gui": "0.84.15", "nc-plugin": "^0.1.1", "ncp": "^2.0.0", - "nocodb-sdk": "0.0.9", + "nocodb-sdk": "file:../nocodb-sdk", "nodemailer": "^6.4.10", "ora": "^4.0.4", "os-locale": "^5.0.0", diff --git a/packages/nocodb/src/lib/noco-models/User.ts b/packages/nocodb/src/lib/noco-models/User.ts index 3bb5ab76ae..7e7cdf3bdc 100644 --- a/packages/nocodb/src/lib/noco-models/User.ts +++ b/packages/nocodb/src/lib/noco-models/User.ts @@ -136,4 +136,11 @@ export default class User implements UserType { } return user; } + + static async getByRefreshToken(refresh_token, ncMeta = Noco.ncMeta) { + const user = await ncMeta.metaGet2(null, null, MetaTable.USERS, { + refresh_token + }); + return user; + } } diff --git a/packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts b/packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts index 5043225c24..5a02a8bed7 100644 --- a/packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts @@ -18,15 +18,15 @@ export async function apiTokenDelete(req: Request, res: Response) { const router = Router({ mergeParams: true }); router.get( - '/projects/:projectId/apiTokens', + '/api/v1/db/meta/projects/:projectId/apiTokens', ncMetaAclMw(apiTokenList, 'apiTokenList') ); router.post( - '/projects/:projectId/apiTokens', + '/api/v1/db/meta/projects/:projectId/apiTokens', ncMetaAclMw(apiTokenCreate, 'apiTokenCreate') ); router.delete( - '/projects/:projectId/apiTokens/:token', + '/api/v1/db/meta/projects/:projectId/apiTokens/:token', ncMetaAclMw(apiTokenDelete, 'apiTokenDelete') ); diff --git a/packages/nocodb/src/lib/noco/meta/api/auditApis.ts b/packages/nocodb/src/lib/noco/meta/api/auditApis.ts index 2ec433fd0c..c5b9944934 100644 --- a/packages/nocodb/src/lib/noco/meta/api/auditApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/auditApis.ts @@ -20,7 +20,7 @@ export async function auditRowUpdate(req: Request, res) { res.json( await Audit.insert({ fk_model_id: req.body.fk_model_id, - row_id: req.body.row_id, + row_id: req.params.rowId, op_type: AuditOperationTypes.DATA, op_sub_type: AuditOperationSubTypes.UPDATE, description: `Table ${model.table_name} : field ${req.body.column_name} got changed from ${req.body.prev_value} to ${req.body.value}`, @@ -58,12 +58,24 @@ export async function commentsCount(req: Request, res) { } const router = Router({ mergeParams: true }); -router.get('/audits/comments', ncMetaAclMw(commentList, 'commentList')); -router.post('/audits/rowUpdate', ncMetaAclMw(auditRowUpdate, 'auditRowUpdate')); -router.post('/audits/comments', ncMetaAclMw(commentRow, 'commentRow')); router.get( - '/audits/comments/count', + '/api/v1/db/meta/audits/comments', + ncMetaAclMw(commentList, 'commentList') +); +router.post( + '/api/v1/db/meta/audits/comments', + ncMetaAclMw(commentRow, 'commentRow') +); +router.post( + '/api/v1/db/meta/audits/rows/:rowId/update', + ncMetaAclMw(auditRowUpdate, 'auditRowUpdate') +); +router.get( + '/api/v1/db/meta/audits/comments/count', ncMetaAclMw(commentsCount, 'commentsCount') ); -router.get('/project/:projectId/audits', ncMetaAclMw(auditList, 'auditList')); +router.get( + '/api/v1/db/meta/project/:projectId/audits', + ncMetaAclMw(auditList, 'auditList') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/cacheApis.ts b/packages/nocodb/src/lib/noco/meta/api/cacheApis.ts index 8813822856..082aab1aa5 100644 --- a/packages/nocodb/src/lib/noco/meta/api/cacheApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/cacheApis.ts @@ -16,6 +16,6 @@ export async function cacheDelete(_, res) { } const router = Router(); -router.get('/cache', catchError(cacheGet)); -router.delete('/cache', catchError(cacheDelete)); +router.get('/api/v1/db/meta/cache', catchError(cacheGet)); +router.delete('/api/v1/db/meta/cache', catchError(cacheDelete)); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/columnApis.ts b/packages/nocodb/src/lib/noco/meta/api/columnApis.ts index 91b18ce1a5..4a74d8c00c 100644 --- a/packages/nocodb/src/lib/noco/meta/api/columnApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/columnApis.ts @@ -498,14 +498,15 @@ export async function columnAdd(req: Request, res: Response) { } export async function columnSetAsPrimary(req: Request, res: Response) { - res.json( - await Model.updatePrimaryColumn(req.params.tableId, req.params.columnId) - ); + const column = await Column.get({ colId: req.params.columnId }); + res.json(await Model.updatePrimaryColumn(column.fk_model_id, column.id)); } export async function columnUpdate(req: Request, res: Response) { + const column = await Column.get({ colId: req.params.columnId }); + const table = await Model.getWithInfo({ - id: req.params.tableId + id: column.fk_model_id }); const base = await Base.get(table.base_id); @@ -529,7 +530,6 @@ export async function columnUpdate(req: Request, res: Response) { NcError.badRequest('Duplicate column alias'); } - const column = table.columns.find(c => c.id === req.params.columnId); let colBody = req.body; if ( [ @@ -622,8 +622,9 @@ export async function columnUpdate(req: Request, res: Response) { } export async function columnDelete(req: Request, res: Response) { + const column = await Column.get({ colId: req.params.columnId }); const table = await Model.getWithInfo({ - id: req.params.tableId + id: column.fk_model_id }); const base = await Base.get(table.base_id); @@ -636,9 +637,6 @@ export async function columnDelete(req: Request, res: Response) { const sqlMgr = await ProjectMgrv2.getSqlMgr({ id: base.project_id }); - // try { - const column: Column = table.columns.find(c => c.id === req.params.columnId); - switch (column.uidt) { case UITypes.Lookup: case UITypes.Rollup: @@ -900,17 +898,20 @@ const deleteHmOrBtRelation = async ( }; const router = Router({ mergeParams: true }); -router.post('/tables/:tableId/columns/', ncMetaAclMw(columnAdd, 'columnAdd')); -router.put( - '/tables/:tableId/columns/:columnId', +router.post( + '/api/v1/db/meta/tables/:tableId/columns/', + ncMetaAclMw(columnAdd, 'columnAdd') +); +router.patch( + '/api/v1/db/meta/columns/:columnId', ncMetaAclMw(columnUpdate, 'columnUpdate') ); router.delete( - '/tables/:tableId/columns/:columnId', + '/api/v1/db/meta/columns/:columnId', ncMetaAclMw(columnDelete, 'columnDelete') ); router.post( - '/tables/:tableId/columns/:columnId/primary', + '/api/v1/db/meta/columns/:columnId/primary', ncMetaAclMw(columnSetAsPrimary, 'columnSetAsPrimary') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts index 0167b8692f..783741d76a 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts @@ -8,7 +8,7 @@ import View from '../../../../noco-models/View'; import ncMetaAclMw from '../../helpers/ncMetaAclMw'; import { getViewAndModelFromRequestByAliasOrId } from './helpers'; -export async function dataList(req: Request, res: Response) { +async function dataList(req: Request, res: Response) { const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); res.json(await getDataList(model, view, req)); } @@ -108,20 +108,44 @@ async function dataRead(req: Request, res: Response) { const router = Router({ mergeParams: true }); +// table data crud apis router.get( '/api/v1/db/data/:orgs/:projectName/:tableName', ncMetaAclMw(dataList, 'dataList') ); +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId', + ncMetaAclMw(dataRead, 'dataRead') +); +router.patch( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId', + ncMetaAclMw(dataUpdate, 'dataUpdate') +); +router.patch( + '/api/v1/db/data/:orgs/:projectName/:tableName/:rowId', + ncMetaAclMw(dataUpdate, 'dataUpdate') +); + +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName', + ncMetaAclMw(dataList, 'dataList') +); + +// table view data crud apis router.get( '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName', ncMetaAclMw(dataList, 'dataList') ); +router.post( + '/api/v1/db/data/:orgs/:projectName/:tableName', + ncMetaAclMw(dataInsert, 'dataInsert') +); router.post( '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName', ncMetaAclMw(dataInsert, 'dataInsert') ); -router.put( +router.patch( '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName/:rowId', ncMetaAclMw(dataUpdate, 'dataUpdate') ); diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasNestedApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasNestedApis.ts new file mode 100644 index 0000000000..9d1c99f7f8 --- /dev/null +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasNestedApis.ts @@ -0,0 +1,308 @@ +import { Request, Response, Router } from 'express'; +import Model from '../../../../noco-models/Model'; +import Base from '../../../../noco-models/Base'; +import NcConnectionMgrv2 from '../../../common/NcConnectionMgrv2'; +import { PagedResponseImpl } from '../../helpers/PagedResponse'; +import View from '../../../../noco-models/View'; +import ncMetaAclMw from '../../helpers/ncMetaAclMw'; +import { getViewAndModelFromRequestByAliasOrId } from './helpers'; +import { NcError } from '../../helpers/catchError'; + +export async function mmList(req: Request, res: Response, next) { + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); + + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.mmList( + { + colId: column.id, + parentId: req.params.rowId + }, + req.query as any + ); + const count: any = await baseModel.mmListCount({ + colId: column.id, + parentId: req.params.rowId + }); + + res.json( + new PagedResponseImpl(data, { + count, + ...req.query + }) + ); +} + +export async function mmExcludedList(req: Request, res: Response, next) { + const view = await View.get(req.params.viewId); + + const model = await Model.getByIdOrName({ + id: view?.fk_model_id || req.params.viewId + }); + + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.getMmChildrenExcludedList( + { + colId: column.id, + pid: req.params.rowId + }, + req.query + ); + + const count = await baseModel.getMmChildrenExcludedListCount( + { + colId: column.id, + pid: req.params.rowId + }, + req.query + ); + + res.json( + new PagedResponseImpl(data, { + count, + ...req.query + }) + ); +} + +export async function hmExcludedList(req: Request, res: Response, next) { + const view = await View.get(req.params.viewId); + + const model = await Model.getByIdOrName({ + id: view?.fk_model_id || req.params.viewId + }); + + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.getHmChildrenExcludedList( + { + colId: column.id, + pid: req.params.rowId + }, + req.query + ); + + const count = await baseModel.getHmChildrenExcludedListCount( + { + colId: column.id, + pid: req.params.rowId + }, + req.query + ); + + res.json( + new PagedResponseImpl(data, { + count, + ...req.query + }) + ); +} + +export async function btExcludedList(req: Request, res: Response, next) { + const view = await View.get(req.params.viewId); + + const model = await Model.getByIdOrName({ + id: view?.fk_model_id || req.params.viewId + }); + + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.getBtChildrenExcludedList( + { + colId: column.id, + cid: req.params.rowId + }, + req.query + ); + + const count = await baseModel.getBtChildrenExcludedListCount( + { + colId: column.id, + cid: req.params.rowId + }, + req.query + ); + + res.json( + new PagedResponseImpl(data, { + count, + ...req.query + }) + ); +} + +export async function hmList(req: Request, res: Response, next) { + const view = await View.get(req.params.viewId); + + const model = await Model.getByIdOrName({ + id: view?.fk_model_id || req.params.viewId + }); + + if (!model) return next(new Error('Table not found')); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + const data = await baseModel.hmList( + { + colId: column.id, + id: req.params.rowId + }, + req.query + ); + + const count = await baseModel.hmListCount({ + colId: column.id, + id: req.params.rowId + }); + + res.json( + new PagedResponseImpl(data, { + totalRows: count + } as any) + ); +} + +//@ts-ignore +async function relationDataDelete(req, res) { + const view = await View.get(req.params.viewId); + + const model = await Model.getByIdOrName({ + id: view?.fk_model_id || req.params.viewId + }); + + if (!model) NcError.notFound('Table not found'); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + + await baseModel.removeChild({ + colId: column.id, + childId: req.params.childId, + rowId: req.params.rowId + }); + + res.json({ msg: 'success' }); +} + +//@ts-ignore +async function relationDataAdd(req, res) { + const view = await View.get(req.params.viewId); + + const model = await Model.getByIdOrName({ + id: view?.fk_model_id || req.params.viewId + }); + + if (!model) NcError.notFound('Table not found'); + + const base = await Base.get(model.base_id); + + const baseModel = await Model.getBaseModelSQL({ + id: model.id, + viewId: view?.id, + dbDriver: NcConnectionMgrv2.get(base) + }); + + const column = await getColumnByIdOrName(req.params.columnName, model); + await baseModel.addChild({ + colId: column.id, + childId: req.params.childId, + rowId: req.params.rowId + }); + + res.json({ msg: 'success' }); +} + +async function getColumnByIdOrName(columnNameOrId: string, model: Model) { + const column = (await model.getColumns()).find( + c => + column.title === columnNameOrId || + c.id === columnNameOrId || + column.column_name === columnNameOrId + ); + + if (!column) + NcError.notFound(`Column with id/name '${columnNameOrId}' is not found`); + + return column; +} + +const router = Router({ mergeParams: true }); + +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/mm/:columnName/exclude', + ncMetaAclMw(mmExcludedList, 'mmExcludedList') +); +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/hm/:columnName/exclude', + ncMetaAclMw(hmExcludedList, 'hmExcludedList') +); +router.get( + '/api/v1/db/data/:orgs/:projectName/:tableName/bt/:columnName/exclude', + ncMetaAclMw(btExcludedList, 'btExcludedList') +); + +router.post( + '/api/v1/db/data/:orgs/:projectName/:tableName/:relationType/:columnName/:refRowId', + ncMetaAclMw(relationDataAdd, 'relationDataAdd') +); +router.delete( + '/api/v1/db/data/:orgs/:projectName/:tableName/:relationType/:columnName/:refRowId', + ncMetaAclMw(relationDataDelete, 'relationDataDelete') +); + +export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts index edefdf35d2..8bcd0d6993 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts @@ -554,7 +554,7 @@ const router = Router({ mergeParams: true }); // '/data/:orgs/:projectName/:tableName/views/:viewName', // ncMetaAclMw(dataInsertNew) // ); -// router.put( +// router.patch( // '/data/:orgs/:projectName/:tableName/views/:viewName/:rowId', // ncMetaAclMw(dataUpdateNew) // ); @@ -566,7 +566,7 @@ const router = Router({ mergeParams: true }); router.get('/data/:viewId/', ncMetaAclMw(dataList, 'dataList')); router.post('/data/:viewId/', ncMetaAclMw(dataInsert, 'dataInsert')); router.get('/data/:viewId/:rowId', ncMetaAclMw(dataRead, 'dataRead')); -router.put('/data/:viewId/:rowId', ncMetaAclMw(dataUpdate, 'dataUpdate')); +router.patch('/data/:viewId/:rowId', ncMetaAclMw(dataUpdate, 'dataUpdate')); router.delete('/data/:viewId/:rowId', ncMetaAclMw(dataDelete, 'dataDelete')); router.get('/data/:viewId/:rowId/mm/:colId', ncMetaAclMw(mmList, 'mmList')); diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts index 14d9b68654..a0196854f6 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts @@ -138,7 +138,7 @@ router.get( '/nc/:projectId/api/v2/:tableName/:rowId', ncMetaAclMw(dataRead, 'dataRead') ); -router.put( +router.patch( '/nc/:projectId/api/v2/:tableName/:rowId', ncMetaAclMw(dataUpdate, 'dataUpdate') ); diff --git a/packages/nocodb/src/lib/noco/meta/api/filterApis.ts b/packages/nocodb/src/lib/noco/meta/api/filterApis.ts index a67484f015..7dc9964bd7 100644 --- a/packages/nocodb/src/lib/noco/meta/api/filterApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/filterApis.ts @@ -85,7 +85,7 @@ export async function filterUpdate(req, res, next) { ...req.body, fk_view_id: req.params.viewId }); - Tele.emit('evt', { evt_type: 'table:updated' }); + Tele.emit('evt', { evt_type: 'filter:updated' }); res.json(filter); } catch (e) { console.log(e); @@ -97,7 +97,7 @@ export async function filterUpdate(req, res, next) { export async function filterDelete(req: Request, res: Response, next) { try { const filter = await Filter.delete(req.params.filterId); - Tele.emit('evt', { evt_type: 'table:deleted' }); + Tele.emit('evt', { evt_type: 'filter:deleted' }); res.json(filter); } catch (e) { console.log(e); @@ -105,26 +105,60 @@ export async function filterDelete(req: Request, res: Response, next) { } } +export async function hookFilterList( + req: Request, + res: Response +) { + const filter = await Filter.rootFilterListByHook({ + hookId: req.params.hookId + }); + + res.json(filter); +} + +export async function hookFilterCreate(req: Request, res) { + const filter = await Filter.insert({ + ...req.body, + fk_hook_id: req.params.hookId + }); + + Tele.emit('evt', { evt_type: 'hookFilter:created' }); + res.json(filter); +} + const router = Router({ mergeParams: true }); -router.get('/views/:viewId/filters/', ncMetaAclMw(filterList, 'filterList')); +router.get( + '/api/v1/db/meta/views/:viewId/filters', + ncMetaAclMw(filterList, 'filterList') +); router.post( - '/views/:viewId/filters/', + '/api/v1/db/meta/views/:viewId/filters', ncMetaAclMw(filterCreate, 'filterCreate') ); + +router.get( + '/api/v1/db/meta/hooks/:hookId/filters', + ncMetaAclMw(hookFilterList, 'filterList') +); +router.post( + '/api/v1/db/meta/hooks/:hookId/filters', + ncMetaAclMw(hookFilterCreate, 'filterCreate') +); + router.get( - '/views/:viewId/filters/:filterId', + '/api/v1/db/meta/filters/:filterId', ncMetaAclMw(filterGet, 'filterGet') ); -router.put( - '/views/:viewId/filters/:filterId', +router.patch( + '/api/v1/db/meta/filters/:filterId', ncMetaAclMw(filterUpdate, 'filterUpdate') ); router.delete( - '/views/:viewId/filters/:filterId', + '/api/v1/db/meta/filters/:filterId', ncMetaAclMw(filterDelete, 'filterDelete') ); router.get( - '/views/:viewId/filters/:filterParentId/children', + '/api/v1/db/meta/filters/:filterParentId/children', ncMetaAclMw(filterChildrenRead, 'filterChildrenRead') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/formViewApis.ts b/packages/nocodb/src/lib/noco/meta/api/formViewApis.ts index f379b5b7a6..ea99e1ee2b 100644 --- a/packages/nocodb/src/lib/noco/meta/api/formViewApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/formViewApis.ts @@ -40,13 +40,19 @@ export async function formViewDelete(req: Request, res: Response, next) {} const router = Router({ mergeParams: true }); router.post( - '/tables/:tableId/forms', + '/api/v1/db/meta/tables/:tableId/forms', ncMetaAclMw(formViewCreate, 'formViewCreate') ); -router.get('/forms/:formViewId', ncMetaAclMw(formViewGet, 'formViewGet')); -router.put('/forms/:formViewId', ncMetaAclMw(formViewUpdate, 'formViewUpdate')); +router.get( + '/api/v1/db/meta/forms/:formViewId', + ncMetaAclMw(formViewGet, 'formViewGet') +); +router.patch( + '/api/v1/db/meta/forms/:formViewId', + ncMetaAclMw(formViewUpdate, 'formViewUpdate') +); router.delete( - '/forms/:formViewId', + '/api/v1/db/meta/forms/:formViewId', ncMetaAclMw(formViewDelete, 'formViewDelete') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts b/packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts index 891ad603fb..acf4d11442 100644 --- a/packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts @@ -9,8 +9,8 @@ export async function columnUpdate(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.put( - '/formColumns/:formViewColumnId', +router.patch( + '/api/v1/db/meta/forms/columns/:formViewColumnId', ncMetaAclMw(columnUpdate, 'columnUpdate') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts b/packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts index 5c662ff0b4..de5912c315 100644 --- a/packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts @@ -1,29 +1,13 @@ import { Request, Response, Router } from 'express'; -// @ts-ignore -import Model from '../../../noco-models/Model'; -// @ts-ignore -import { PagedResponseImpl } from '../helpers/PagedResponse'; -import { GalleryType, TableListType, ViewTypes } from 'nocodb-sdk'; -// @ts-ignore -import ProjectMgrv2 from '../../../sqlMgr/v2/ProjectMgrv2'; -// @ts-ignore -import Project from '../../../noco-models/Project'; +import { GalleryType, ViewTypes } from 'nocodb-sdk'; import View from '../../../noco-models/View'; import GalleryView from '../../../noco-models/GalleryView'; import ncMetaAclMw from '../helpers/ncMetaAclMw'; import { Tele } from 'nc-help'; -// @ts-ignore export async function galleryViewGet(req: Request, res: Response) { res.json(await GalleryView.get(req.params.galleryViewId)); } -// @ts-ignore -export async function galleyViewList( - _req: Request, - _res: Response -) {} - -// @ts-ignore export async function galleryViewCreate(req: Request, res) { Tele.emit('evt', { evt_type: 'vtable:created', show_as: 'gallery' }); const view = await View.insert({ @@ -35,29 +19,22 @@ export async function galleryViewCreate(req: Request, res) { res.json(view); } -// @ts-ignore export async function galleryViewUpdate(req, res) { Tele.emit('evt', { evt_type: 'view:updated', type: 'gallery' }); res.json(await GalleryView.update(req.params.galleryViewId, req.body)); } -// @ts-ignore -export async function galleyViewDelete(req: Request, res: Response, next) {} - const router = Router({ mergeParams: true }); -// router.get('/', galleyViewList); router.post( - '/tables/:tableId/galleries', + '/api/v1/db/meta/tables/:tableId/galleries', ncMetaAclMw(galleryViewCreate, 'galleryViewCreate') ); -// router.get('/:galleryViewId', galleyViewGet); -router.put( - '/galleries/:galleryViewId', +router.patch( + '/api/v1/db/meta/galleries/:galleryViewId', ncMetaAclMw(galleryViewUpdate, 'galleryViewUpdate') ); router.get( - '/galleries/:galleryViewId', + '/api/v1/db/meta/galleries/:galleryViewId', ncMetaAclMw(galleryViewGet, 'galleryViewGet') ); -// router.delete('/:galleryViewId', galleyViewDelete); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts b/packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts index 119b825245..23890a928f 100644 --- a/packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts @@ -26,7 +26,7 @@ export async function gridViewCreate(req: Request, res) { const router = Router({ mergeParams: true }); router.post( - '/tables/:tableId/grids/', + '/api/v1/db/meta/tables/:tableId/grids/', ncMetaAclMw(gridViewCreate, 'gridViewCreate') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts b/packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts index 6ef54970d8..e3463bac58 100644 --- a/packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts @@ -14,11 +14,11 @@ export async function gridColumnUpdate(req: Request, res: Response) { const router = Router({ mergeParams: true }); router.get( - '/grid/:gridViewId/gridColumns', + '/api/v1/db/meta/grids/:gridViewId/grid/columns', ncMetaAclMw(columnList, 'columnList') ); -router.put( - '/gridColumns/:gridViewColumnId', +router.patch( + '/api/v1/db/meta/grid/columns/:gridViewColumnId', ncMetaAclMw(gridColumnUpdate, 'gridColumnUpdate') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/hookApis.ts b/packages/nocodb/src/lib/noco/meta/api/hookApis.ts index f116b33cd5..e67dddcaef 100644 --- a/packages/nocodb/src/lib/noco/meta/api/hookApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/hookApis.ts @@ -75,13 +75,28 @@ export async function tableSampleData(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.get('/tables/:tableId/hooks', ncMetaAclMw(hookList, 'hookList')); -router.post('/tables/:tableId/hooks/test', ncMetaAclMw(hookTest, 'hookTest')); -router.post('/tables/:tableId/hooks', ncMetaAclMw(hookCreate, 'hookCreate')); -router.delete('/hooks/:hookId', ncMetaAclMw(hookDelete, 'hookDelete')); -router.put('/hooks/:hookId', ncMetaAclMw(hookUpdate, 'hookUpdate')); router.get( - '/tables/:tableId/hooks/samplePayload/:operation', + '/api/v1/db/meta/tables/:tableId/hooks', + ncMetaAclMw(hookList, 'hookList') +); +router.post( + '/api/v1/db/meta/tables/:tableId/hooks/test', + ncMetaAclMw(hookTest, 'hookTest') +); +router.post( + '/api/v1/db/meta/tables/:tableId/hooks', + ncMetaAclMw(hookCreate, 'hookCreate') +); +router.delete( + '/api/v1/db/meta/hooks/:hookId', + ncMetaAclMw(hookDelete, 'hookDelete') +); +router.patch( + '/api/v1/db/meta/hooks/:hookId', + ncMetaAclMw(hookUpdate, 'hookUpdate') +); +router.get( + '/api/v1/db/meta/tables/:tableId/hooks/samplePayload/:operation', catchError(tableSampleData) ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts b/packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts index 73573324f9..c3bab363f0 100644 --- a/packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts @@ -117,7 +117,7 @@ router.get( '/hooks/:hookId/filters/:filterId', ncMetaAclMw(filterGet, 'filterGet') ); -router.put( +router.patch( '/hooks/:hookId/filters/:filterId', ncMetaAclMw(filterUpdate, 'filterUpdate') ); diff --git a/packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts b/packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts index 6b9f2ead4a..8324f4f2bf 100644 --- a/packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts @@ -826,9 +826,12 @@ export async function extractAndGenerateManyToManyRelations( } const router = Router(); -router.get('/projects/:projectId/metaDiff', ncMetaAclMw(metaDiff, 'metaDiff')); +router.get( + '/api/v1/db/meta/projects/:projectId/metaDiff', + ncMetaAclMw(metaDiff, 'metaDiff') +); router.post( - '/projects/:projectId/metaDiff', + '/api/v1/db/meta/projects/:projectId/metaDiff', ncMetaAclMw(metaDiffSync, 'metaDiffSync') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/modelVisibilityApis.ts b/packages/nocodb/src/lib/noco/meta/api/modelVisibilityApis.ts index 785dbb832e..ae03abf9b2 100644 --- a/packages/nocodb/src/lib/noco/meta/api/modelVisibilityApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/modelVisibilityApis.ts @@ -119,7 +119,7 @@ router.get( }, 'modelVisibilityList') ); router.post( - '/projects/:projectId/modelVisibility', + '/api/v1/db/meta/projects/:projectId/visibility-rules', ncMetaAclMw(xcVisibilityMetaSetAll, 'modelVisibilitySet') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/pluginApis.ts b/packages/nocodb/src/lib/noco/meta/api/pluginApis.ts index 2b3fd1657a..aff183d8b5 100644 --- a/packages/nocodb/src/lib/noco/meta/api/pluginApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/pluginApis.ts @@ -34,9 +34,21 @@ export async function isPluginActive(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.get('/plugins', ncMetaAclMw(pluginList, 'pluginList')); -router.post('/plugins/test', ncMetaAclMw(pluginTest, 'pluginTest')); -router.get('/plugins/:pluginId', ncMetaAclMw(pluginRead, 'pluginRead')); -router.put('/plugins/:pluginId', ncMetaAclMw(pluginUpdate, 'pluginUpdate')); -router.get('/plugins/:pluginTitle/status', ncMetaAclMw(isPluginActive, 'isPluginActive')); +router.get('/api/v1/db/meta/plugins', ncMetaAclMw(pluginList, 'pluginList')); +router.post( + '/api/v1/db/meta/plugins/test', + ncMetaAclMw(pluginTest, 'pluginTest') +); +router.get( + '/api/v1/db/meta/plugins/:pluginId', + ncMetaAclMw(pluginRead, 'pluginRead') +); +router.patch( + '/api/v1/db/meta/plugins/:pluginId', + ncMetaAclMw(pluginUpdate, 'pluginUpdate') +); +router.get( + '/api/v1/db/meta/plugins/:pluginTitle/status', + ncMetaAclMw(isPluginActive, 'isPluginActive') +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/projectApis.ts b/packages/nocodb/src/lib/noco/meta/api/projectApis.ts index 5323efd884..a35bba442a 100644 --- a/packages/nocodb/src/lib/noco/meta/api/projectApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/projectApis.ts @@ -392,14 +392,23 @@ export async function projectInfoGet(req, res) { export default router => { router.get( - '/projects/:projectId/info', + '/api/v1/db/meta/projects/:projectId/info', ncMetaAclMw(projectInfoGet, 'projectInfoGet') ); - router.get('/projects/:projectId', ncMetaAclMw(projectGet, 'projectGet')); + router.get( + '/api/v1/db/meta/projects/:projectId', + ncMetaAclMw(projectGet, 'projectGet') + ); router.delete( - '/projects/:projectId', + '/api/v1/db/meta/projects/:projectId', ncMetaAclMw(projectDelete, 'projectDelete') ); - router.post('/projects', ncMetaAclMw(projectCreate, 'projectCreate')); - router.get('/projects', ncMetaAclMw(projectList, 'projectList')); + router.post( + '/api/v1/db/meta/projects', + ncMetaAclMw(projectCreate, 'projectCreate') + ); + router.get( + '/api/v1/db/meta/projects', + ncMetaAclMw(projectList, 'projectList') + ); }; diff --git a/packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts b/packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts index 62c5f0b3ff..ecd05c3dc5 100644 --- a/packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts @@ -254,7 +254,7 @@ router.post( '/projects/:projectId/users', ncMetaAclMw(userInvite, 'userInvite') ); -router.put( +router.patch( '/projects/:projectId/users/:userId', ncMetaAclMw(projectUserUpdate, 'projectUserUpdate') ); diff --git a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts index b969de8934..b804b7b734 100644 --- a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts @@ -332,7 +332,7 @@ export async function publicHmList(req: Request, res: Response) { const router = Router({ mergeParams: true }); router.post('/public/data/:publicDataUuid/list', catchError(dataList)); router.post( - '/public/data/:publicDataUuid/relationTable/:columnId', + '/public/data/:publicDataUuid/nested/:columnId', catchError(relDataList) ); router.post( diff --git a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicMetaApis.ts b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicMetaApis.ts index 869deb951e..182495139d 100644 --- a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicMetaApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicMetaApis.ts @@ -6,12 +6,13 @@ import UITypes from '../../../../sqlUi/UITypes'; import { ErrorMessages, LinkToAnotherRecordType } from 'nocodb-sdk'; import Column from '../../../../noco-models/Column'; import Base from '../../../../noco-models/Base'; +import Project from '../../../../noco-models/Project'; export async function viewMetaGet(req: Request, res: Response) { const view: View & { relatedMetas?: { [ket: string]: Model }; client?: string; - } = await View.getByUUID(req.params.publicDataUuid); + } = await View.getByUUID(req.params.sharedViewUuids); if (!view) NcError.notFound('Not found'); @@ -66,7 +67,24 @@ export async function viewMetaGet(req: Request, res: Response) { res.json(view); } +async function publicSharedBaseGet(req, res): Promise { + const project = await Project.getByUuid(req.params.sharedBaseUuid); + + if (!project) { + NcError.notFound(); + } + + res.json({ project_id: project.id }); +} const router = Router({ mergeParams: true }); -router.post('/public/meta/:publicDataUuid/', catchError(viewMetaGet)); +router.post( + '/api/v1/db/meta/public/shared-view/:sharedViewUuid/meta', + catchError(viewMetaGet) +); + +router.get( + '/api/v1/db/meta/public/shared-base/:sharedBaseUuid/meta', + catchError(publicSharedBaseGet) +); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts b/packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts index df588e1ac6..1fa4be4508 100644 --- a/packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts @@ -3,7 +3,7 @@ import ncMetaAclMw from '../helpers/ncMetaAclMw'; import { v4 as uuidv4 } from 'uuid'; import { Tele } from 'nc-help'; import Project from '../../../noco-models/Project'; -import catchError, { NcError } from '../helpers/catchError'; +import { NcError } from '../helpers/catchError'; // todo: load from config const config = { dashboardPath: '/nc' @@ -88,32 +88,22 @@ async function getSharedBaseLink(req, res): Promise { res.json(data); } -async function publicSharedBaseGet(req, res): Promise { - const project = await Project.getByUuid(req.params.uuid); - - if (!project) { - NcError.notFound(); - } - - res.json({ project_id: project.id }); -} const router = Router({ mergeParams: true }); router.get( - '/projects/:projectId/sharedBase', + '/api/v1/db/meta/projects/:projectId/shared', ncMetaAclMw(getSharedBaseLink, 'getSharedBaseLink') ); router.post( - '/projects/:projectId/sharedBase', + '/api/v1/db/meta/projects/:projectId/shared', ncMetaAclMw(createSharedBaseLink, 'createSharedBaseLink') ); -router.put( - '/projects/:projectId/sharedBase', +router.patch( + '/api/v1/db/meta/projects/:projectId/shared', ncMetaAclMw(updateSharedBaseLink, 'updateSharedBaseLink') ); router.delete( - '/projects/:projectId/sharedBase', + '/api/v1/db/meta/projects/:projectId/shared', ncMetaAclMw(disableSharedBaseLink, 'disableSharedBaseLink') ); -router.get('/public/sharedBase/:uuid', catchError(publicSharedBaseGet)); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/sortApis.ts b/packages/nocodb/src/lib/noco/meta/api/sortApis.ts index 4ab4cfe0f0..26c2076c62 100644 --- a/packages/nocodb/src/lib/noco/meta/api/sortApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/sortApis.ts @@ -36,30 +36,34 @@ export async function sortCreate(req: Request, res) { res.json(sort); } -// @ts-ignore -export async function sortUpdate(req, res, next) { +export async function sortUpdate(req, res) { const sort = await Sort.update(req.params.sortId, req.body); Tele.emit('evt', { evt_type: 'sort:updated' }); res.json(sort); } -// @ts-ignore -export async function sortDelete(req: Request, res: Response, next) { +export async function sortDelete(req: Request, res: Response) { Tele.emit('evt', { evt_type: 'sort:deleted' }); const sort = await Sort.delete(req.params.sortId); res.json(sort); } const router = Router({ mergeParams: true }); -router.get('/views/:viewId/sorts/', ncMetaAclMw(sortList, 'sortList')); -router.post('/views/:viewId/sorts/', ncMetaAclMw(sortCreate, 'sortCreate')); -router.get('/views/:viewId/sorts/:sortId', ncMetaAclMw(sortGet, 'sortGet')); -router.put( - '/views/:viewId/sorts/:sortId', +router.get( + '/api/v1/db/meta/views/:viewId/sorts/', + ncMetaAclMw(sortList, 'sortList') +); +router.post( + '/api/v1/db/meta/views/:viewId/sorts/', + ncMetaAclMw(sortCreate, 'sortCreate') +); +router.get('/api/v1/db/meta/sorts/:sortId', ncMetaAclMw(sortGet, 'sortGet')); +router.patch( + '/api/v1/db/meta/sorts/:sortId', ncMetaAclMw(sortUpdate, 'sortUpdate') ); router.delete( - '/views/:viewId/sorts/:sortId', + '/api/v1/db/meta/sorts/:sortId', ncMetaAclMw(sortDelete, 'sortDelete') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/tableApis.ts b/packages/nocodb/src/lib/noco/meta/api/tableApis.ts index 58ee9686fa..ee5ab4ea9b 100644 --- a/packages/nocodb/src/lib/noco/meta/api/tableApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/tableApis.ts @@ -223,18 +223,27 @@ export async function tableDelete(req: Request, res: Response, next) { const router = Router({ mergeParams: true }); router.get( - '/projects/:projectId/:baseId/tables', + '/api/v1/db/meta/projects/:projectId/tables', ncMetaAclMw(tableList, 'tableList') ); router.post( - '/projects/:projectId/:baseId/tables', + '/api/v1/db/meta/projects/:projectId/tables', ncMetaAclMw(tableCreate, 'tableCreate') ); -router.get('/tables/:tableId', ncMetaAclMw(tableGet, 'tableGet')); -router.put('/tables/:tableId', ncMetaAclMw(tableUpdate, 'tableUpdate')); -router.delete('/tables/:tableId', ncMetaAclMw(tableDelete, 'tableDelete')); +router.get( + '/api/v1/db/meta/tables/:tableId', + ncMetaAclMw(tableGet, 'tableGet') +); +router.patch( + '/api/v1/db/meta/tables/:tableId', + ncMetaAclMw(tableUpdate, 'tableUpdate') +); +router.delete( + '/api/v1/db/meta/tables/:tableId', + ncMetaAclMw(tableDelete, 'tableDelete') +); router.post( - '/tables/:tableId/reorder', + '/api/v1/db/meta/tables/:tableId/reorder', ncMetaAclMw(tableReorder, 'tableReorder') ); export default router; diff --git a/packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts b/packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts index 7de6638c19..83051b481a 100644 --- a/packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts +++ b/packages/nocodb/src/lib/noco/meta/api/userApi/initStrategies.ts @@ -10,9 +10,7 @@ import { Strategy as AuthTokenStrategy } from 'passport-auth-token'; const PassportLocalStrategy = require('passport-local').Strategy; -// todo: read from database const jwtOptions = { - secretOrKey: 'dkjfkdjfkjdfjdfjdkfjdkfjkdfkjdkfjdkjfkdk', expiresIn: process.env.NC_JWT_EXPIRES_IN ?? '10h', jwtFromRequest: ExtractJwt.fromHeader('xc-auth') }; @@ -22,6 +20,7 @@ import Project from '../../../../noco-models/Project'; import NocoCache from '../../../../noco-cache/NocoCache'; import { CacheGetType, CacheScope } from '../../../../utils/globals'; import ApiToken from '../../../../noco-models/ApiToken'; +import Noco from '../../../Noco'; export function initStrategies(router): void { passport.use( @@ -82,8 +81,10 @@ export function initStrategies(router): void { passport.use( new Strategy( { + secretOrKey: Noco.getConfig().auth.jwt.secret, ...jwtOptions, - passReqToCallback: true + passReqToCallback: true, + ...Noco.getConfig().auth.jwt.options }, async (req, jwtPayload, done) => { const keyVals = [jwtPayload?.email]; diff --git a/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts b/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts index d4bb10773c..b5096d3e52 100644 --- a/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts @@ -15,10 +15,6 @@ import Audit from '../../../../noco-models/Audit'; import crypto from 'crypto'; import NcPluginMgrv2 from '../../helpers/NcPluginMgrv2'; -// todo: read from database -const secret = 'dkjfkdjfkjdfjdfjdkfjdkfjkdfkjdkfjdkjfkdk'; -const jwtConfig = {}; - import passport from 'passport'; import extractProjectIdAndAuthenticate from '../../helpers/extractProjectIdAndAuthenticate'; import ncMetaAclMw from '../../helpers/ncMetaAclMw'; @@ -154,7 +150,8 @@ export async function signup(req: Request, res: Response) { id: user.id, roles: user.roles }, - secret + Noco.getConfig().auth.jwt.secret, + Noco.getConfig().auth.jwt.options ) } as any); } @@ -200,8 +197,9 @@ async function signin(req, res, next) { id: user.id, roles: user.roles }, - secret, - jwtConfig + + Noco.getConfig().auth.jwt.secret, + Noco.getConfig().auth.jwt.options ) } as any); } catch (e) { @@ -392,6 +390,44 @@ async function emailVerification(req, res): Promise { res.json({ msg: 'Email verified successfully' }); } +async function refreshToken(req, res): Promise { + try { + if (!req?.cookies?.refresh_token) { + return res.status(400).json({ msg: 'Missing refresh token' }); + } + + const user = await User.getByRefreshToken(req.cookies.refresh_token); + + if (!user) { + return res.status(400).json({ msg: 'Invalid refresh token' }); + } + + const refreshToken = randomTokenString(); + + await User.update(user.id, { + refresh_token: refreshToken + }); + + setTokenCookie(res, refreshToken); + + res.json({ + token: jwt.sign( + { + email: user.email, + firstname: user.firstname, + lastname: user.lastname, + id: user.id, + roles: user.roles + }, + Noco.getConfig().auth.jwt.secret, + Noco.getConfig().auth.jwt.options + ) + } as any); + } catch (e) { + return res.status(400).json({ msg: e.message }); + } +} + const mapRoutes = router => { // todo: old api - /auth/signup?tool=1 router.post('/auth/user/signup', catchError(signup)); @@ -405,5 +441,6 @@ const mapRoutes = router => { '/user/password/change', ncMetaAclMw(passwordChange, 'passwordChange') ); + router.post('/auth/token/refresh', ncMetaAclMw(refreshToken, 'refreshToken')); }; export { mapRoutes as userApis }; diff --git a/packages/nocodb/src/lib/noco/meta/api/utilApis.ts b/packages/nocodb/src/lib/noco/meta/api/utilApis.ts index 12243fac73..a63a85d615 100644 --- a/packages/nocodb/src/lib/noco/meta/api/utilApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/utilApis.ts @@ -44,6 +44,9 @@ export async function appInfo(_req: Request, res: Response) { } export default router => { - router.post('/testConnection', ncMetaAclMw(testConnection, 'testConnection')); - router.get('/appInfo', catchError(appInfo)); + router.post( + '/api/v1/db/meta/connection/test', + ncMetaAclMw(testConnection, 'testConnection') + ); + router.get('/api/v1/db/meta/nocodb/info', catchError(appInfo)); }; diff --git a/packages/nocodb/src/lib/noco/meta/api/viewApis.ts b/packages/nocodb/src/lib/noco/meta/api/viewApis.ts index f61633cd8a..7602c999bf 100644 --- a/packages/nocodb/src/lib/noco/meta/api/viewApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/viewApis.ts @@ -101,29 +101,41 @@ async function shareViewList(req: Request, res) { } const router = Router({ mergeParams: true }); -router.get('/tables/:tableId/views', ncMetaAclMw(viewList, 'viewList')); -router.put('/views/:viewId', ncMetaAclMw(viewUpdate, 'viewUpdate')); -router.delete('/views/:viewId', ncMetaAclMw(viewDelete, 'viewDelete')); +router.get( + '/api/v1/db/meta/tables/:tableId/views', + ncMetaAclMw(viewList, 'viewList') +); +router.patch( + '/api/v1/db/meta/views/:viewId', + ncMetaAclMw(viewUpdate, 'viewUpdate') +); +router.delete( + '/api/v1/db/meta/views/:viewId', + ncMetaAclMw(viewDelete, 'viewDelete') +); router.post( - '/views/:viewId/showAll', + '/api/v1/db/meta/views/:viewId/showAll', ncMetaAclMw(showAllColumns, 'showAllColumns') ); router.post( - '/views/:viewId/hideAll', + '/api/v1/db/meta/views/:viewId/hideAll', ncMetaAclMw(hideAllColumns, 'hideAllColumns') ); router.get( - '/tables/:tableId/share', + '/api/v1/db/meta/tables/:tableId/share', ncMetaAclMw(shareViewList, 'shareViewList') ); -router.post('/views/:viewId/share', ncMetaAclMw(shareView, 'shareView')); -router.put( - '/views/:viewId/share', +router.post( + '/api/v1/db/meta/views/:viewId/share', + ncMetaAclMw(shareView, 'shareView') +); +router.patch( + '/api/v1/db/meta/views/:viewId/share', ncMetaAclMw(shareViewPasswordUpdate, 'shareViewPasswordUpdate') ); router.delete( - '/views/:viewId/share', + '/api/v1/db/meta/views/:viewId/share', ncMetaAclMw(shareViewDelete, 'shareViewDelete') ); diff --git a/packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts b/packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts index dc15c5669e..2a3588308c 100644 --- a/packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts @@ -31,10 +31,16 @@ export async function columnUpdate(req: Request, res: Response) { } const router = Router({ mergeParams: true }); -router.get('/views/:viewId/columns/', ncMetaAclMw(columnList, 'columnList')); -router.post('/views/:viewId/columns/', ncMetaAclMw(columnAdd, 'columnAdd')); -router.put( - '/views/:viewId/columns/:columnId', +router.get( + '/api/v1/db/meta/views/:viewId/columns/', + ncMetaAclMw(columnList, 'columnList') +); +router.post( + '/api/v1/db/meta/views/:viewId/columns/', + ncMetaAclMw(columnAdd, 'columnAdd') +); +router.patch( + '/api/v1/db/meta/views/:viewId/columns/:columnId', ncMetaAclMw(columnUpdate, 'viewColumnUpdate') ); export default router; diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index 11be38b85d..3ce5fd6828 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -276,40 +276,6 @@ } ] }, - "/auth/token/verify": { - "post": { - "summary": "Password Verify", - "operationId": "auth-token-verify", - "responses": { - "200": { - "description": "OK" - } - }, - "description": "", - "tags": [ - "Auth" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "token": { - "type": "string" - }, - "email": { - "type": "string" - } - } - } - } - }, - "description": "" - } - }, - "parameters": [] - }, "/auth/token/refresh": { "post": { "summary": "Refresh Token", @@ -326,7 +292,8 @@ }, "parameters": [] }, - "/projects/{projectId}/users": { + + "/api/v1/db/meta/projects/{projectId}/users": { "get": { "summary": "Project Users", "operationId": "auth-project-user-list", @@ -404,7 +371,7 @@ ] } }, - "/projects/{projectId}/info": { + "/api/v1/db/meta/projects/{projectId}/info": { "parameters": [ { "schema": { @@ -461,7 +428,7 @@ ] } }, - "/projects/{projectId}/users/{userId}": { + "/api/v1/db/meta/projects/{projectId}/users/{userId}": { "parameters": [ { "schema": { @@ -480,7 +447,7 @@ "required": true } ], - "put": { + "patch": { "summary": "Project User Update", "operationId": "auth-project-user-update", "responses": { @@ -522,7 +489,7 @@ ] } }, - "/projects/{projectId}/modelVisibility": { + "/api/v1/db/meta/projects/{projectId}/visibility-rules": { "get": { "summary": "UI ACL", "operationId": "project-model-visibility-list", @@ -588,7 +555,7 @@ ] } }, - "/projects/": { + "/api/v1/db/meta/projects/": { "parameters": [], "get": { "summary": "", @@ -676,7 +643,7 @@ ] } }, - "/projects/{projectId}": { + "/api/v1/db/meta/projects/{projectId}": { "parameters": [ { "schema": { @@ -731,7 +698,7 @@ ] } }, - "/projects/{projectId}/sharedBase": { + "/api/v1/db/meta/projects/{projectId}/shared": { "parameters": [ { "schema": { @@ -836,7 +803,7 @@ } } }, - "put": { + "patch": { "summary": "", "operationId": "project-shared-base-update", "responses": { @@ -867,89 +834,7 @@ "description": "" } }, - "/public/sharedBase/{sharedBaseUuid}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "sharedBaseUuid", - "in": "path", - "required": true - } - ], - "get": { - "summary": "", - "operationId": "public-shared-base-get", - "description": "Read project details", - "parameters": [], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "project_id": { - "type": "string" - } - } - } - } - } - } - }, - "tags": [ - "Public" - ] - } - }, - "/projects/{projectId}/views/{viewId}/upload": { - "post": { - "summary": "Attachment", - "operationId": "db-view-upload", - "responses": {}, - "tags": [ - "DB View" - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "files": {}, - "json": { - "type": "string" - } - } - } - } - }, - "description": "" - } - }, - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "projectId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "viewId", - "in": "path", - "required": true - } - ] - }, - "/projects/{projectId}/{baseId}/tables": { + "/api/v1/db/meta/projects/{projectId}/tables": { "parameters": [ { "schema": { @@ -958,14 +843,6 @@ "name": "projectId", "in": "path", "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "baseId", - "in": "path", - "required": true } ], "post": { @@ -1046,54 +923,7 @@ ] } }, - "/projects/{projectId}/metaDiff": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "projectId", - "in": "path", - "required": true - } - ], - "post": { - "summary": "", - "operationId": "project-meta-diff-sync", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} - } - } - } - }, - "tags": [ - "Project" - ] - }, - "get": { - "summary": "", - "operationId": "project-meta-diff-get", - "parameters": [], - "tags": [ - "Project" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} - } - } - } - } - } - }, - "/tables/{tableId}": { + "/api/v1/db/meta/tables/{tableId}": { "parameters": [ { "schema": { @@ -1213,7 +1043,7 @@ "DB Table" ] }, - "put": { + "patch": { "summary": "", "operationId": "db-table-update", "responses": { @@ -1258,7 +1088,7 @@ "description": "" } }, - "/tables/{tableId}/reorder": { + "/api/v1/db/meta/tables/{tableId}/reorder": { "parameters": [ { "schema": { @@ -1296,7 +1126,7 @@ ] } }, - "/tables/{tableId}/columns": { + "/api/v1/db/meta/tables/{tableId}/columns": { "parameters": [ { "schema": { @@ -1352,7 +1182,7 @@ ] } }, - "/tables/{tableId}/columns/{columnId}": { + "/api/v1/db/meta/tables/{tableId}/columns/{columnId}": { "parameters": [ { "schema": { @@ -1391,7 +1221,7 @@ "DB Table column" ] }, - "put": { + "patch": { "summary": "Column Update", "operationId": "db-table-column-update", "responses": { @@ -1432,7 +1262,7 @@ ] } }, - "/tables/{tableId}/columns/{columnId}/primary": { + "/api/v1/db/meta/tables/{tableId}/columns/{columnId}/primary": { "parameters": [ { "schema": { @@ -1464,7 +1294,32 @@ ] } }, - "/views/{viewId}": { + "/api/v1/db/meta/tables/{tableId}/views": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "tableId", + "in": "path", + "required": true + } + ], + "get": { + "summary": "", + "operationId": "db-view-list", + "responses": { + "200": { + "$ref": "#/components/responses/ViewList" + } + }, + "tags": [ + "DB View" + ], + "description": "" + } + }, + "/api/v1/db/meta/views/{viewId}": { "parameters": [ { "schema": { @@ -1475,7 +1330,7 @@ "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "db-view-update", "responses": { @@ -1528,47 +1383,7 @@ ] } }, - "/views/{viewId}/columns": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "viewId", - "in": "path", - "required": true - } - ], - "get": { - "summary": "", - "operationId": "db-view-column-list", - "responses": { - }, - "tags": [ - "DB View Column" - ] - }, - "post": { - "summary": "", - "operationId": "db-view-column-create", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View Column" - ], - "requestBody": { - "content": { - "application/json": { - "schema": {} - } - } - } - } - }, - "/views/{viewId}/showAll": { + "/api/v1/db/meta/views/{viewId}/showAll": { "parameters": [ { "schema": { @@ -1602,7 +1417,7 @@ ] } }, - "/views/{viewId}/hideAll": { + "/api/v1/db/meta/views/{viewId}/hideAll": { "parameters": [ { "schema": { @@ -1636,63 +1451,40 @@ "description": "" } }, - "/views/{viewId}/columns/{columnId}": { + "/api/v1/db/meta/tables/{tableId}/share": { "parameters": [ { "schema": { "type": "string" }, - "name": "viewId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "columnId", + "name": "tableId", "in": "path", "required": true } ], "get": { - "summary": "", - "operationId": "db-view-column-read", + "summary": "Shared view list", + "operationId": "db-view-share-list", "responses": { "200": { "description": "OK", "content": { "application/json": { - "schema": {} + "schema": { + "type": "array", + "items": {} + } } } } }, + "description": "", "tags": [ - "DB View Column" + "DB View Share" ] - }, - "put": { - "summary": "", - "operationId": "db-view-column-update", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View Column" - ], - "requestBody": { - "content": { - "application/json": { - "schema": {} - } - } - } } }, - "/views/{viewId}/share": { + "/api/v1/db/meta/views/{viewId}/share": { "parameters": [ { "schema": { @@ -1727,7 +1519,7 @@ "DB View Share" ] }, - "put": { + "patch": { "summary": "", "operationId": "db-view-share-update", "responses": { @@ -1775,7 +1567,7 @@ ] } }, - "/tables/{viewId}/share": { + "/api/v1/db/meta/views/{viewId}/columns": { "parameters": [ { "schema": { @@ -1788,27 +1580,90 @@ ], "get": { "summary": "", - "operationId": "db-view-share-list", + "operationId": "db-view-column-list", + "responses": { + }, + "tags": [ + "DB View Column" + ] + }, + "post": { + "summary": "", + "operationId": "db-view-column-create", + "responses": { + "200": { + "description": "OK" + } + }, + "tags": [ + "DB View Column" + ], + "requestBody": { + "content": { + "application/json": { + "schema": {} + } + } + } + } + }, + "/api/v1/db/meta/views/{viewId}/columns/{columnId}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "viewId", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "columnId", + "in": "path", + "required": true + } + ], + "get": { + "summary": "", + "operationId": "db-view-column-read", "responses": { "200": { "description": "OK", "content": { "application/json": { - "schema": { - "type": "array", - "items": {} - } + "schema": {} } } } }, - "description": "", "tags": [ - "DB View Share" + "DB View Column" ] + }, + "patch": { + "summary": "", + "operationId": "db-view-column-update", + "responses": { + "200": { + "description": "OK" + } + }, + "tags": [ + "DB View Column" + ], + "requestBody": { + "content": { + "application/json": { + "schema": {} + } + } + } } }, - "/views/{viewId}/sorts": { + "/api/v1/db/meta/views/{viewId}/sorts": { "parameters": [ { "schema": { @@ -1868,16 +1723,8 @@ } } }, - "/views/{viewId}/sorts/{sortId}": { + "/api/v1/db/meta/sorts/{sortId}": { "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "viewId", - "in": "path", - "required": true - }, { "schema": { "type": "string" @@ -1906,7 +1753,7 @@ "DB Table Sort" ] }, - "put": { + "patch": { "summary": "", "operationId": "db-table-sort-update", "responses": { @@ -1940,7 +1787,7 @@ ] } }, - "/views/{viewId}/filters": { + "/api/v1/db/meta/views/{viewId}/filters": { "parameters": [ { "schema": { @@ -1985,16 +1832,53 @@ } } }, - "/views/{viewId}/filters/{filterId}": { + "/api/v1/db/meta/hooks/{hookId}/filters": { "parameters": [ { "schema": { "type": "string" }, - "name": "viewId", + "name": "hookId", "in": "path", "required": true + } + ], + "get": { + "summary": "", + "operationId": "db-table-webhook-filter-read", + "responses": { + "200": { + "$ref": "#/components/responses/FilterList" + } + }, + "tags": [ + "DB Table Webhook Filter" + ] + }, + "post": { + "summary": "", + "operationId": "db-table-webhook-filter-create", + "responses": { + "200": { + "description": "OK" + } }, + "tags": [ + "DB Table Webhook Filter" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Filter" + } + } + } + } + } + }, + "/api/v1/db/meta/filters/{filterId}": { + "parameters": [ { "schema": { "type": "string" @@ -2023,7 +1907,7 @@ "DB Table Filter" ] }, - "put": { + "patch": { "summary": "", "operationId": "db-table-filter-update", "responses": { @@ -2057,16 +1941,8 @@ ] } }, - "/views/{viewId}/filters/{filterParentId}/children": { + "/api/v1/db/meta/filters/{filterParentId}/children": { "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "viewId", - "in": "path", - "required": true - }, { "schema": { "type": "string" @@ -2096,183 +1972,203 @@ ] } }, - "/hooks/{hookId}/filters": { + "/api/v1/db/meta/tables/{tableId}/grids": { "parameters": [ { "schema": { "type": "string" }, - "name": "hookId", + "name": "tableId", "in": "path", "required": true } ], - "get": { - "summary": "", - "operationId": "db-table-webhook-filter-read", - "responses": { - "200": { - "$ref": "#/components/responses/FilterList" - } - }, - "tags": [ - "DB Table Webhook Filter" - ] - }, "post": { "summary": "", - "operationId": "db-table-webhook-filter-create", + "operationId": "db-view-grid-create", "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Grid" + } + } + } } }, "tags": [ - "DB Table Webhook Filter" + "DB View" ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" + "$ref": "#/components/schemas/Grid" } } } } } }, - "/hooks/{viewId}/filters/{filterId}": { + "/api/v1/db/meta/tables/{tableId}/forms": { "parameters": [ { "schema": { "type": "string" }, - "name": "viewId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "filterId", + "name": "tableId", "in": "path", "required": true } ], - "get": { + "post": { "summary": "", - "operationId": "db-table-webhook-filter-get", + "operationId": "db-view-form-create", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" + "$ref": "#/components/schemas/Form" } } } } }, + "description": "", "tags": [ - "DB Table Webhook Filter" - ] - }, - "put": { + "DB View" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Form" + } + } + } + } + } + }, + "/api/v1/db/meta/forms/{formId}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "formId", + "in": "path", + "required": true + } + ], + "patch": { "summary": "", - "operationId": "db-table-webhook-filter-update", + "operationId": "db-view-form-update", "responses": { "200": { "description": "OK" } }, "tags": [ - "DB Table Webhook Filter" + "DB View" ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" + "$ref": "#/components/schemas/Form" } } } } }, - "delete": { + "get": { "summary": "", - "operationId": "db-table-webhook-filter-delete", + "operationId": "db-view-form-read", "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Form" + } + } + } } }, "tags": [ - "DB Table Webhook Filter" + "DB View" ] } }, - "/hooks/{viewId}/filters/{filterParentId}/children": { + "/api/v1/db/meta/form/columns/{formViewColumnId}": { "parameters": [ { "schema": { "type": "string" }, - "name": "viewId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "filterParentId", + "name": "formViewColumnId", "in": "path", "required": true } ], - "get": { + "patch": { "summary": "", - "operationId": "db-table-webhook-filter-children-read", + "operationId": "db-view-form-column-update", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" + "$ref": "" } } } } }, "tags": [ - "DB Table Webhook Filter" - ] + "DB View" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FormColumn" + } + } + } + } } }, - "/tables/{tableId}/grids": { + "/api/v1/db/meta/grids/{gidId}/grid/columns": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "gidId", "in": "path", "required": true } ], - "post": { + "get": { "summary": "", - "operationId": "db-view-grid-create", + "operationId": "db-view-grid-columns-list", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Grid" + "type": "array", + "items": { + "$ref": "#/components/schemas/GridColumn" + } } } } @@ -2280,75 +2176,48 @@ }, "tags": [ "DB View" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Grid" - } - } - } - } + ] } }, - "/tables/{tableId}/grids/{gridId}": { + "/api/v1/db/meta/grid/columns/{columnId}": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "gridId", + "name": "columnId", "in": "path", "required": true } ], - "put": { - "summary": "", - "operationId": "db-view-grid-update", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - }, - "delete": { + "patch": { "summary": "", - "operationId": "db-view-grid-delete", + "operationId": "db-view-grid-column-update", "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } } }, "tags": [ "DB View" - ] - }, - "get": { - "summary": "", - "operationId": "db-view-grid-read", - "responses": { - "200": { - "description": "OK" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GridColumn" + } + } } - }, - "tags": [ - "DB View" - ] + } } }, - "/tables/{tableId}/forms": { + "/api/v1/db/meta/tables/{tableId}/galleries": { "parameters": [ { "schema": { @@ -2361,20 +2230,20 @@ ], "post": { "summary": "", - "operationId": "db-view-form-create", + "operationId": "db-view-gallery-create", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Form" + "type": "object", + "properties": {} } } } } }, - "description": "", "tags": [ "DB View" ], @@ -2382,27 +2251,27 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Form" + "$ref": "#/components/schemas/Gallery" } } } } } }, - "/forms/{formId}": { + "/api/v1/db/meta/galleries/{galleryId}": { "parameters": [ { "schema": { "type": "string" }, - "name": "formId", + "name": "galleryId", "in": "path", "required": true } ], - "put": { + "patch": { "summary": "", - "operationId": "db-view-form-update", + "operationId": "db-view-gallery-update", "responses": { "200": { "description": "OK" @@ -2415,7 +2284,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Form" + "$ref": "#/components/schemas/Gallery" } } } @@ -2423,14 +2292,14 @@ }, "get": { "summary": "", - "operationId": "db-view-form-read", + "operationId": "db-view-gallery-read", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Form" + "$ref": "#/components/schemas/Gallery" } } } @@ -2441,94 +2310,110 @@ ] } }, - "/formColumns/{columnId}": { + "/api/v1/db/meta/projects/{projectId}/meta-diff": { "parameters": [ { "schema": { "type": "string" }, - "name": "columnId", + "name": "projectId", "in": "path", "required": true } ], - "put": { + "post": { "summary": "", - "operationId": "db-view-form-column-update", + "operationId": "project-meta-diff-sync", "responses": { "200": { "description": "OK", "content": { "application/json": { - "schema": { - "$ref": "" - } + "schema": {} } } } }, "tags": [ - "DB View" + "Project" + ] + }, + "get": { + "summary": "", + "operationId": "project-meta-diff-get", + "parameters": [], + "tags": [ + "Project" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FormColumn" + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} } } } } } }, - "/grid/{gidId}/gridColumns": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}": { "parameters": [ { "schema": { "type": "string" }, - "name": "gidId", + "name": "orgs", "in": "path", "required": true - } - ], - "get": { - "summary": "", - "operationId": "db-view-grid-columns-list", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GridColumn" - } - } - } - } - } }, - "tags": [ - "DB View" - ] - } - }, - "/gridColumns/{columnId}": { - "parameters": [ { "schema": { "type": "string" }, - "name": "columnId", + "name": "projectName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "tableName", "in": "path", "required": true } ], - "put": { + "get": { "summary": "", - "operationId": "db-view-grid-column-update", + "operationId": "db-table-row-list", + "description": "", + "tags": [ + "DB Table Row" + ], + "parameters": [ + { + "schema": { + "type": "array" + }, + "in": "query", + "name": "fields" + }, + { + "schema": { + "type": "array" + }, + "in": "query", + "name": "sort" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "where" + } + ], "responses": { "200": { "description": "OK", @@ -2538,157 +2423,48 @@ } } } - }, - "tags": [ - "DB View" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GridColumn" - } - } - } - } - } - }, - "/tables/{tableId}/galleries": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true } - ], + }, "post": { "summary": "", - "operationId": "db-view-gallery-create", + "operationId": "db-table-row-create", "responses": { "200": { "description": "OK", "content": { "application/json": { - "schema": { - "type": "object", - "properties": {} - } + "schema": {} } } } }, "tags": [ - "DB View" + "DB Table Row" ], "requestBody": { "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/Gallery" - } + "schema": {} } } } } }, - "/galleries/{galleryId}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}": { "parameters": [ { "schema": { "type": "string" }, - "name": "galleryId", + "name": "orgs", "in": "path", "required": true - } - ], - "put": { - "summary": "", - "operationId": "db-view-gallery-update", - "responses": { - "200": { - "description": "OK" - } }, - "tags": [ - "DB View" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Gallery" - } - } - } - } - }, - "delete": { - "summary": "", - "operationId": "db-view-gallery-delete", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - }, - "get": { - "summary": "", - "operationId": "db-view-gallery-read", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Gallery" - } - } - } - } - }, - "tags": [ - "DB View" - ] - } - }, - "/tables/{tableId}/kanbans": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true - } - ], - "post": { - "summary": "", - "operationId": "db-view-kanban-create", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - } - }, - "/tables/{tableId}/kanbans/{kanbanId}": { - "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "projectName", "in": "path", "required": true }, @@ -2696,90 +2472,54 @@ "schema": { "type": "string" }, - "name": "kanbanId", + "name": "tableName", "in": "path", "required": true - } - ], - "put": { - "summary": "", - "operationId": "db-view-kanban-update", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - }, - "delete": { - "summary": "", - "operationId": "db-view-kanban-delete", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB View" - ] - }, - "get": { - "summary": "", - "operationId": "db-view-kanban-read", - "responses": { - "200": { - "description": "OK" - } }, - "tags": [ - "DB View" - ] - } - }, - "/tables/{tableId}/views": { - "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "viewName", "in": "path", "required": true } ], "get": { "summary": "", - "operationId": "db-view-list", - "responses": { - "200": { - "$ref": "#/components/responses/ViewList" - } - }, + "operationId": "db-view-row-list", + "description": "", "tags": [ - "DB View" + "DB View Row" ], - "description": "" - } - }, - "/data/{tableId}": { - "parameters": [ - { - "schema": { - "type": "string" + "parameters": [ + { + "schema": { + "type": "array" + }, + "in": "query", + "name": "fields" }, - "name": "tableId", - "in": "path", - "required": true - } - ], - "get": { - "summary": "", - "operationId": "data-list", - "description": "", - "tags": [ - "Data" + { + "schema": { + "type": "array" + }, + "in": "query", + "name": "sort" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "where" + }, + { + "schema": {}, + "in": "query", + "name": "nested", + "description": "Query params for nested data" + } ], "responses": { "200": { @@ -2794,7 +2534,7 @@ }, "post": { "summary": "", - "operationId": "data-create", + "operationId": "db-view-row-create", "responses": { "200": { "description": "OK", @@ -2806,7 +2546,7 @@ } }, "tags": [ - "Data" + "DB View Row" ], "requestBody": { "content": { @@ -2817,65 +2557,29 @@ } } }, - "/data/{tableId}/export/{type}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId}": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "orgs", "in": "path", "required": true }, { "schema": { - "type": "string", - "enum": [ - "csv", - "excel" - ] + "type": "string" }, - "name": "type", + "name": "projectName", "in": "path", "required": true - } - ], - "get": { - "summary": "", - "operationId": "data-csv-export", - "description": "CSV or Excel export", - "tags": [ - "Data" - ], - "wrapped": true, - "responses": { - "200": { - "description": "OK", - "content": { - "application/octet-stream": { - "schema": {} - } - }, - "headers": { - "nc-export-offset": { - "schema": { - "type": "integer" - } - } - } - } }, - "parameters": [] - } - }, - - "/api/v1/db/data/{orgs}/{projectName}/{tableAlias}": { - "parameters": [ { "schema": { "type": "string" }, - "name": "orgs", + "name": "tableName", "in": "path", "required": true }, @@ -2883,7 +2587,7 @@ "schema": { "type": "string" }, - "name": "projectName", + "name": "viewName", "in": "path", "required": true }, @@ -2891,55 +2595,32 @@ "schema": { "type": "string" }, - "name": "tableAlias", + "name": "rowId", "in": "path", "required": true } ], "get": { "summary": "", - "operationId": "db-table-row-list", - "description": "", - "tags": [ - "DB Table Row" - ], - "parameters": [ - { - "schema": { - "type": "array" - }, - "in": "query", - "name": "fields" - }, - { - "schema": { - "type": "array" - }, - "in": "query", - "name": "sort" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "where" - } - ], + "operationId": "db-view-row-read", "responses": { - "200": { - "description": "OK", + "201": { + "description": "Created", "content": { "application/json": { "schema": {} } } } - } + }, + "description": "", + "tags": [ + "DB View Row" + ] }, - "post": { + "patch": { "summary": "", - "operationId": "db-table-row-create", + "operationId": "db-view-row-update", "responses": { "200": { "description": "OK", @@ -2951,7 +2632,7 @@ } }, "tags": [ - "DB Table Row" + "DB View Row" ], "requestBody": { "content": { @@ -2960,9 +2641,22 @@ } } } + }, + "delete": { + "summary": "", + "operationId": "db-view-row-delete", + "responses": { + "200": { + "description": "OK" + } + }, + "tags": [ + "DB View Row" + ], + "description": "" } }, - "/api/v1/db/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}": { "parameters": [ { "schema": { @@ -2984,7 +2678,7 @@ "schema": { "type": "string" }, - "name": "tableAlias", + "name": "tableName", "in": "path", "required": true }, @@ -2992,61 +2686,32 @@ "schema": { "type": "string" }, - "name": "viewName", + "name": "rowId", "in": "path", "required": true } ], "get": { "summary": "", - "operationId": "db-view-row-list", - "description": "", - "tags": [ - "DB View Row" - ], - "parameters": [ - { - "schema": { - "type": "array" - }, - "in": "query", - "name": "fields" - }, - { - "schema": { - "type": "array" - }, - "in": "query", - "name": "sort" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "where" - }, - { - "schema": {}, - "in": "query", - "name": "nested", - "description": "Query params for nested data" - } - ], + "operationId": "db-table-row-read", "responses": { - "200": { - "description": "OK", + "201": { + "description": "Created", "content": { "application/json": { "schema": {} } } } - } + }, + "description": "", + "tags": [ + "DB Table Row" + ] }, - "post": { + "patch": { "summary": "", - "operationId": "db-view-row-create", + "operationId": "db-table-row-update", "responses": { "200": { "description": "OK", @@ -3058,7 +2723,7 @@ } }, "tags": [ - "DB View Row" + "DB Table Row" ], "requestBody": { "content": { @@ -3067,9 +2732,22 @@ } } } + }, + "delete": { + "summary": "", + "operationId": "db-table-row-model-delete", + "responses": { + "200": { + "description": "OK" + } + }, + "tags": [ + "DB Table Row" + ], + "description": "" } }, - "/api/v1/db/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/{rowId}": { + "/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}": { "parameters": [ { "schema": { @@ -3091,33 +2769,17 @@ "schema": { "type": "string" }, - "name": "tableAlias", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "viewName", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "rowId", + "name": "tableName", "in": "path", "required": true } ], - "get": { + "post": { "summary": "", - "operationId": "db-view-row-read", + "operationId": "db-table-row-bulk-create", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -3125,14 +2787,20 @@ } } }, - "description": "", "tags": [ - "DB View Row" - ] + "DB Table Row" + ], + "requestBody": { + "content": { + "application/json": { + "schema": {} + } + } + } }, - "put": { + "patch": { "summary": "", - "operationId": "db-view-row-update", + "operationId": "db-table-row-bulk-create", "responses": { "200": { "description": "OK", @@ -3144,7 +2812,7 @@ } }, "tags": [ - "DB View Row" + "DB Table Row" ], "requestBody": { "content": { @@ -3156,19 +2824,30 @@ }, "delete": { "summary": "", - "operationId": "db-view-row-delete", + "operationId": "db-table-row-bulk-create", "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } } }, "tags": [ - "DB View Row" + "DB Table Row" ], - "description": "" + "requestBody": { + "content": { + "application/json": { + "schema": {} + } + } + } } }, - "/api/v1/db/data/{orgs}/{projectName}/{tableAlias}/{rowId}": { + "/api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/all": { "parameters": [ { "schema": { @@ -3190,25 +2869,17 @@ "schema": { "type": "string" }, - "name": "tableAlias", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "rowId", + "name": "tableName", "in": "path", "required": true } ], - "get": { + "patch": { "summary": "", - "operationId": "db-table-row-read", + "operationId": "db-table-row-create", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -3216,14 +2887,20 @@ } } }, - "description": "", "tags": [ "DB Table Row" - ] + ], + "requestBody": { + "content": { + "application/json": { + "schema": {} + } + } + } }, - "put": { + "delete": { "summary": "", - "operationId": "db-table-row-update", + "operationId": "db-table-row-create", "responses": { "200": { "description": "OK", @@ -3243,23 +2920,10 @@ "schema": {} } } - } - }, - "delete": { - "summary": "", - "operationId": "db-table-row-model-delete", - "responses": { - "200": { - "description": "OK" - } - }, - "tags": [ - "DB Table Row" - ], - "description": "" + } } }, - "/api/v1/db/data/{orgs}/{projectName}/{tableAlias}/views/{viewName}/export/{type}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/export/{type}": { "parameters": [ { "schema": { @@ -3281,7 +2945,7 @@ "schema": { "type": "string" }, - "name": "tableAlias", + "name": "tableName", "in": "path", "required": true }, @@ -3334,7 +2998,7 @@ "parameters": [] } }, - "/api/v1/db/data/{orgs}/{projectName}/{tableAlias}/export/{type}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/export/{type}": { "parameters": [ { "schema": { @@ -3356,15 +3020,7 @@ "schema": { "type": "string" }, - "name": "tableAlias", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "viewName", + "name": "tableName", "in": "path", "required": true }, @@ -3409,22 +3065,63 @@ "parameters": [] } }, - - - "/public/data/{uuid}/list": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}": { "parameters": [ { "schema": { "type": "string" }, - "name": "uuid", + "name": "orgs", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "projectName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "tableName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "rowId", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string", + "enum": [ + "mm", + "hm" + ] + }, + "name": "relationType", + "in": "path", + "required": true + },{ + "schema": { + "type": "string" + }, + "name": "columnName", "in": "path", "required": true } ], - "post": { + "get": { "summary": "", - "operationId": "public-data-list", + "operationId": "data-nested-list", "responses": { "200": { "description": "OK", @@ -3438,33 +3135,6 @@ "tags": [ "Public" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "sorts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Sort" - } - }, - "filters": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Filter" - } - } - } - } - } - }, - "description": "" - }, "parameters": [ { "schema": { @@ -3483,13 +3153,29 @@ ] } }, - "/public/data/{uuid}/{rowId}/{relationType}/{columnId}": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId}": { "parameters": [ { "schema": { "type": "string" }, - "name": "uuid", + "name": "orgs", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "projectName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "tableName", "in": "path", "required": true }, @@ -3517,14 +3203,22 @@ "schema": { "type": "string" }, - "name": "columnId", + "name": "columnName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "refRowId", "in": "path", "required": true } ], - "get": { + "post": { "summary": "", - "operationId": "public-data-nested-list", + "operationId": "data-nested-list", "responses": { "200": { "description": "OK", @@ -3556,13 +3250,29 @@ ] } }, - "/public/data/{uuid}/{rowId}/{relationType}/{columnId}/exclude": { + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/exclude": { "parameters": [ { "schema": { "type": "string" }, - "name": "uuid", + "name": "orgs", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "projectName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "tableName", "in": "path", "required": true }, @@ -3590,14 +3300,14 @@ "schema": { "type": "string" }, - "name": "columnId", + "name": "columnName", "in": "path", "required": true } ], "get": { "summary": "", - "operationId": "public-data-nested-excluded-list", + "operationId": "data-nested-excluded-children-list", "responses": { "200": { "description": "OK", @@ -3609,7 +3319,7 @@ } }, "tags": [ - "Public" + "DB Data" ], "parameters": [ { @@ -3629,32 +3339,14 @@ ] } }, - "/public/data/{uuid}/create": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "uuid", - "in": "path", - "required": true - } - ], + + "/projects/{projectId}/views/{viewId}/upload": { "post": { - "summary": "", - "operationId": "public-data-create", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} - } - } - } - }, + "summary": "Attachment", + "operationId": "db-view-upload", + "responses": {}, "tags": [ - "Public" + "DB View" ], "requestBody": { "content": { @@ -3662,8 +3354,8 @@ "schema": { "type": "object", "properties": { - "data": {}, - "password": { + "files": {}, + "json": { "type": "string" } } @@ -3671,59 +3363,50 @@ } }, "description": "" - }, - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "header" - } - ] - } - }, - "/public/data/{uuid}/export/{type}": { + } + }, "parameters": [ { "schema": { "type": "string" }, - "name": "uuid", + "name": "projectId", "in": "path", "required": true }, { "schema": { - "type": "string", - "enum": [ - "csv", - "excel" - ] + "type": "string" }, - "name": "type", + "name": "viewId", + "in": "path", + "required": true + } + ] + }, + + + "/api/v1/db/public/shared-view/{sharedViewUuid}/rows": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "sharedViewUuid", "in": "path", "required": true } ], - "post": { + "get": { "summary": "", - "operationId": "public-csv-export", - "description": "", - "wrapped": true, + "operationId": "public-data-list", "responses": { "200": { "description": "OK", "content": { - "application/octet-stream": { + "application/json": { "schema": {} } - }, - "headers": { - "nc-export-offset": { - "schema": { - "type": "integer" - } - } } } }, @@ -3739,56 +3422,23 @@ "password": { "type": "string" }, - "filters": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Filter" - } - }, "sorts": { "type": "array", "items": { - "$ref": "#/components/schemas/Sort" - } - } - } - } - } - } - } - } - }, - "/public/data/{uuid}/relationTable/{relationColumnId}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "uuid", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "relationColumnId", - "in": "path", - "required": true - } - ], - "post": { - "summary": "", - "operationId": "public-data-relation-list", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": {} + "$ref": "#/components/schemas/Sort" + } + }, + "filters": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Filter" + } + } + } } } - } + }, + "description": "" }, "parameters": [ { @@ -3805,52 +3455,16 @@ "in": "query", "name": "offset" } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Public" - ], - "description": "" - } - }, - "/public/meta/{uuid}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "uuid", - "in": "path", - "required": true - } - ], + ] + }, "post": { "summary": "", - "operationId": "public-shared-view-meta-get", + "operationId": "public-shared-view-create", "responses": { "200": { "description": "OK", "content": { "application/json": { - "schema": { - "type": "object", - "properties": {} - } - }, - "application/xml": { "schema": {} } } @@ -3859,31 +3473,39 @@ "tags": [ "Public" ], - "description": "", - "parameters": [], "requestBody": { "content": { - "application/json": { + "multipart/form-data": { "schema": { "type": "object", "properties": { + "data": {}, "password": { "type": "string" } } } } + }, + "description": "" + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "header" } - } + ] } }, - "/data/{tableId}/{rowId}/{relationType}/{colId}": { + "/api/v1/db/public/shared-view/{sharedViewUuid}/rows/{rowId}/{relationType}/{columnName}": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "sharedViewUuid", "in": "path", "required": true }, @@ -3897,9 +3519,13 @@ }, { "schema": { - "type": "string" + "type": "string", + "enum": [ + "mm", + "hm" + ] }, - "name": "colId", + "name": "relationType", "in": "path", "required": true }, @@ -3907,17 +3533,17 @@ "schema": { "type": "string" }, - "name": "relationType", + "name": "columnName", "in": "path", "required": true } ], "get": { "summary": "", - "operationId": "data-nested-list", + "operationId": "public-data-nested-list", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -3925,19 +3551,34 @@ } } }, - "description": "", "tags": [ - "Data" + "Public" + ], + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" + } ] } }, - "/data/{tableId}/{rowId}/{relationType}/{colId}/exclude": { + "/api/v1/db/public/shared-view/{sharedViewUuid}/rows/{rowId}/{relationType}/{columnName}/exclude": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", + "name": "sharedViewUuid", "in": "path", "required": true }, @@ -3951,9 +3592,13 @@ }, { "schema": { - "type": "string" + "type": "string", + "enum": [ + "mm", + "hm" + ] }, - "name": "colId", + "name": "relationType", "in": "path", "required": true }, @@ -3961,17 +3606,17 @@ "schema": { "type": "string" }, - "name": "relationType", + "name": "columnName", "in": "path", "required": true } ], "get": { "summary": "", - "operationId": "data-nested-excluded-list", + "operationId": "public-data-nested-excluded-list", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -3979,43 +3624,110 @@ } } }, - "description": "", "tags": [ - "Data" + "Public" + ], + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" + } ] } }, - "/data/{tableId}/{rowId}/{relationType}/{colId}/{referenceTableRowId}": { + "/api/v1/db/public/shared-view/{sharedViewUuid}/rows/export/{type}": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "rowId", + "name": "sharedViewUuid", "in": "path", "required": true }, { "schema": { - "type": "string" + "type": "string", + "enum": [ + "csv", + "excel" + ] }, - "name": "colId", + "name": "type", "in": "path", "required": true + } + ], + "post": { + "summary": "", + "operationId": "public-csv-export", + "description": "", + "wrapped": true, + "responses": { + "200": { + "description": "OK", + "content": { + "application/octet-stream": { + "schema": {} + } + }, + "headers": { + "nc-export-offset": { + "schema": { + "type": "integer" + } + } + } + } }, + "tags": [ + "Public" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "filters": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Filter" + } + }, + "sorts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Sort" + } + } + } + } + } + } + } + } + }, + "/api/v1/db/public/shared-view/{sharedViewUuid}/rows/nested/{columnName}": { + "parameters": [ { "schema": { "type": "string" }, - "name": "relationType", + "name": "sharedViewUuid", "in": "path", "required": true }, @@ -4023,17 +3735,17 @@ "schema": { "type": "string" }, - "name": "referenceTableRowId", + "name": "columnName", "in": "path", "required": true } ], "post": { "summary": "", - "operationId": "data-nested-add", + "operationId": "public-data-relation-list", "responses": { - "201": { - "description": "Created", + "200": { + "description": "OK", "content": { "application/json": { "schema": {} @@ -4041,101 +3753,133 @@ } } }, - "description": "", - "tags": [ - "Data" - ] - }, - "delete": { - "summary": "", - "operationId": "data-nested-delete", - "responses": { - "200": { - "description": "OK" + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string" + } + } + } + } } }, - "description": "", "tags": [ - "Data" - ] + "Public" + ], + "description": "" } }, - "/data/{tableId}/{rowId}": { + "/api/v1/db/public/shared-view/{sharedViewUuid}/meta": { "parameters": [ { "schema": { "type": "string" }, - "name": "tableId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string" - }, - "name": "rowId", + "name": "sharedViewUuid", "in": "path", "required": true } ], - "get": { - "summary": "", - "operationId": "data-read", - "responses": { - "201": { - "description": "Created", - "content": { - "application/json": { - "schema": {} - } - } - } - }, - "description": "", - "tags": [ - "Data" - ] - }, - "put": { + "post": { "summary": "", - "operationId": "data-update", + "operationId": "public-shared-view-meta-get", "responses": { "200": { "description": "OK", "content": { "application/json": { + "schema": { + "type": "object", + "properties": {} + } + }, + "application/xml": { "schema": {} } } } }, "tags": [ - "Data" + "Public" ], + "description": "", + "parameters": [], "requestBody": { "content": { "application/json": { - "schema": {} + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string" + } + } + } } } } - }, - "delete": { + } + }, + "/api/v1/db/public/shared-base/{sharedBaseUuid}/meta": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "sharedBaseUuid", + "in": "path", + "required": true + } + ], + "get": { "summary": "", - "operationId": "data-delete", + "operationId": "public-shared-base-get", + "description": "Read project details", + "parameters": [], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "project_id": { + "type": "string" + } + } + } + } + } } }, "tags": [ - "Data" - ], - "description": "" + "Public" + ] } }, - "/audits/comments": { + + "/api/v1/db/meta/audits/comments": { "parameters": [], "get": { "summary": "", @@ -4218,7 +3962,7 @@ ] } }, - "/audits/comments/count": { + "/api/v1/db/meta/audits/comments/count": { "parameters": [], "get": { "summary": "", @@ -4257,7 +4001,7 @@ ] } }, - "project/{projectId}/audits": { + "/api/v1/db/meta/project/{projectId}/audits": { "parameters": [ { "schema": { @@ -4322,8 +4066,17 @@ ] } }, - "/audits/rowUpdate": { - "parameters": [], + "/api/v1/db/meta/audits/rows/{rowId}/update": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "rowId", + "in": "path", + "required": true + } + ], "post": { "summary": "", "operationId": "utils-audit-row-update", @@ -4363,7 +4116,8 @@ } } }, - "/tables/{tableId}/hooks": { + + "/api/v1/db/meta/tables/{tableId}/hooks": { "parameters": [ { "schema": { @@ -4442,7 +4196,7 @@ ] } }, - "/tables/{tableId}/hooks/test": { + "/api/v1/db/meta/tables/{tableId}/hooks/test": { "parameters": [ { "schema": { @@ -4492,7 +4246,75 @@ } } }, - "/hooks/{hookId}": { + "/api/v1/db/meta/tables/{tableId}/hooks/samplePayload/{operation}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "tableId", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string", + "enum": [ + "update", + "delete", + "insert" + ] + }, + "name": "operation", + "in": "path", + "required": true + } + ], + "get": { + "summary": "", + "operationId": "db-table-webhook-sample-payload-get", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "plugins": { + "type": "object", + "properties": { + "list": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "$ref": "#/components/schemas/Plugin" + } + }, + "pageInfo": { + "$ref": "#/components/schemas/Paginated" + } + }, + "required": [ + "list", + "pageInfo" + ] + } + } + } + } + } + } + }, + "description": "", + "parameters": [], + "tags": [ + "DB Table Webhook" + ] + } + }, + "/api/v1/db/meta/hooks/{hookId}": { "parameters": [ { "schema": { @@ -4503,7 +4325,7 @@ "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "db-table-webhook-update", "responses": { @@ -4544,7 +4366,8 @@ ] } }, - "/plugins": { + + "/api/v1/db/meta/plugins": { "parameters": [], "get": { "summary": "", @@ -4581,7 +4404,7 @@ ] } }, - "/plugins/{pluginTitle}/status": { + "/api/v1/db/meta/plugins/{pluginTitle}/status": { "parameters": [ { "schema": { @@ -4614,75 +4437,7 @@ ] } }, - "/tables/{tableId}/hooks/samplePayload/{operation}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tableId", - "in": "path", - "required": true - }, - { - "schema": { - "type": "string", - "enum": [ - "update", - "delete", - "insert" - ] - }, - "name": "operation", - "in": "path", - "required": true - } - ], - "get": { - "summary": "", - "operationId": "db-table-webhook-sample-payload-get", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "plugins": { - "type": "object", - "properties": { - "list": { - "type": "array", - "uniqueItems": true, - "minItems": 1, - "items": { - "$ref": "#/components/schemas/Plugin" - } - }, - "pageInfo": { - "$ref": "#/components/schemas/Paginated" - } - }, - "required": [ - "list", - "pageInfo" - ] - } - } - } - } - } - } - }, - "description": "", - "parameters": [], - "tags": [ - "DB Table Webhook" - ] - } - }, - "/plugins/test": { + "/api/v1/db/meta/plugins/test": { "parameters": [], "post": { "summary": "", @@ -4731,7 +4486,7 @@ } } }, - "/plugins/{pluginId}": { + "/api/v1/db/meta/plugins/{pluginId}": { "parameters": [ { "schema": { @@ -4742,7 +4497,7 @@ "required": true } ], - "put": { + "patch": { "summary": "", "operationId": "plugin-update", "responses": { @@ -4790,7 +4545,8 @@ ] } }, - "/testConnection": { + + "/api/v1/db/meta/connection/test": { "parameters": [], "post": { "summary": "", @@ -4828,7 +4584,7 @@ "description": "" } }, - "/appInfo": { + "/api/v1/db/meta/nocodb/info": { "parameters": [], "get": { "summary": "", @@ -4849,7 +4605,7 @@ "description": "" } }, - "/cache": { + "/api/v1/db/meta/cache": { "get": { "summary": "Your GET endpoint", "tags": [ @@ -4874,7 +4630,8 @@ }, "parameters": [] }, - "/projects/{projectId}/apiTokens": { + + "/api/v1/db/meta/projects/{projectId}/apiTokens": { "get": { "summary": "Your GET endpoint", "tags": [ @@ -4944,7 +4701,7 @@ } ] }, - "/projects/{projectId}/apiTokens/{token}": { + "/api/v1/db/meta/projects/{projectId}/apiTokens/{token}": { "delete": { "summary": "", "operationId": "api-token-delete", @@ -4976,7 +4733,8 @@ } ] }, - "/bulkData/{orgs}/{projectName}/{tableAlias}/": { + + "/bulkData/{orgs}/{projectName}/{tableName}/": { "parameters": [ { "schema": { @@ -4998,7 +4756,7 @@ "schema": { "type": "string" }, - "name": "tableAlias", + "name": "tableName", "in": "path", "required": true } @@ -5079,7 +4837,7 @@ ] } }, - "/bulkData/{orgs}/{projectName}/{tableAlias}/all": { + "/bulkData/{orgs}/{projectName}/{tableName}/all": { "parameters": [ { "schema": { @@ -5101,7 +4859,7 @@ "schema": { "type": "string" }, - "name": "tableAlias", + "name": "tableName", "in": "path", "required": true } @@ -5227,6 +4985,30 @@ "email_verified" ] }, + "PageReqQueryParams": { + "title": "PageReqQueryParams", + "type": "object", + "description": "", + "x-internal": false, + "properties": { + "offset": { + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "query": { + "type": "string" + } + }, + "required": [ + "id", + "firstname", + "lastname", + "email", + "email_verified" + ] + }, "UserList": { "description": "", "type": "object",