Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

rename to fieldId

Fendy Heryantofdb5c077a21a
diff --git a/packages/nocodb/src/schema/swagger-v3.json b/packages/nocodb/src/schema/swagger-v3.json
index 791ec81b40..8eec34ed24 100644
--- a/packages/nocodb/src/schema/swagger-v3.json
+++ b/packages/nocodb/src/schema/swagger-v3.json
@@ -2290,12 +2290,12 @@
"list": [
{
"id": "so3o7c6po0tktghc",
- "field_id": "c580jyan91qwrbx",
+ "fieldId": "c580jyan91qwrbx",
"order": "asc"
},
{
"id": "so1n4x4w7dou8p0v",
- "field_id": "caymvuj3az60wyk",
+ "fieldId": "caymvuj3az60wyk",
"order": "desc"
}
]
@@ -2350,7 +2350,7 @@
"examples": {
"Example 1": {
"value": {
- "field_id": "c580jyan91qwrbx",
+ "fieldId": "c580jyan91qwrbx",
"order": "asc"
}
}
@@ -5131,7 +5131,7 @@
"description": "Unique identifier for the sort.",
"readOnly": true
},
- "field_id": {
+ "fieldId": {
"type": "string",
"format": "uuid",
"description": "Identifier for the field being sorted."
@@ -5147,14 +5147,14 @@
},
"required": [
"id",
- "field_id",
+ "fieldId",
"direction"
]
},
"SortCreate": {
"type": "object",
"properties": {
- "field_id": {
+ "fieldId": {
"type": "string",
"description": "Identifier for the field being sorted."
},
@@ -5168,7 +5168,7 @@
}
},
"required": [
- "field_id"
+ "fieldId"
]
},
"SortUpdate": {
@@ -5178,7 +5178,7 @@
"type": "string",
"description": "Unique identifier for the sort."
},
- "field_id": {
+ "fieldId": {
"type": "string",
"format": "uuid",
"description": "Identifier for the field being sorted."
@@ -5468,7 +5468,9 @@
"items": {
"type": "object",
"properties": {
- "field": "string",
+ "fieldId": {
+ "type": "string"
+ },
"direction": {
"type": "string",
"enum": [
@@ -5478,7 +5480,7 @@
}
},
"required": [
- "field"
+ "fieldId"
]
}
}
@@ -5490,10 +5492,14 @@
"stackBy": {
"type": "object",
"properties": {
- "fieldId": "string"
+ "fieldId": {
+ "type": "string"
+ }
}
},
- "coverFieldId": "string"
+ "coverFieldId": {
+ "type": "string"
+ }
},
"required": [
"stackBy"
@@ -5507,8 +5513,12 @@
"items": {
"type": "object",
"properties": {
- "startDateFieldId": "string",
- "endDateFieldId": "string"
+ "startDateFieldId": {
+ "type": "string"
+ },
+ "endDateFieldId": {
+ "type": "string"
+ }
},
"required": [
"startDateFieldId"
@@ -5523,7 +5533,9 @@
"ViewOptionsGallery": {
"type": "object",
"properties": {
- "coverFieldId": "string"
+ "coverFieldId": {
+ "type": "string"
+ }
}
},
"ViewOptionsForm": {
diff --git a/packages/nocodb/src/services/v3/sorts-v3.service.ts b/packages/nocodb/src/services/v3/sorts-v3.service.ts
index df631b7349..4346f8f462 100644
--- a/packages/nocodb/src/services/v3/sorts-v3.service.ts
+++ b/packages/nocodb/src/services/v3/sorts-v3.service.ts
@@ -22,9 +22,9 @@ export class SortsV3Service {
SortCreateV3Type | SortUpdateV3Type,
SortType
>({
- allowed: ['id', 'field_id', 'direction'],
+ allowed: ['id', 'fieldId', 'direction'],
mappings: {
- field_id: 'fk_column_id',
+ fieldId: 'fk_column_id',
},
});
@@ -69,7 +69,7 @@ export class SortsV3Service {
sort = await Sort.get(context, param.sortId);
} else {
const sorts = await Sort.list(context, { viewId: param.viewId });
- sort = sorts.find((s) => s.fk_column_id === param.sort.field_id);
+ sort = sorts.find((s) => s.fk_column_id === param.sort.fieldId);
}
if (!sort || sort.fk_view_id !== param.viewId) {
@@ -99,7 +99,7 @@ export class SortsV3Service {
// check for existing filter with same field
const sorts = await Sort.list(context, { viewId: param.viewId }, ncMeta);
const existingSort = sorts.find(
- (s) => s.fk_column_id === param.sort.field_id,
+ (s) => s.fk_column_id === param.sort.fieldId,
);
if (existingSort) {
NcError.badRequest('Sort already exists for this field');
@@ -108,7 +108,7 @@ export class SortsV3Service {
// check column exists
const column = await Column.get(
context,
- { colId: param.sort.field_id },
+ { colId: param.sort.fieldId },
ncMeta,
);
diff --git a/packages/nocodb/src/services/v3/views-v3.service.ts b/packages/nocodb/src/services/v3/views-v3.service.ts
index de5c439136..78020e7138 100644
--- a/packages/nocodb/src/services/v3/views-v3.service.ts
+++ b/packages/nocodb/src/services/v3/views-v3.service.ts
@@ -362,8 +362,8 @@ export class ViewsV3Service {
((c2 as GridViewColumn).group_by_order || Infinity),
)
.map((c) => ({
- field_id: c.fk_column_id,
- sort: (c as GridViewColumn).group_by_sort,
+ fieldId: c.fk_column_id,
+ direction: (c as GridViewColumn).group_by_sort,
}));
formattedView.options = formattedView.options ?? {};
formattedView.options.groups = group;
@@ -471,7 +471,7 @@ export class ViewsV3Service {
group_by_sort: group.direction,
},
gridViewColumnId: gridColumns.find(
- (col) => col.fk_column_id === group.field,
+ (col) => col.fk_column_id === group.fieldId,
).id,
req,
},
@@ -659,7 +659,7 @@ export class ViewsV3Service {
group_by_sort: group.direction,
},
gridViewColumnId: gridColumns.find(
- (col) => col.fk_column_id === group.field,
+ (col) => col.fk_column_id === group.fieldId,
).id,
req,
},
diff --git a/packages/nocodb/tests/unit/rest/tests/metaApiV3/error-handling/view.test.ts b/packages/nocodb/tests/unit/rest/tests/metaApiV3/error-handling/view.test.ts
index 8de3cf61ca..6073ab8273 100644
--- a/packages/nocodb/tests/unit/rest/tests/metaApiV3/error-handling/view.test.ts
+++ b/packages/nocodb/tests/unit/rest/tests/metaApiV3/error-handling/view.test.ts
@@ -90,7 +90,7 @@ export default function () {
type: 'GRID',
sorts: [
{
- field_id: (
+ fieldId: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},
@@ -107,7 +107,7 @@ export default function () {
name: 'MyView',
sorts: [
{
- field_id: (
+ fieldId: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},
@@ -125,7 +125,7 @@ export default function () {
type: 'NOGRID',
sorts: [
{
- field_id: (
+ fieldId: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},
@@ -144,7 +144,7 @@ export default function () {
type: 'GRID',
sorts: [
{
- fields_id: (
+ fieldIds: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},
@@ -162,9 +162,11 @@ export default function () {
name: 'MyView',
type: 'GRID',
options: {
- groups: [{
- field_id: 'asdmalmkdm'
- }]
+ groups: [
+ {
+ fieldIds: 'asdmalmkdm',
+ },
+ ],
},
});
expect(response.status).to.eq(400);
diff --git a/packages/nocodb/tests/unit/rest/tests/metaApiV3/view.test.ts b/packages/nocodb/tests/unit/rest/tests/metaApiV3/view.test.ts
index 61766038bf..b0522b0e81 100644
--- a/packages/nocodb/tests/unit/rest/tests/metaApiV3/view.test.ts
+++ b/packages/nocodb/tests/unit/rest/tests/metaApiV3/view.test.ts
@@ -91,7 +91,7 @@ export default function () {
type: 'GRID',
sorts: [
{
- field_id: (
+ fieldId: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},
@@ -106,7 +106,7 @@ export default function () {
name: 'MyView32',
sorts: [
{
- field_id: (
+ fieldId: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},
@@ -128,14 +128,14 @@ export default function () {
options: {
groups: [
{
- field: titleColumn.id,
+ fieldId: titleColumn.id,
direction: 'asc',
},
],
},
sorts: [
{
- field_id: titleColumn.id,
+ fieldId: titleColumn.id,
},
],
});
@@ -163,14 +163,14 @@ export default function () {
options: {
groups: [
{
- field: titleColumn.id,
+ fieldId: titleColumn.id,
direction: 'asc',
},
],
},
sorts: [
{
- field_id: titleColumn.id,
+ fieldId: titleColumn.id,
},
],
});
@@ -195,7 +195,7 @@ export default function () {
},
sorts: [
{
- field_id: (
+ fieldId: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},
@@ -222,7 +222,7 @@ export default function () {
},
sorts: [
{
- field_id: (
+ fieldId: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},
@@ -245,7 +245,7 @@ export default function () {
},
sorts: [
{
- field_id: (
+ fieldId: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},
@@ -266,7 +266,7 @@ export default function () {
},
sorts: [
{
- field_id: (
+ fieldId: (
await table.getColumns(ctx)
).find((col) => col.title === 'Title').id,
},