Browse Source

fix: merge corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5747/head
Pranav C 1 year ago
parent
commit
9df1801b32
  1. 239
      packages/nocodb-sdk/src/lib/Api.ts
  2. 12
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -7542,245 +7542,6 @@ export class Api<
format: 'json',
...params,
}),
/**
* @description List all table view rows
*
* @tags DB Table Row
* @name TableRowList
* @summary List Table View Rows
* @request GET:/api/v1/base/{projectId}/tables/{tableId}
* @response `200` `{
\** List of table view rows *\
list: (object)[],
\** Paginated Info *\
pageInfo: PaginatedType,
}` OK
* @response `400` `{
\** @example BadRequest [Error]: <ERROR MESSAGE> *\
msg: string,
}`
*/
tableRowList: (
projectId: string,
tableId: string,
query: {
viewId: string;
fields?: any[];
sort?: any[];
where?: string;
/** Query params for nested data */
nested?: any;
offset?: number;
},
params: RequestParams = {}
) =>
this.request<
{
/** List of table view rows */
list: object[];
/** Paginated Info */
pageInfo: PaginatedType;
},
{
/** @example BadRequest [Error]: <ERROR MESSAGE> */
msg: string;
}
>({
path: `/api/v1/base/${projectId}/tables/${tableId}`,
method: 'GET',
query: query,
format: 'json',
...params,
}),
/**
* @description Create a new row in the given Table View
*
* @tags DB Table Row
* @name TableRowCreate
* @summary Create Table View Row
* @request POST:/api/v1/base/{projectId}/tables/{tableId}
* @response `200` `object` OK
* @response `400` `{
\** @example BadRequest [Error]: <ERROR MESSAGE> *\
msg: string,
}`
*/
tableRowCreate: (
projectId: string,
tableId: string,
query: {
viewId: string;
},
data: object,
params: RequestParams = {}
) =>
this.request<
object,
{
/** @example BadRequest [Error]: <ERROR MESSAGE> */
msg: string;
}
>({
path: `/api/v1/base/${projectId}/tables/${tableId}`,
method: 'POST',
query: query,
body: data,
type: ContentType.Json,
format: 'json',
...params,
}),
/**
* @description Count how many rows in the given Table View
*
* @tags DB Table Row
* @name TableRowCount
* @summary Count Table View Rows
* @request GET:/api/v1/base/{projectId}/tables/{tableId}/count
* @response `200` `{
count?: number,
}` OK
*/
tableRowCount: (
projectId: string,
tableId: string,
query: {
viewId: string;
where?: string;
/** Query params for nested data */
nested?: any;
},
params: RequestParams = {}
) =>
this.request<
{
count?: number;
},
any
>({
path: `/api/v1/base/${projectId}/tables/${tableId}/count`,
method: 'GET',
query: query,
format: 'json',
...params,
}),
/**
* @description Get the target Table View Row
*
* @tags DB Table Row
* @name DbViewRowRead
* @summary Get Table View Row
* @request GET:/api/v1/db/tables/{tableId}/rows/{rowId}
* @response `200` `object` OK
* @response `400` `{
\** @example BadRequest [Error]: <ERROR MESSAGE> *\
msg: string,
}`
*/
dbViewRowRead: (
tableId: string,
rowId: any,
query: {
viewId: string;
},
params: RequestParams = {}
) =>
this.request<
object,
{
/** @example BadRequest [Error]: <ERROR MESSAGE> */
msg: string;
}
>({
path: `/api/v1/db/tables/${tableId}/rows/${rowId}`,
method: 'GET',
query: query,
format: 'json',
...params,
}),
/**
* @description Update the target Table View Row
*
* @tags DB Table Row
* @name TableRowUpdate
* @summary Update Table View Row
* @request PATCH:/api/v1/db/tables/{tableId}/rows/{rowId}
* @response `200` `object` OK
* @response `400` `{
\** @example BadRequest [Error]: <ERROR MESSAGE> *\
msg: string,
}`
*/
tableRowUpdate: (
tableId: string,
rowId: any,
query: {
viewId: string;
},
data: object,
params: RequestParams = {}
) =>
this.request<
object,
{
/** @example BadRequest [Error]: <ERROR MESSAGE> */
msg: string;
}
>({
path: `/api/v1/db/tables/${tableId}/rows/${rowId}`,
method: 'PATCH',
query: query,
body: data,
type: ContentType.Json,
format: 'json',
...params,
}),
/**
* @description Delete the target Table View Row
*
* @tags DB Table Row
* @name TableRowDelete
* @summary Delete Table View Row
* @request DELETE:/api/v1/db/tables/{tableId}/rows/{rowId}
* @response `200` `number` OK
* @response `400` `{
\** @example BadRequest [Error]: <ERROR MESSAGE> *\
msg: string,
}`
*/
tableRowDelete: (
tableId: string,
rowId: any,
query: {
viewId: string;
},
params: RequestParams = {}
) =>
this.request<
number,
{
/** @example BadRequest [Error]: <ERROR MESSAGE> */
msg: string;
}
>({
path: `/api/v1/db/tables/${tableId}/rows/${rowId}`,
method: 'DELETE',
query: query,
format: 'json',
...params,
}),
};
dbViewRow = {
/**

12
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -2684,6 +2684,7 @@ class BaseModelSqlv2 {
args: { where?: string; filterArr?: Filter[] } = {},
{ cookie }: { cookie?: any } = {},
) {
let trx: Transaction;
try {
await this.model.getColumns();
const { where } = this._getListArgs(args);
@ -2707,9 +2708,18 @@ class BaseModelSqlv2 {
qb,
this.dbDriver,
);
const execQueries: ((trx: Transaction, qb: any) => Promise<any>)[] = [];
// qb.del();
qb.del();
for (const column of this.model.columns) {
if (column.uidt !== UITypes.LinkToAnotherRecord) continue;
const colOptions =
await column.getColOptions<LinkToAnotherRecordColumn>();
if (colOptions.type === 'bt') {
continue;
}
const childColumn = await colOptions.getChildColumn();
const parentColumn = await colOptions.getParentColumn();

Loading…
Cancel
Save