Browse Source

refactor: rename row to record

pull/6624/head
Pranav C 1 year ago
parent
commit
6afc439ffc
  1. 2
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  2. 2
      packages/nc-gui/composables/useData.ts
  3. 2
      packages/nc-gui/composables/useExpandedFormStore.ts
  4. 2
      packages/nc-gui/composables/useKanbanViewStore.ts
  5. 2
      packages/nc-gui/composables/useLTARStore.ts
  6. 46
      packages/nc-gui/lang/en.json
  7. 18
      packages/nocodb/src/controllers/data-table.controller.ts
  8. 6
      packages/nocodb/src/db/BaseModelSqlv2.ts
  9. 2
      packages/nocodb/src/db/sql-client/lib/mysql/MysqlClient.ts
  10. 2
      packages/nocodb/src/helpers/PagedResponse.ts
  11. 4
      packages/nocodb/src/helpers/catchError.ts
  12. 6
      packages/nocodb/src/schema/swagger.json
  13. 64
      packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts
  14. 2
      packages/nocodb/tests/unit/rest/tests/viewRow.test.ts

2
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -402,7 +402,7 @@ const onDeleteRowClick = () => {
const onConfirmDeleteRowClick = async () => { const onConfirmDeleteRowClick = async () => {
showDeleteRowModal.value = false showDeleteRowModal.value = false
await deleteRowById(primaryKey.value) await deleteRowById(primaryKey.value)
message.success('Row deleted') message.success('Record deleted')
reloadTrigger.trigger() reloadTrigger.trigger()
onClose() onClose()
showDeleteRowModal.value = false showDeleteRowModal.value = false

2
packages/nc-gui/composables/useData.ts

@ -494,7 +494,7 @@ export function useData(args: {
if (res.message) { if (res.message) {
message.info( message.info(
`Row delete failed: ${`Unable to delete row with ID ${id} because of the following: `Record delete failed: ${`Unable to delete record with ID ${id} because of the following:
\n${res.message.join('\n')}.\n \n${res.message.join('\n')}.\n
Clear the data first & try again`})}`, Clear the data first & try again`})}`,
) )

2
packages/nc-gui/composables/useExpandedFormStore.ts

@ -322,7 +322,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
if (res.message) { if (res.message) {
message.info( message.info(
`Row delete failed: ${`Unable to delete row with ID ${rowId} because of the following: `Record delete failed: ${`Unable to delete record with ID ${rowId} because of the following:
\n${res.message.join('\n')}.\n \n${res.message.join('\n')}.\n
Clear the data first & try again`})}`, Clear the data first & try again`})}`,
) )

2
packages/nc-gui/composables/useKanbanViewStore.ts

@ -679,7 +679,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
if (res.message) { if (res.message) {
message.info( message.info(
`Row delete failed: ${`Unable to delete row with ID ${id} because of the following: `Record delete failed: ${`Unable to delete record with ID ${id} because of the following:
\n${res.message.join('\n')}.\n \n${res.message.join('\n')}.\n
Clear the data first & try again`})}`, Clear the data first & try again`})}`,
) )

2
packages/nc-gui/composables/useLTARStore.ts

@ -291,7 +291,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
if (res.message) { if (res.message) {
message.info( message.info(
`Row delete failed: ${`Unable to delete row with ID ${id} because of the following: `Record delete failed: ${`Unable to delete record with ID ${id} because of the following:
\n${res.message.join('\n')}.\n \n${res.message.join('\n')}.\n
Clear the data first & try again`})}`, Clear the data first & try again`})}`,
) )

46
packages/nc-gui/lang/en.json

@ -219,7 +219,7 @@
"orgLevelViewer": "Organization Level Viewer" "orgLevelViewer": "Organization Level Viewer"
}, },
"sqlVIew": "SQL View", "sqlVIew": "SQL View",
"rowHeight": "Row Height", "rowHeight": "Record Height",
"heightClass": { "heightClass": {
"short": "Short", "short": "Short",
"medium": "Medium", "medium": "Medium",
@ -291,11 +291,11 @@
"dateJoined": "Date Joined", "dateJoined": "Date Joined",
"tokenName": "Token name", "tokenName": "Token name",
"inDesktop": "in Desktop", "inDesktop": "in Desktop",
"rowData": "Row data", "rowData": "Record data",
"creator": "Creator", "creator": "Creator",
"qrCode": "QR Code", "qrCode": "QR Code",
"termsOfService": "Terms of Service", "termsOfService": "Terms of Service",
"updateSelectedRows": "Update Selected Rows", "updateSelectedRows": "Update Selected Records",
"noFiltersAdded": "No filters added", "noFiltersAdded": "No filters added",
"editCards": "Edit Cards", "editCards": "Edit Cards",
"noFieldsFound": "No fields found", "noFieldsFound": "No fields found",
@ -366,7 +366,7 @@
"codeSnippet": "Code Snippet", "codeSnippet": "Code Snippet",
"keyboardShortcut": "Keyboard Shortcuts", "keyboardShortcut": "Keyboard Shortcuts",
"generateRandomName": "Generate Random Name", "generateRandomName": "Generate Random Name",
"findRowByScanningCode": "Find row by scanning a QR or Barcode", "findRowByScanningCode": "Find record by scanning a QR or Barcode",
"tokenManagement": "Token Management", "tokenManagement": "Token Management",
"addNewToken": "Add new token", "addNewToken": "Add new token",
"accountSettings": "Account Settings", "accountSettings": "Account Settings",
@ -561,7 +561,7 @@
"goToDashboard": "Go to Dashboard", "goToDashboard": "Go to Dashboard",
"importing": "Importing", "importing": "Importing",
"formatJson": "Format JSON", "formatJson": "Format JSON",
"firstRowAsHeaders": "Use First Row as Headers", "firstRowAsHeaders": "Use First Record as Headers",
"flattenNested": "Flatten Nested", "flattenNested": "Flatten Nested",
"downloadAllowed": "Download allowed", "downloadAllowed": "Download allowed",
"weAreHiring": "We are Hiring!", "weAreHiring": "We are Hiring!",
@ -578,8 +578,8 @@
"agreeToTos": "By signing up, you agree to the Terms of Service", "agreeToTos": "By signing up, you agree to the Terms of Service",
"welcomeToNc": "Welcome to NocoDB!", "welcomeToNc": "Welcome to NocoDB!",
"inviteOnlySignup": "Allow signup only using invite url", "inviteOnlySignup": "Allow signup only using invite url",
"nextRow": "Next Row", "nextRow": "Next Record",
"prevRow": "Previous Row", "prevRow": "Previous Record",
"addRowGrid": "Manually add data in grid view", "addRowGrid": "Manually add data in grid view",
"addRowForm": "Enter record data through a form", "addRowForm": "Enter record data through a form",
"noAccess": "No access", "noAccess": "No access",
@ -695,17 +695,17 @@
"deleteTable": "Delete Table", "deleteTable": "Delete Table",
"addField": "Add new field to this table", "addField": "Add new field to this table",
"setDisplay": "Set as Display value", "setDisplay": "Set as Display value",
"addRow": "Add new row", "addRow": "Add new record",
"saveRow": "Save row", "saveRow": "Save record",
"saveAndExit": "Save & Exit", "saveAndExit": "Save & Exit",
"saveAndStay": "Save & Stay", "saveAndStay": "Save & Stay",
"insertRow": "Insert new row", "insertRow": "Insert new record",
"duplicateRow": "Duplicate row", "duplicateRow": "Duplicate record",
"deleteRow": "Delete row", "deleteRow": "Delete record",
"deleteRows": "Delete rows", "deleteRows": "Delete records",
"predictColumns": "Predict Columns", "predictColumns": "Predict Columns",
"predictFormulas": "Predict Formulas", "predictFormulas": "Predict Formulas",
"deleteSelectedRow": "Delete selected rows", "deleteSelectedRow": "Delete selected records",
"importExcel": "Import Excel", "importExcel": "Import Excel",
"importCSV": "Import CSV", "importCSV": "Import CSV",
"downloadCSV": "Download as CSV", "downloadCSV": "Download as CSV",
@ -719,7 +719,7 @@
"changePwd": "Change Password", "changePwd": "Change Password",
"createView": "Create a View", "createView": "Create a View",
"shareView": "Share View", "shareView": "Share View",
"findRowByCodeScan": "Find row by scan", "findRowByCodeScan": "Find record by scan",
"fillByCodeScan": "Fill by scan", "fillByCodeScan": "Fill by scan",
"listSharedView": "Shared View List", "listSharedView": "Shared View List",
"ListView": "Views List", "ListView": "Views List",
@ -974,22 +974,22 @@
}, },
"codeScanner": { "codeScanner": {
"loadingScanner": "Loading the scanner...", "loadingScanner": "Loading the scanner...",
"selectColumn": "Select a column (QR code or Barcode) that you want to use for finding a row by scanning.", "selectColumn": "Select a column (QR code or Barcode) that you want to use for finding a record by scanning.",
"moreThanOneRowFoundForCode": "More than one row found for this code. Currently only unique codes are supported.", "moreThanOneRowFoundForCode": "More than one record found for this code. Currently only unique codes are supported.",
"noRowFoundForCode": "No row found for this code for the selected column" "noRowFoundForCode": "No record found for this code for the selected column"
}, },
"map": { "map": {
"overLimit": "You're over the limit.", "overLimit": "You're over the limit.",
"closeLimit": "You're getting close to the limit.", "closeLimit": "You're getting close to the limit.",
"limitNumber": "The limit of markers shown in a Map View is 1000 records." "limitNumber": "The limit of markers shown in a Map View is 1000 records."
}, },
"footerInfo": "Rows per page", "footerInfo": "Records per page",
"upload": "Select file to Upload", "upload": "Select file to Upload",
"upload_sub": "or drag and drop file", "upload_sub": "or drag and drop file",
"excelSupport": "Supported: .xls, .xlsx, .xlsm, .ods, .ots", "excelSupport": "Supported: .xls, .xlsx, .xlsm, .ods, .ots",
"excelURL": "Enter excel file URL", "excelURL": "Enter excel file URL",
"csvURL": "Enter CSV file URL", "csvURL": "Enter CSV file URL",
"footMsg": "# of rows to parse to infer datatype", "footMsg": "# of records to parse to infer datatype",
"excelImport": "sheet(s) are available for import", "excelImport": "sheet(s) are available for import",
"exportMetadata": "Do you want to export metadata from meta tables?", "exportMetadata": "Do you want to export metadata from meta tables?",
"importMetadata": "Do you want to import metadata from meta tables?", "importMetadata": "Do you want to import metadata from meta tables?",
@ -1165,8 +1165,8 @@
"failedToLoadChildrenList": "Failed to load children list", "failedToLoadChildrenList": "Failed to load children list",
"deleteFailed": "Delete failed", "deleteFailed": "Delete failed",
"unlinkFailed": "Unlink failed", "unlinkFailed": "Unlink failed",
"rowUpdateFailed": "Row update failed", "rowUpdateFailed": "Record update failed",
"deleteRowFailed": "Failed to delete row", "deleteRowFailed": "Failed to delete record",
"setFormDataFailed": "Failed to set form data", "setFormDataFailed": "Failed to set form data",
"formViewUpdateFailed": "Failed to update form view", "formViewUpdateFailed": "Failed to update form view",
"tableNameRequired": "Table name is required", "tableNameRequired": "Table name is required",
@ -1209,7 +1209,7 @@
"success": { "success": {
"licenseKeyUpdated": "License Key Updated", "licenseKeyUpdated": "License Key Updated",
"columnDuplicated": "Column duplicated successfully", "columnDuplicated": "Column duplicated successfully",
"rowDuplicatedWithoutSavedYet": "Row duplicated (not saved)", "rowDuplicatedWithoutSavedYet": "Record duplicated (not saved)",
"updatedUIACL": "Updated UI ACL for tables successfully", "updatedUIACL": "Updated UI ACL for tables successfully",
"pluginUninstalled": "Plugin uninstalled successfully", "pluginUninstalled": "Plugin uninstalled successfully",
"pluginSettingsSaved": "Plugin settings saved successfully", "pluginSettingsSaved": "Plugin settings saved successfully",

18
packages/nocodb/src/controllers/data-table.controller.ts

@ -24,7 +24,7 @@ export class DataTableController {
constructor(private readonly dataTableService: DataTableService) {} constructor(private readonly dataTableService: DataTableService) {}
// todo: Handle the error case where view doesnt belong to model // todo: Handle the error case where view doesnt belong to model
@Get('/api/v1/tables/:modelId/rows') @Get('/api/v1/tables/:modelId/records')
@Acl('dataList') @Acl('dataList')
async dataList( async dataList(
@Request() req, @Request() req,
@ -43,7 +43,7 @@ export class DataTableController {
res.json(responseData); res.json(responseData);
} }
@Get(['/api/v1/tables/:modelId/rows/count']) @Get(['/api/v1/tables/:modelId/records/count'])
@Acl('dataCount') @Acl('dataCount')
async dataCount( async dataCount(
@Request() req, @Request() req,
@ -60,7 +60,7 @@ export class DataTableController {
res.json(countResult); res.json(countResult);
} }
@Post(['/api/v1/tables/:modelId/rows']) @Post(['/api/v1/tables/:modelId/records'])
@HttpCode(200) @HttpCode(200)
@Acl('dataInsert') @Acl('dataInsert')
async dataInsert( async dataInsert(
@ -77,7 +77,7 @@ export class DataTableController {
}); });
} }
@Patch(['/api/v1/tables/:modelId/rows']) @Patch(['/api/v1/tables/:modelId/records'])
@Acl('dataUpdate') @Acl('dataUpdate')
async dataUpdate( async dataUpdate(
@Request() req, @Request() req,
@ -93,7 +93,7 @@ export class DataTableController {
}); });
} }
@Delete(['/api/v1/tables/:modelId/rows']) @Delete(['/api/v1/tables/:modelId/records'])
@Acl('dataDelete') @Acl('dataDelete')
async dataDelete( async dataDelete(
@Request() req, @Request() req,
@ -109,7 +109,7 @@ export class DataTableController {
}); });
} }
@Get(['/api/v1/tables/:modelId/rows/:rowId']) @Get(['/api/v1/tables/:modelId/records/:rowId'])
@Acl('dataRead') @Acl('dataRead')
async dataRead( async dataRead(
@Request() req, @Request() req,
@ -125,7 +125,7 @@ export class DataTableController {
}); });
} }
@Get(['/api/v1/tables/:modelId/links/:columnId/rows/:rowId']) @Get(['/api/v1/tables/:modelId/links/:columnId/records/:rowId'])
@Acl('nestedDataList') @Acl('nestedDataList')
async nestedDataList( async nestedDataList(
@Request() req, @Request() req,
@ -143,7 +143,7 @@ export class DataTableController {
}); });
} }
@Post(['/api/v1/tables/:modelId/links/:columnId/rows/:rowId']) @Post(['/api/v1/tables/:modelId/links/:columnId/records/:rowId'])
@Acl('nestedDataLink') @Acl('nestedDataLink')
async nestedLink( async nestedLink(
@Request() req, @Request() req,
@ -164,7 +164,7 @@ export class DataTableController {
}); });
} }
@Delete(['/api/v1/tables/:modelId/links/:columnId/rows/:rowId']) @Delete(['/api/v1/tables/:modelId/links/:columnId/records/:rowId'])
@Acl('nestedDataUnlink') @Acl('nestedDataUnlink')
async nestedUnlink( async nestedUnlink(
@Request() req, @Request() req,

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

@ -4291,7 +4291,7 @@ class BaseModelSqlv2 {
// validate rowId // validate rowId
if (!row) { if (!row) {
NcError.notFound(`Row with id '${rowId}' not found`); NcError.notFound(`Record with id '${rowId}' not found`);
} }
if (!childIds.length) return; if (!childIds.length) return;
@ -4516,7 +4516,7 @@ class BaseModelSqlv2 {
// validate rowId // validate rowId
if (!row) { if (!row) {
NcError.notFound(`Row with id '${rowId}' not found`); NcError.notFound(`Record with id '${rowId}' not found`);
} }
if (!childIds.length) return; if (!childIds.length) return;
@ -4678,7 +4678,7 @@ class BaseModelSqlv2 {
// validate rowId // validate rowId
if (!row) { if (!row) {
NcError.notFound(`Row with id ${id} not found`); NcError.notFound(`Record with id ${id} not found`);
} }
const parentCol = await ( const parentCol = await (

2
packages/nocodb/src/db/sql-client/lib/mysql/MysqlClient.ts

@ -1936,7 +1936,7 @@ class MysqlClient extends KnexClient {
await promisify(jsonfile.writeFile)( await promisify(jsonfile.writeFile)(
seedSettings, seedSettings,
{ {
rows: { value: 8, description: 'Maximum number of rows' }, rows: { value: 8, description: 'Maximum number of records' },
foreign_key_rows: { foreign_key_rows: {
value: 2, value: 2,
description: '1:n - Total number foreign key per relation', description: '1:n - Total number foreign key per relation',

2
packages/nocodb/src/helpers/PagedResponse.ts

@ -37,7 +37,7 @@ export class PagedResponseImpl<T> {
if (offset && offset >= +count) { if (offset && offset >= +count) {
this.errors = [ this.errors = [
{ {
message: 'Offset is beyond the total number of rows', message: 'Offset is beyond the total number of records',
}, },
]; ];
} }

4
packages/nocodb/src/helpers/catchError.ts

@ -215,7 +215,7 @@ export function extractDBError(error): {
message = 'A timeout occurred while waiting for a table lock.'; message = 'A timeout occurred while waiting for a table lock.';
break; break;
case 'ER_NO_REFERENCED_ROW': case 'ER_NO_REFERENCED_ROW':
message = 'The referenced row does not exist.'; message = 'The referenced record does not exist.';
break; break;
case 'ER_ROW_IS_REFERENCED': case 'ER_ROW_IS_REFERENCED':
message = 'This record is being referenced by other records.'; message = 'This record is being referenced by other records.';
@ -232,7 +232,7 @@ export function extractDBError(error): {
message = 'A value is required for this field.'; message = 'A value is required for this field.';
break; break;
case '23503': case '23503':
message = 'The referenced row does not exist.'; message = 'The referenced record does not exist.';
break; break;
case '23514': case '23514':
message = 'A null value is not allowed for this field.'; message = 'A null value is not allowed for this field.';

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

@ -15693,7 +15693,7 @@
] ]
} }
}, },
"/api/v1/tables/{tableId}/rows/{rowId}": { "/api/v1/tables/{tableId}/records/{rowId}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -15790,7 +15790,7 @@
} }
} }
}, },
"/api/v1/tables/{tableId}/rows/count": { "/api/v1/tables/{tableId}/records/count": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {
@ -15929,7 +15929,7 @@
} }
} }
}, },
"/api/v1/tables/{tableId}/links/{columnId}/rows/{rowId}": { "/api/v1/tables/{tableId}/links/{columnId}/records/{rowId}": {
"parameters": [ "parameters": [
{ {
"schema": { "schema": {

64
packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts

@ -139,7 +139,7 @@ const verifyColumnsInRsp = (row, columns: ColumnType[]) => {
}; };
async function ncAxiosGet({ async function ncAxiosGet({
url = `/api/v1/tables/${table.id}/rows`, url = `/api/v1/tables/${table.id}/records`,
query = {}, query = {},
status = 200, status = 200,
}: { url?: string; query?: any; status?: number } = {}) { }: { url?: string; query?: any; status?: number } = {}) {
@ -153,7 +153,7 @@ async function ncAxiosGet({
} }
async function ncAxiosPost({ async function ncAxiosPost({
url = `/api/v1/tables/${table.id}/rows`, url = `/api/v1/tables/${table.id}/records`,
body = {}, body = {},
status = 200, status = 200,
}: { url?: string; body?: any; status?: number } = {}) { }: { url?: string; body?: any; status?: number } = {}) {
@ -166,7 +166,7 @@ async function ncAxiosPost({
} }
async function ncAxiosPatch({ async function ncAxiosPatch({
url = `/api/v1/tables/${table.id}/rows`, url = `/api/v1/tables/${table.id}/records`,
body = {}, body = {},
status = 200, status = 200,
}: { url?: string; body?: any; status?: number } = {}) { }: { url?: string; body?: any; status?: number } = {}) {
@ -179,7 +179,7 @@ async function ncAxiosPatch({
} }
async function ncAxiosDelete({ async function ncAxiosDelete({
url = `/api/v1/tables/${table.id}/rows`, url = `/api/v1/tables/${table.id}/records`,
body = {}, body = {},
status = 200, status = 200,
}: { url?: string; body?: any; status?: number } = {}) { }: { url?: string; body?: any; status?: number } = {}) {
@ -200,7 +200,7 @@ async function ncAxiosLinkGet({
msg, msg,
}: { urlParams?: any; query?: any; status?: number; msg?: string } = {}) { }: { urlParams?: any; query?: any; status?: number; msg?: string } = {}) {
const urlParams = { tableId, linkId, rowId }; const urlParams = { tableId, linkId, rowId };
const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/rows/${urlParams.rowId}`; const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/records/${urlParams.rowId}`;
const response = await request(context.app) const response = await request(context.app)
.get(url) .get(url)
.set('xc-auth', context.token) .set('xc-auth', context.token)
@ -226,7 +226,7 @@ async function ncAxiosLinkAdd({
msg, msg,
}: { urlParams?: any; body?: any; status?: number; msg?: string } = {}) { }: { urlParams?: any; body?: any; status?: number; msg?: string } = {}) {
const urlParams = { tableId, linkId, rowId }; const urlParams = { tableId, linkId, rowId };
const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/rows/${urlParams.rowId}`; const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/records/${urlParams.rowId}`;
const response = await request(context.app) const response = await request(context.app)
.post(url) .post(url)
.set('xc-auth', context.token) .set('xc-auth', context.token)
@ -253,7 +253,7 @@ async function ncAxiosLinkRemove({
msg, msg,
}: { urlParams?: any; body?: any; status?: number; msg?: string } = {}) { }: { urlParams?: any; body?: any; status?: number; msg?: string } = {}) {
const urlParams = { tableId, linkId, rowId }; const urlParams = { tableId, linkId, rowId };
const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/rows/${urlParams.rowId}`; const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/records/${urlParams.rowId}`;
const response = await request(context.app) const response = await request(context.app)
.delete(url) .delete(url)
.set('xc-auth', context.token) .set('xc-auth', context.token)
@ -310,7 +310,7 @@ function generalDb() {
// read first 4 records // read first 4 records
const records = await ncAxiosGet({ const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows`, url: `/api/v1/tables/${countryTable.id}/records`,
query: { query: {
limit: 4, limit: 4,
}, },
@ -340,7 +340,7 @@ function generalDb() {
// read first 4 records // read first 4 records
const records = await ncAxiosGet({ const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows`, url: `/api/v1/tables/${countryTable.id}/records`,
query: { query: {
limit: 4, limit: 4,
}, },
@ -366,7 +366,7 @@ function generalDb() {
// read first 4 records // read first 4 records
const records = await ncAxiosGet({ const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows`, url: `/api/v1/tables/${countryTable.id}/records`,
query: { query: {
limit: 4, limit: 4,
}, },
@ -381,7 +381,7 @@ function generalDb() {
it('Nested Read - Link to another record', async function () { it('Nested Read - Link to another record', async function () {
const records = await ncAxiosGet({ const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows/1`, url: `/api/v1/tables/${countryTable.id}/records/1`,
}); });
// extract LTAR column "City List" // extract LTAR column "City List"
@ -398,7 +398,7 @@ function generalDb() {
}); });
const records = await ncAxiosGet({ const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows/1`, url: `/api/v1/tables/${countryTable.id}/records/1`,
}); });
expect(records.body.Lookup).to.deep.equal(['Kabul']); expect(records.body.Lookup).to.deep.equal(['Kabul']);
}); });
@ -414,7 +414,7 @@ function generalDb() {
}); });
const records = await ncAxiosGet({ const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows/1`, url: `/api/v1/tables/${countryTable.id}/records/1`,
}); });
expect(records.body.Rollup).to.equal(1); expect(records.body.Rollup).to.equal(1);
@ -792,7 +792,7 @@ function textBased() {
it('List: invalid ID', async function () { it('List: invalid ID', async function () {
// Invalid table ID // Invalid table ID
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/tables/123456789/rows`, url: `/api/v1/tables/123456789/records`,
status: unauthorizedResponse, status: unauthorizedResponse,
}); });
@ -919,7 +919,7 @@ function textBased() {
it('Create: invalid ID', async function () { it('Create: invalid ID', async function () {
// Invalid table ID // Invalid table ID
await ncAxiosPost({ await ncAxiosPost({
url: `/api/v1/tables/123456789/rows`, url: `/api/v1/tables/123456789/records`,
status: unauthorizedResponse, status: unauthorizedResponse,
}); });
@ -946,19 +946,19 @@ function textBased() {
it('Read: all fields', async function () { it('Read: all fields', async function () {
const rsp = await ncAxiosGet({ const rsp = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/100`, url: `/api/v1/tables/${table.id}/records/100`,
}); });
}); });
it('Read: invalid ID', async function () { it('Read: invalid ID', async function () {
// Invalid table ID // Invalid table ID
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/tables/123456789/rows/100`, url: `/api/v1/tables/123456789/records/100`,
status: unauthorizedResponse, status: unauthorizedResponse,
}); });
// Invalid row ID // Invalid row ID
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1000`, url: `/api/v1/tables/${table.id}/records/1000`,
status: 404, status: 404,
}); });
}); });
@ -984,7 +984,7 @@ function textBased() {
it('Update: partial', async function () { it('Update: partial', async function () {
const recordBeforeUpdate = await ncAxiosGet({ const recordBeforeUpdate = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1`, url: `/api/v1/tables/${table.id}/records/1`,
}); });
const rsp = await ncAxiosPatch({ const rsp = await ncAxiosPatch({
@ -999,7 +999,7 @@ function textBased() {
expect(rsp.body).to.deep.equal([{ Id: 1 }]); expect(rsp.body).to.deep.equal([{ Id: 1 }]);
const recordAfterUpdate = await ncAxiosGet({ const recordAfterUpdate = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1`, url: `/api/v1/tables/${table.id}/records/1`,
}); });
expect(recordAfterUpdate.body).to.deep.equal({ expect(recordAfterUpdate.body).to.deep.equal({
...recordBeforeUpdate.body, ...recordBeforeUpdate.body,
@ -1031,7 +1031,7 @@ function textBased() {
it('Update: invalid ID', async function () { it('Update: invalid ID', async function () {
// Invalid table ID // Invalid table ID
await ncAxiosPatch({ await ncAxiosPatch({
url: `/api/v1/tables/123456789/rows`, url: `/api/v1/tables/123456789/records`,
body: { Id: 100, SingleLineText: 'some text' }, body: { Id: 100, SingleLineText: 'some text' },
status: unauthorizedResponse, status: unauthorizedResponse,
}); });
@ -1055,7 +1055,7 @@ function textBased() {
// check that it's gone // check that it's gone
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1`, url: `/api/v1/tables/${table.id}/records/1`,
status: 404, status: 404,
}); });
}); });
@ -1066,11 +1066,11 @@ function textBased() {
// check that it's gone // check that it's gone
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1`, url: `/api/v1/tables/${table.id}/records/1`,
status: 404, status: 404,
}); });
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/2`, url: `/api/v1/tables/${table.id}/records/2`,
status: 404, status: 404,
}); });
}); });
@ -1080,7 +1080,7 @@ function textBased() {
it('Delete: invalid ID', async function () { it('Delete: invalid ID', async function () {
// Invalid table ID // Invalid table ID
await ncAxiosDelete({ await ncAxiosDelete({
url: `/api/v1/tables/123456789/rows`, url: `/api/v1/tables/123456789/records`,
body: { Id: 100 }, body: { Id: 100 },
status: unauthorizedResponse, status: unauthorizedResponse,
}); });
@ -1261,7 +1261,7 @@ function numberBased() {
// read record with Id 401 // read record with Id 401
rsp = await ncAxiosGet({ rsp = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/401`, url: `/api/v1/tables/${table.id}/records/401`,
}); });
expect(rsp.body).to.deep.equal({ ...records[0], Id: 401 }); expect(rsp.body).to.deep.equal({ ...records[0], Id: 401 });
@ -1452,7 +1452,7 @@ function selectBased() {
// read record with Id 401 // read record with Id 401
rsp = await ncAxiosGet({ rsp = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/401`, url: `/api/v1/tables/${table.id}/records/401`,
}); });
expect(rsp.body).to.deep.equal({ Id: 401, ...records[0] }); expect(rsp.body).to.deep.equal({ Id: 401, ...records[0] });
@ -1591,7 +1591,7 @@ function dateBased() {
// read record with Id 801 // read record with Id 801
rsp = await ncAxiosGet({ rsp = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/801`, url: `/api/v1/tables/${table.id}/records/801`,
}); });
expect(rsp.body).to.deep.equal({ Id: 801, ...records[0] }); expect(rsp.body).to.deep.equal({ Id: 801, ...records[0] });
@ -2430,9 +2430,9 @@ function linkBased() {
status: 200, status: 200,
}); });
// Link List: Invalid query parameter - offset > total rows // Link List: Invalid query parameter - offset > total records
if (debugMode) if (debugMode)
console.log('Link List: Invalid query parameter - offset > total rows'); console.log('Link List: Invalid query parameter - offset > total records');
await ncAxiosLinkGet({ await ncAxiosLinkGet({
...validParams, ...validParams,
query: { ...validParams.query, offset: 9999 }, query: { ...validParams.query, offset: 9999 },
@ -2457,9 +2457,9 @@ function linkBased() {
status: 200, status: 200,
}); });
// Link List: Invalid query parameter - limit > total rows // Link List: Invalid query parameter - limit > total records
if (debugMode) if (debugMode)
console.log('Link List: Invalid query parameter - limit > total rows'); console.log('Link List: Invalid query parameter - limit > total records');
await ncAxiosLinkGet({ await ncAxiosLinkGet({
...validParams, ...validParams,
query: { ...validParams.query, limit: 9999 }, query: { ...validParams.query, limit: 9999 },

2
packages/nocodb/tests/unit/rest/tests/viewRow.test.ts

@ -672,7 +672,7 @@ function viewRowTests() {
.expect(200); .expect(200);
const row = response.body; const row = response.body;
if (row['Title'] !== 'Test') throw new Error('Wrong row title'); if (row['Title'] !== 'Test') throw new Error('Wrong record title');
}; };
it('Create table row grid', async function () { it('Create table row grid', async function () {

Loading…
Cancel
Save