Browse Source

refactor: replace nestedDelete with nestedRemove

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1697/head
Pranav C 2 years ago
parent
commit
3c745fc675
  1. 2
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/belongsToCell.vue
  2. 2
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue
  3. 2
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue
  4. 42
      packages/nocodb-sdk/src/lib/Api.ts
  5. 208
      scripts/sdk/swagger.json

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

@ -281,7 +281,7 @@ export default {
const id = this.meta.columns.filter(c => c.pk).map(c => this.row[c.title]).join('___') const id = this.meta.columns.filter(c => c.pk).map(c => this.row[c.title]).join('___')
// todo: audit // todo: audit
await this.$api.dbTableRow.nestedDelete( await this.$api.dbTableRow.nestedRemove(
'noco', 'noco',
this.projectName, this.projectName,
this.meta.title, this.meta.title,

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

@ -342,7 +342,7 @@ export default {
return return
} }
const id = this.childMeta.columns.filter(c => c.pk).map(c => child[c.title]).join('___') const id = this.childMeta.columns.filter(c => c.pk).map(c => child[c.title]).join('___')
await this.$api.dbTableRow.nestedDelete( await this.$api.dbTableRow.nestedRemove(
'noco', 'noco',
this.projectName, this.projectName,
this.meta.title, this.meta.title,

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

@ -318,7 +318,7 @@ export default {
const cid = this.childMeta.columns.filter(c => c.pk).map(c => child[c.title]).join('___') const cid = this.childMeta.columns.filter(c => c.pk).map(c => child[c.title]).join('___')
const pid = this.meta.columns.filter(c => c.pk).map(c => this.row[c.title]).join('___') const pid = this.meta.columns.filter(c => c.pk).map(c => this.row[c.title]).join('___')
await this.$api.dbTableRow.nestedDelete( await this.$api.dbTableRow.nestedRemove(
'noco', 'noco',
this.projectName, this.projectName,
this.meta.title, this.meta.title,

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

@ -620,6 +620,15 @@ export type ColumnReqType =
} }
| { uidt?: string; formula_raw?: string; formula?: string; title?: string }; | { uidt?: string; formula_raw?: string; formula?: string; title?: string };
export interface UserInfoType {
id?: string;
email?: string;
email_verified?: string;
firstname?: string;
lastname?: string;
roles?: any;
}
import axios, { AxiosInstance, AxiosRequestConfig, ResponseType } from 'axios'; import axios, { AxiosInstance, AxiosRequestConfig, ResponseType } from 'axios';
export type QueryParamsType = Record<string | number, any>; export type QueryParamsType = Record<string | number, any>;
@ -798,7 +807,7 @@ export class Api<
* @summary Signup * @summary Signup
* @request POST:/api/v1/db/auth/user/signup * @request POST:/api/v1/db/auth/user/signup
* @response `200` `{ token?: string }` OK * @response `200` `{ token?: string }` OK
* @response `400` `void` Bad Request * @response `400` `{ msg?: string }` Bad Request
* @response `401` `void` Unauthorized * @response `401` `void` Unauthorized
* @response `403` `void` Forbidden * @response `403` `void` Forbidden
*/ */
@ -806,7 +815,7 @@ export class Api<
data: { email?: string; password?: string }, data: { email?: string; password?: string },
params: RequestParams = {} params: RequestParams = {}
) => ) =>
this.request<{ token?: string }, void>({ this.request<{ token?: string }, { msg?: string } | void>({
path: `/api/v1/db/auth/user/signup`, path: `/api/v1/db/auth/user/signup`,
method: 'POST', method: 'POST',
body: data, body: data,
@ -822,12 +831,13 @@ export class Api<
* @summary Signin * @summary Signin
* @request POST:/api/v1/db/auth/user/signin * @request POST:/api/v1/db/auth/user/signin
* @response `200` `{ token?: string }` OK * @response `200` `{ token?: string }` OK
* @response `400` `{ msg?: string }` Bad Request
*/ */
signin: ( signin: (
data: { email: string; password: string }, data: { email: string; password: string },
params: RequestParams = {} params: RequestParams = {}
) => ) =>
this.request<{ token?: string }, any>({ this.request<{ token?: string }, { msg?: string }>({
path: `/api/v1/db/auth/user/signin`, path: `/api/v1/db/auth/user/signin`,
method: 'POST', method: 'POST',
body: data, body: data,
@ -843,12 +853,13 @@ export class Api<
* @name Me * @name Me
* @summary User Info * @summary User Info
* @request GET:/api/v1/db/auth/user/me * @request GET:/api/v1/db/auth/user/me
* @response `200` `UserType` OK * @response `200` `UserInfoType` OK
*/ */
me: (params: RequestParams = {}) => me: (query?: { project_id?: string }, params: RequestParams = {}) =>
this.request<UserType, any>({ this.request<UserInfoType, any>({
path: `/api/v1/db/auth/user/me`, path: `/api/v1/db/auth/user/me`,
method: 'GET', method: 'GET',
query: query,
format: 'json', format: 'json',
...params, ...params,
}), }),
@ -861,9 +872,10 @@ export class Api<
* @summary Password Forgot * @summary Password Forgot
* @request POST:/api/v1/db/auth/password/forgot * @request POST:/api/v1/db/auth/password/forgot
* @response `200` `void` OK * @response `200` `void` OK
* @response `401` `void` Unauthorized
*/ */
passwordForgot: (data: { email?: string }, params: RequestParams = {}) => passwordForgot: (data: { email?: string }, params: RequestParams = {}) =>
this.request<void, any>({ this.request<void, void>({
path: `/api/v1/db/auth/password/forgot`, path: `/api/v1/db/auth/password/forgot`,
method: 'POST', method: 'POST',
body: data, body: data,
@ -878,21 +890,19 @@ export class Api<
* @name PasswordChange * @name PasswordChange
* @summary Password Change * @summary Password Change
* @request POST:/api/v1/db/auth/password/change * @request POST:/api/v1/db/auth/password/change
* @response `200` `void` OK * @response `200` `{ msg?: string }` OK
* @response `400` `{ msg?: string }` Bad request
*/ */
passwordChange: ( passwordChange: (
data: { data: { currentPassword?: string; newPassword?: string },
currentPassword?: string;
newPassword?: string;
verifyPassword?: string;
},
params: RequestParams = {} params: RequestParams = {}
) => ) =>
this.request<void, any>({ this.request<{ msg?: string }, { msg?: string }>({
path: `/api/v1/db/auth/password/change`, path: `/api/v1/db/auth/password/change`,
method: 'POST', method: 'POST',
body: data, body: data,
type: ContentType.Json, type: ContentType.Json,
format: 'json',
...params, ...params,
}), }),
@ -2466,11 +2476,11 @@ export class Api<
* No description * No description
* *
* @tags DB table row * @tags DB table row
* @name NestedDelete * @name NestedRemove
* @request DELETE:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId} * @request DELETE:/api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/{relationType}/{columnName}/{refRowId}
* @response `200` `any` OK * @response `200` `any` OK
*/ */
nestedDelete: ( nestedRemove: (
orgs: string, orgs: string,
projectName: string, projectName: string,
tableName: string, tableName: string,

208
scripts/sdk/swagger.json

@ -26,12 +26,58 @@
"type": "string" "type": "string"
} }
} }
},
"examples": {
"Successful registration response": {
"value": {
"token": "string"
}
}
} }
} }
} }
}, },
"400": { "400": {
"description": "Bad Request" "description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"msg": {
"type": "string"
}
}
},
"examples": {
"Invalid email": {
"value": {
"msg": "Invalid email"
}
},
"Invalid invite url": {
"value": {
"msg": "Invalid invite url"
}
},
"Expired invite url": {
"value": {
"msg": "Expired invite url, Please contact super admin to get a new invite url"
}
},
"User already exist": {
"value": {
"msg": "User already exist"
}
},
"Invite only signup": {
"value": {
"msg": "Not allowed to signup, contact super admin"
}
}
}
}
}
}, },
"401": { "401": {
"description": "Unauthorized" "description": "Unauthorized"
@ -68,6 +114,21 @@
} }
} }
} }
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"msg": {
"type": "string"
}
}
}
}
}
} }
}, },
"tags": [ "tags": [
@ -90,6 +151,14 @@
"email", "email",
"password" "password"
] ]
},
"examples": {
"example-1": {
"value": {
"email": "user@nocodb.com",
"password": "Password"
}
}
} }
} }
} }
@ -109,7 +178,21 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/User" "$ref": "#/components/schemas/UserInfo"
},
"examples": {
"example-1": {
"value": {
"id": "string",
"email": "string",
"email_verified": "string",
"firstname": "string",
"lastname": "string",
"roles": {
"editor": true
}
}
}
} }
} }
} }
@ -118,7 +201,17 @@
"tags": [ "tags": [
"Auth" "Auth"
], ],
"description": "Returns authenticated user info" "description": "Returns authenticated user info",
"parameters": [
{
"schema": {
"type": "string"
},
"in": "query",
"name": "project_id",
"description": "Pass project id to get project specific roles along with user info"
}
]
} }
}, },
"/api/v1/db/auth/password/forgot": { "/api/v1/db/auth/password/forgot": {
@ -128,6 +221,9 @@
"responses": { "responses": {
"200": { "200": {
"description": "OK" "description": "OK"
},
"401": {
"description": "Unauthorized"
} }
}, },
"description": "Emails user with a reset url.", "description": "Emails user with a reset url.",
@ -146,7 +242,8 @@
} }
} }
} }
} },
"description": "Pass registered user email id in request body"
} }
}, },
"parameters": [] "parameters": []
@ -157,7 +254,53 @@
"operationId": "auth-password-change", "operationId": "auth-password-change",
"responses": { "responses": {
"200": { "200": {
"description": "OK" "description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"msg": {
"type": "string"
}
}
},
"examples": {
"Success response": {
"value": {
"msg": "Password updated successfully"
}
}
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"msg": {
"type": "string"
}
}
},
"examples": {
"Missing params": {
"value": {
"msg": "Missing new/old password"
}
},
"Wrong password": {
"value": {
"msg": "Current password is wrong"
}
}
}
}
}
} }
}, },
"description": "Change password of authenticated user with a new one.", "description": "Change password of authenticated user with a new one.",
@ -175,14 +318,20 @@
}, },
"newPassword": { "newPassword": {
"type": "string" "type": "string"
}, }
"verifyPassword": { }
"type": "string" },
"examples": {
"example-1": {
"value": {
"currentPassword": "string",
"newPassword": "string"
} }
} }
} }
} }
} },
"description": "Old password need to be passed along with new password for changing password."
} }
}, },
"parameters": [] "parameters": []
@ -292,7 +441,6 @@
}, },
"parameters": [] "parameters": []
}, },
"/api/v1/db/meta/projects/{projectId}/users": { "/api/v1/db/meta/projects/{projectId}/users": {
"get": { "get": {
"summary": "Project Users", "summary": "Project Users",
@ -1522,8 +1670,7 @@
"get": { "get": {
"summary": "", "summary": "",
"operationId": "db-view-column-list", "operationId": "db-view-column-list",
"responses": { "responses": {},
},
"tags": [ "tags": [
"DB View Column" "DB View Column"
] ]
@ -2281,7 +2428,6 @@
} }
} }
}, },
"/api/v1/db/data/{orgs}/{projectName}/{tableName}": { "/api/v1/db/data/{orgs}/{projectName}/{tableName}": {
"parameters": [ "parameters": [
{ {
@ -3104,7 +3250,8 @@
"name": "relationType", "name": "relationType",
"in": "path", "in": "path",
"required": true "required": true
},{ },
{
"schema": { "schema": {
"type": "string" "type": "string"
}, },
@ -3245,7 +3392,7 @@
}, },
"delete": { "delete": {
"summary": "", "summary": "",
"operationId": "db-table-row-nested-delete", "operationId": "db-table-row-nested-remove",
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -3350,7 +3497,6 @@
] ]
} }
}, },
"/api/v1/db/public/shared-view/{sharedViewUuid}/rows": { "/api/v1/db/public/shared-view/{sharedViewUuid}/rows": {
"parameters": [ "parameters": [
{ {
@ -3421,7 +3567,7 @@
"multipart/form-data": { "multipart/form-data": {
"schema": { "schema": {
"type": "object", "type": "object",
"properties": { } "properties": {}
} }
} }
} }
@ -3707,7 +3853,6 @@
] ]
} }
}, },
"/api/v1/db/meta/audits/comments": { "/api/v1/db/meta/audits/comments": {
"parameters": [], "parameters": [],
"get": { "get": {
@ -3945,7 +4090,6 @@
} }
} }
}, },
"/api/v1/db/meta/tables/{tableId}/hooks": { "/api/v1/db/meta/tables/{tableId}/hooks": {
"parameters": [ "parameters": [
{ {
@ -4195,7 +4339,6 @@
] ]
} }
}, },
"/api/v1/db/meta/plugins": { "/api/v1/db/meta/plugins": {
"parameters": [], "parameters": [],
"get": { "get": {
@ -4374,7 +4517,6 @@
] ]
} }
}, },
"/api/v1/db/meta/connection/test": { "/api/v1/db/meta/connection/test": {
"parameters": [], "parameters": [],
"post": { "post": {
@ -4480,7 +4622,6 @@
}, },
"parameters": [] "parameters": []
}, },
"/api/v1/db/meta/projects/{projectId}/api-tokens": { "/api/v1/db/meta/projects/{projectId}/api-tokens": {
"get": { "get": {
"summary": "Your GET endpoint", "summary": "Your GET endpoint",
@ -4583,7 +4724,6 @@
} }
] ]
}, },
"/api/v1/db/storage/upload": { "/api/v1/db/storage/upload": {
"post": { "post": {
"summary": "Attachment", "summary": "Attachment",
@ -7031,6 +7171,28 @@
], ],
"description": "", "description": "",
"type": "object" "type": "object"
},
"UserInfo": {
"title": "UserInfo",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"email": {
"type": "string"
},
"email_verified": {
"type": "string"
},
"firstname": {
"type": "string"
},
"lastname": {
"type": "string"
},
"roles": {}
}
} }
}, },
"requestBodies": { "requestBodies": {

Loading…
Cancel
Save