From 09c7068f788ec70da95d7b9127a56c0a079cc18c Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 12:23:50 +0800 Subject: [PATCH 01/11] fix(nocodb): swagger errors --- packages/nocodb/src/schema/swagger.json | 64 ++++++++++++------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/nocodb/src/schema/swagger.json b/packages/nocodb/src/schema/swagger.json index 3567f768ba..3d42c0caca 100644 --- a/packages/nocodb/src/schema/swagger.json +++ b/packages/nocodb/src/schema/swagger.json @@ -3425,7 +3425,6 @@ "lock_type": "collaborative", "meta": {}, "order": 1, - "password": null, "project_id": "p_xm3thidrblw4n7", "show": 1, "show_system_fields": null, @@ -6967,20 +6966,24 @@ "parameters": [ { "schema": { - "type": "string" + "type": "string", + "example": "76d44b86-bc65-4500-8956-ab512c80ab25" }, "name": "sharedViewUuid", "in": "path", - "required": true + "required": true, + "description": "Shared View UUID" }, { "schema": { "type": "string", - "enum": ["csv", "excel"] + "enum": ["csv", "excel"], + "example": "csv" }, "name": "type", "in": "path", - "required": true + "required": true, + "description": "Export Type" } ], "get": { @@ -9066,6 +9069,8 @@ "virtual": null } ], + "title": "Column Model", + "type": "object", "properties": { "ai": { "$ref": "#/components/schemas/Bool", @@ -9085,8 +9090,8 @@ "type": "string" }, "cdf": { - "description": "Column Default", - "type": "string" + "$ref": "#/components/schemas/StringOrNull", + "description": "Column Default" }, "clen": { "description": "Character Maximum Length", @@ -9135,9 +9140,8 @@ "type": "string" }, "csn": { - "description": "Character Set Name", - "example": "utf8mb4", - "type": "string" + "$ref": "#/components/schemas/StringOrNull", + "description": "Character Set Name" }, "ct": { "description": "Column Type", @@ -9308,9 +9312,7 @@ "$ref": "#/components/schemas/Bool", "description": "Is Visible?" } - }, - "title": "Column Model", - "type": "object" + } }, "ColumnList": { "description": "Model for Column List", @@ -12642,20 +12644,18 @@ "password": "123456789" } ], + "title": "Shared View Request Model", + "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/Meta", "description": "Meta data passing to Shared View such as if download is allowed or not." }, "password": { - "description": "Password to restrict access", - "example": "123456789", - "minLength": 8, - "type": "string" + "$ref": "#/components/schemas/StringOrNull", + "description": "Password to restrict access" } - }, - "title": "Shared View Request Model", - "type": "object" + } }, "SignInReq": { "description": "Model for Signin Request", @@ -13219,6 +13219,8 @@ ] } ], + "title": "Table Model", + "type": "object", "properties": { "base_id": { "description": "Unique Base ID", @@ -13226,10 +13228,10 @@ }, "columns": { "description": "The columns included in this table", + "type": "array", "items": { "$ref": "#/components/schemas/Column" - }, - "type": "array" + } }, "columnsById": { "description": "Column Models grouped by IDs", @@ -13271,8 +13273,8 @@ "type": "string" }, "tags": { - "description": "Currently not in use", - "type": "string" + "$ref": "#/components/schemas/StringOrNull", + "description": "Currently not in use" }, "title": { "description": "Table Title", @@ -13283,9 +13285,7 @@ "type": "string" } }, - "required": ["table_name", "title"], - "title": "Table Model", - "type": "object" + "required": ["table_name", "title"] }, "TableList": { "description": "Model for Table List", @@ -13747,6 +13747,8 @@ } } ], + "title": "View Model", + "type": "object", "properties": { "base_id": { "$ref": "#/components/schemas/Id", @@ -13798,8 +13800,8 @@ "type": "number" }, "uuid": { - "description": "UUID of the view", - "type": "string" + "$ref": "#/components/schemas/StringOrNull", + "description": "UUID of the view" }, "view": { "anyOf": [ @@ -13822,9 +13824,7 @@ "description": "Associated View Model" } }, - "required": ["fk_model_id", "show", "title", "type"], - "title": "View Model", - "type": "object" + "required": ["fk_model_id", "show", "title", "type"] }, "ViewList": { "description": "Model for View List", From 240579e69f666a181aa85da44deabf0ee4a31778 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 12:25:00 +0800 Subject: [PATCH 02/11] chore(sdk): regenerate Api.ts --- packages/nocodb-sdk/src/lib/Api.ts | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index 9286759154..8cded93ed5 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -307,7 +307,7 @@ export interface ColumnType { /** Column Comment */ cc?: string; /** Column Default */ - cdf?: string; + cdf?: StringOrNullType; /** Character Maximum Length */ clen?: number | null | string; /** Column Options */ @@ -331,11 +331,8 @@ export interface ColumnType { column_name?: string; /** Column Ordinal Position */ cop?: string; - /** - * Character Set Name - * @example utf8mb4 - */ - csn?: string; + /** Character Set Name */ + csn?: StringOrNullType; /** * Column Type * @example varchar(45) @@ -1885,11 +1882,8 @@ export interface SharedViewListType { export interface SharedViewReqType { /** Meta data passing to Shared View such as if download is allowed or not. */ meta?: MetaType; - /** - * Password to restrict access - * @example 123456789 - */ - password?: string; + /** Password to restrict access */ + password?: StringOrNullType; } /** @@ -2004,7 +1998,7 @@ export interface TableType { /** Table Name. Prefix will be added for XCDB projects. */ table_name: string; /** Currently not in use */ - tags?: string; + tags?: StringOrNullType; /** Table Title */ title: string; /** Table Type */ @@ -2142,7 +2136,7 @@ export interface ViewType { /** View Type */ type: number; /** UUID of the view */ - uuid?: string; + uuid?: StringOrNullType; /** Associated View Model */ view?: | FormType From 0e7365e118b7753de7eded64c73dc28d448c5431 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 12:52:28 +0800 Subject: [PATCH 03/11] refactor(nocodb): sort tags by groups --- packages/nocodb/src/schema/swagger.json | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/packages/nocodb/src/schema/swagger.json b/packages/nocodb/src/schema/swagger.json index 3d42c0caca..146989239e 100644 --- a/packages/nocodb/src/schema/swagger.json +++ b/packages/nocodb/src/schema/swagger.json @@ -5,6 +5,51 @@ "version": "1.0", "description": "NocoDB API Documentation" }, + "x-tagGroups": [ + { + "name": "Auth APIs", + "tags": ["Auth", "API Token"] + }, + { + "name": "Public APIs", + "tags": ["Public"] + }, + { + "name": "Data APIs", + "tags": [ + "DB Table Row", + "DB View Row", + "Storage" + ] + }, + { + "name": "Meta APIs", + "tags": [ + "Base", + "DB Table", + "DB Table Column", + "DB Table Filter", + "DB Table Sort", + "DB Table Webhook", + "DB Table Webhook Filter", + "DB View", + "DB View Column", + "DB View Share", + "Plugin", + "Project", + "Utils" + ] + }, + { + "name": "Organisation APIs", + "tags": [ + "Org App Settings", + "Org License", + "Org Tokens", + "Org Users" + ] + } + ], "servers": [ { "url": "http://localhost:8080" From 9a3e69700398de57c4e31711179580dea3e1f420 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 13:57:00 +0800 Subject: [PATCH 04/11] refactor(nocodb): revise grid model & add examples in swagger.json --- packages/nocodb/src/schema/swagger.json | 702 +++++++++++++++++++++--- 1 file changed, 639 insertions(+), 63 deletions(-) diff --git a/packages/nocodb/src/schema/swagger.json b/packages/nocodb/src/schema/swagger.json index 146989239e..ca0a6f81a8 100644 --- a/packages/nocodb/src/schema/swagger.json +++ b/packages/nocodb/src/schema/swagger.json @@ -16,11 +16,7 @@ }, { "name": "Data APIs", - "tags": [ - "DB Table Row", - "DB View Row", - "Storage" - ] + "tags": ["DB Table Row", "DB View Row", "Storage"] }, { "name": "Meta APIs", @@ -42,12 +38,7 @@ }, { "name": "Organisation APIs", - "tags": [ - "Org App Settings", - "Org License", - "Org Tokens", - "Org Users" - ] + "tags": ["Org App Settings", "Org License", "Org Tokens", "Org Users"] } ], "servers": [ @@ -133,6 +124,14 @@ "application/json": { "schema": { "$ref": "#/components/schemas/SignUpReq" + }, + "examples": { + "Example 1": { + "value": { + "email": "user@example.com", + "password": "password123456789" + } + } } } } @@ -184,6 +183,13 @@ "description": "The signed JWT token for information exchange" } } + }, + "examples": { + "Example 1": { + "value": { + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6IndAbm9jb2RiLmNvbSIsImZpcnN0bmFtZSI6bnVsbCwibGFzdG5hbWUiOm51bGwsImlkIjoidXNfYjN4bzJpNDRueDV5OWwiLCJyb2xlcyI6Im9yZy1sZXZlbC1jcmVhdG9yLHN1cGVyIiwidG9rZW5fdmVyc2lvbiI6ImJmMTc3ZGUzYjk3YjAzMjY4YjU0NGZmMjMzNGU5YjFhMGUzYzgxM2NiYzliOTJkYWMwYmM5NTRiNmUzN2ZjMTJjYmFkNDM2NmIwYzExZTdjIiwiaWF0IjoxNjc4MDc4NDMyLCJleHAiOjE2NzgxMTQ0MzJ9.gzwp_svZlbA5PV_eawYV-9UFjZVjniy-tCDce16xrkI" + } + } } } } @@ -289,6 +295,13 @@ "application/json": { "schema": { "$ref": "#/components/schemas/PasswordForgotReq" + }, + "examples": { + "Example 1": { + "value": { + "email": "user@example.com" + } + } } } }, @@ -445,6 +458,13 @@ "application/json": { "schema": { "$ref": "#/components/schemas/PasswordResetReq" + }, + "examples": { + "Example 1": { + "value": { + "password": "newpassword" + } + } } } } @@ -481,7 +501,8 @@ "description": "New access token for user" } } - } + }, + "examples": {} } } } @@ -532,6 +553,30 @@ "required": ["list", "pageInfo"] } } + }, + "examples": { + "Example 1": { + "value": { + "users": { + "list": [ + { + "id": "1", + "fk_user_id": "us_b3xo2i44nx5y9l", + "description": "This API Token is for ABC application", + "token": "DYh540o8hbWpUGdarekECKLdN5OhlgCUWutVJYX2", + "created_by": "string" + } + ], + "pageInfo": { + "isFirstPage": true, + "isLastPage": true, + "page": 1, + "pageSize": 10, + "totalRows": 1 + } + } + } + } } } } @@ -610,6 +655,13 @@ "description": "Application license key" } } + }, + "examples": { + "Example 1": { + "value": { + "key": "195f7bcc-c3e1-43c5-b23c-8d8127280e7d" + } + } } } } @@ -665,6 +717,13 @@ "example": true } } + }, + "examples": { + "Example 1": { + "value": { + "invite_only_signup": true + } + } } } } @@ -739,6 +798,31 @@ "required": ["list", "pageInfo"] } } + }, + "examples": { + "Example 1": { + "value": { + "users": { + "list": [ + { + "email": "user@example.com", + "email_verified": true, + "firstname": "Alice", + "id": "us_8kugj628ebjngs", + "lastname": "Smith", + "roles": "org-level-viewer" + } + ], + "pageInfo": { + "isFirstPage": true, + "isLastPage": true, + "page": 1, + "pageSize": 10, + "totalRows": 1 + } + } + } + } } } } @@ -810,6 +894,14 @@ "application/json": { "schema": { "$ref": "#/components/schemas/OrgUserReq" + }, + "examples": { + "Example 1": { + "value": { + "email": "user@example.com", + "roles": "org-level-creator" + } + } } } }, @@ -887,7 +979,8 @@ "description": "Password Reset URL for the user" } } - } + }, + "examples": {} } } } @@ -925,6 +1018,31 @@ "required": ["list", "pageInfo"] } } + }, + "examples": { + "Example 1": { + "value": { + "users": { + "list": [ + { + "email": "user@example.com", + "email_verified": true, + "firstname": "Alice", + "id": "us_8kugj628ebjngs", + "lastname": "Smith", + "roles": "org-level-viewer" + } + ], + "pageInfo": { + "isFirstPage": true, + "isLastPage": true, + "page": 1, + "pageSize": 10, + "totalRows": 1 + } + } + } + } } } } @@ -1046,6 +1164,20 @@ "example": "1.0.0" } } + }, + "examples": { + "Example 1": { + "value": { + "Node": "v12.16.1", + "Arch": "x64", + "Platform": "linux", + "Docker": false, + "Database": "postgres", + "ProjectOnRootDB": false, + "RootDB": "postgres", + "PackageVersion": "1.0.0" + } + } } } } @@ -1322,8 +1454,39 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": {} + "$ref": "#/components/schemas/Project" + }, + "examples": { + "Example 1": { + "value": { + "bases": [ + { + "alias": "string", + "config": null, + "enabled": true, + "id": "string", + "inflection_column": "camelize", + "inflection_table": "camelize", + "is_meta": true, + "order": 1, + "project_id": "string", + "type": "mysql2", + "updated_at": "2023-03-01 14:27:36" + } + ], + "color": "#24716E", + "created_at": "2023-03-01 14:27:36", + "deleted": true, + "description": "This is my project description", + "id": "p_124hhlkbeasewh", + "is_meta": true, + "meta": {}, + "order": 0, + "prefix": "nc_vm5q__", + "status": "string", + "title": "my-project" + } + } } } } @@ -1405,8 +1568,24 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": {} + "$ref": "#/components/schemas/Base" + }, + "examples": { + "Example 1": { + "value": { + "alias": null, + "config": "", + "enabled": 1, + "id": "ds_krsappzu9f8vmo", + "inflection_column": "camelize", + "inflection_table": "camelize", + "is_meta": 1, + "meta": null, + "order": 1, + "project_id": "p_01clqvzik3izk6", + "type": "mysql2" + } + } } } } @@ -1595,6 +1774,15 @@ "example": "viewer" } } + }, + "examples": { + "Example 1": { + "value": { + "uuid": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11", + "url": "http://example.com", + "roles": "viewer" + } + } } } } @@ -1690,6 +1878,14 @@ "application/json": { "schema": { "$ref": "#/components/schemas/SharedBaseReq" + }, + "examples": { + "Example 1": { + "value": { + "password": "password123", + "roles": "editor" + } + } } } } @@ -3128,6 +3324,13 @@ "type": "number" } } + }, + "examples": { + "Example 1": { + "value": { + "order": 0 + } + } } } } @@ -3345,6 +3548,19 @@ "application/json": { "schema": { "$ref": "#/components/schemas/ViewReq" + }, + "examples": { + "Example 1": { + "value": { + "title": "Grid View 1", + "uuid": "e2457bbf-e29c-4fec-866e-fe3b01dba57f", + "password": "password123", + "lock_type": "collaborative", + "meta": "{\"allowCSVDownload\":true}", + "order": 1, + "show_system_fields": 0 + } + } } } } @@ -3724,6 +3940,25 @@ } } } + }, + "examples": { + "Example 1": { + "value": { + "sorts": { + "list": [ + { + "id": "so_xd4t51uv60ghzl", + "fk_column_id": "cl_l11b769pe2j1ce", + "fk_model_id": "md_ehn5izr99m7d45", + "base_id": "ds_3l9qx8xqksenrl", + "direction": "desc", + "order": 1, + "project_id": "p_9sx43moxhqtjm3" + } + ] + } + } + } } } } @@ -3790,6 +4025,19 @@ "application/json": { "schema": { "$ref": "#/components/schemas/Sort" + }, + "examples": { + "Example 1": { + "value": { + "id": "so_xd4t51uv60ghzl", + "fk_column_id": "cl_l11b769pe2j1ce", + "fk_model_id": "md_ehn5izr99m7d45", + "base_id": "ds_3l9qx8xqksenrl", + "direction": "desc", + "order": 1, + "project_id": "p_9sx43moxhqtjm3" + } + } } } } @@ -3812,6 +4060,14 @@ "application/json": { "schema": { "$ref": "#/components/schemas/SortReq" + }, + "examples": { + "Example 1": { + "value": { + "direction": "asc", + "fk_column_id": "cl_l11b769pe2j1ce" + } + } } } } @@ -3856,6 +4112,29 @@ "items": { "$ref": "#/components/schemas/Filter" } + }, + "examples": { + "Example 1": { + "value": [ + { + "base_id": "ds_g4ccx6e77h1dmi", + "comparison_op": "eq", + "comparison_sub_op": null, + "created_at": "2023-03-02 18:18:05", + "fk_column_id": "cl_d7ah9n2qfupgys", + "fk_hook_id": null, + "fk_parent_id": null, + "fk_view_id": "vw_b739e29vqmrxnf", + "id": "fi_xn647tpmdq8fu8", + "is_group": null, + "logical_op": "and", + "order": 1, + "project_id": "p_xm3thidrblw4n7", + "updated_at": "2023-03-02 18:18:05", + "value": "foo" + } + ] + } } } } @@ -3906,6 +4185,18 @@ "application/json": { "schema": { "$ref": "#/components/schemas/FilterReq" + }, + "examples": { + "Example 1": { + "value": { + "comparison_op": "eq", + "comparison_sub_op": null, + "fk_column_id": "cl_d7ah9n2qfupgys", + "is_group": false, + "logical_op": "and", + "value": "foo" + } + } } } } @@ -3993,6 +4284,27 @@ "application/json": { "schema": { "$ref": "#/components/schemas/Filter" + }, + "examples": { + "Example 1": { + "value": { + "base_id": "ds_g4ccx6e77h1dmi", + "comparison_op": "eq", + "comparison_sub_op": null, + "created_at": "2023-03-02 18:18:05", + "fk_column_id": "cl_d7ah9n2qfupgys", + "fk_hook_id": null, + "fk_parent_id": null, + "fk_view_id": "vw_b739e29vqmrxnf", + "id": "fi_xn647tpmdq8fu8", + "is_group": null, + "logical_op": "and", + "order": 1, + "project_id": "p_xm3thidrblw4n7", + "updated_at": "2023-03-02 18:18:05", + "value": "foo" + } + } } } } @@ -4059,6 +4371,29 @@ "items": { "$ref": "#/components/schemas/Filter" } + }, + "examples": { + "Example 1": { + "value": [ + { + "base_id": "ds_g4ccx6e77h1dmi", + "comparison_op": "eq", + "comparison_sub_op": null, + "created_at": "2023-03-02 18:18:05", + "fk_column_id": "cl_d7ah9n2qfupgys", + "fk_hook_id": null, + "fk_parent_id": null, + "fk_view_id": "vw_b739e29vqmrxnf", + "id": "fi_xn647tpmdq8fu8", + "is_group": null, + "logical_op": "and", + "order": 1, + "project_id": "p_xm3thidrblw4n7", + "updated_at": "2023-03-02 18:18:05", + "value": "foo" + } + ] + } } } } @@ -4224,6 +4559,46 @@ "application/json": { "schema": { "$ref": "#/components/schemas/Form" + }, + "examples": { + "Example 1": { + "value": { + "base_id": "ds_g4ccx6e77h1dmi", + "banner_image_url": null, + "columns": [ + { + "id": "fvc_ugj9zo5bzocxtl", + "base_id": "ds_g4ccx6e77h1dmi", + "project_id": "p_xm3thidrblw4n7", + "fk_view_id": "vw_kdf5cr7qmhksek", + "fk_column_id": "cl_phvuuwjrzcdo0g", + "uuid": null, + "label": null, + "help": null, + "description": null, + "required": null, + "show": 0, + "order": 1, + "created_at": "2023-03-04 16:40:47", + "updated_at": "2023-03-04 16:40:47", + "meta": {} + } + ], + "email": "user@example.com", + "fk_model_id": "md_rsu68aqjsbyqtl", + "heading": "My Form", + "lock_type": "collaborative", + "logo_url": null, + "meta": null, + "redirect_after_secs": null, + "redirect_url": null, + "show_blank_form": 0, + "subheading": "My Form Subheading", + "submit_another_form": 0, + "success_msg": "Thank you for the submission.", + "title": "Form View 1" + } + } } } } @@ -4257,6 +4632,19 @@ "application/json": { "schema": { "$ref": "#/components/schemas/FormColumnReq" + }, + "examples": { + "Example 1": { + "value": { + "description": null, + "help": "This is a help text", + "label": "Form Label", + "meta": null, + "order": 1, + "required": 0, + "show": 0 + } + } } } } @@ -4307,6 +4695,55 @@ "application/json": { "schema": { "$ref": "#/components/schemas/Grid" + }, + "examples": { + "Example 1": { + "value": { + "project_id": "p_xm3thidrblw4n7", + "base_id": "ds_g4ccx6e77h1dmi", + "fk_view_id": "vw_p2jcatxz4mvcfw", + "row_height": 1, + "meta": null, + "columns": [ + { + "id": "cl_phvuuwjrzcdo0g", + "base_id": "ds_g4ccx6e77h1dmi", + "project_id": "p_xm3thidrblw4n7", + "fk_model_id": "md_rsu68aqjsbyqtl", + "title": "Id", + "column_name": "id", + "uidt": "ID", + "dt": "int", + "np": "10", + "ns": "0", + "clen": null, + "cop": "1", + "pk": 1, + "pv": null, + "rqd": 1, + "un": 1, + "ct": "int unsigned", + "ai": 1, + "unique": 0, + "cdf": null, + "cc": "", + "csn": null, + "dtx": "specificType", + "dtxp": "", + "dtxs": "0", + "au": 0, + "validate": null, + "virtual": null, + "deleted": null, + "system": 0, + "order": 1, + "created_at": "2023-03-02 17:04:06", + "updated_at": "2023-03-02 17:04:06", + "meta": null + } + ] + } + } } } } @@ -4338,6 +4775,23 @@ "items": { "$ref": "#/components/schemas/GridColumn" } + }, + "examples": { + "Example 1": { + "value": [ + { + "id": "nc_c8jz4kxe6xvh11", + "fk_view_id": "vw_p2jcatxz4mvcfw", + "fk_column_id": "cl_c5knoi4xs4sfpt", + "project_id": "p_xm3thidrblw4n7", + "base_id": "ds_g4ccx6e77h1dmi", + "show": 0, + "order": 1, + "width": "200px", + "help": null + } + ] + } } } } @@ -4380,6 +4834,15 @@ "application/json": { "schema": { "$ref": "#/components/schemas/GridColumnReq" + }, + "examples": { + "Example 1": { + "value": { + "fk_column_id": "cl_c5knoi4xs4sfpt", + "label": "My Column", + "width": "200px" + } + } } } } @@ -10603,82 +11066,195 @@ "description": "Model for Grid", "examples": [ { - "alias": "string", - "deleted": true, - "id": "string", - "lock_type": "collaborative", - "order": 0, - "row_height": 0, - "title": "string" + "project_id": "p_xm3thidrblw4n7", + "base_id": "ds_g4ccx6e77h1dmi", + "fk_view_id": "vw_p2jcatxz4mvcfw", + "row_height": 1, + "meta": null, + "columns": [ + { + "id": "cl_phvuuwjrzcdo0g", + "base_id": "ds_g4ccx6e77h1dmi", + "project_id": "p_xm3thidrblw4n7", + "fk_model_id": "md_rsu68aqjsbyqtl", + "title": "Id", + "column_name": "id", + "uidt": "ID", + "dt": "int", + "np": "10", + "ns": "0", + "clen": null, + "cop": "1", + "pk": 1, + "pv": null, + "rqd": 1, + "un": 1, + "ct": "int unsigned", + "ai": 1, + "unique": 0, + "cdf": null, + "cc": "", + "csn": null, + "dtx": "specificType", + "dtxp": "", + "dtxs": "0", + "au": 0, + "validate": null, + "virtual": null, + "deleted": null, + "system": 0, + "order": 1, + "created_at": "2023-03-02 17:04:06", + "updated_at": "2023-03-02 17:04:06", + "meta": null + } + ] } ], + "title": "Grid Model", + "type": "object", "properties": { - "alias": { - "type": "string" - }, - "deleted": { - "$ref": "#/components/schemas/Bool" - }, "id": { "$ref": "#/components/schemas/Id", - "description": "Unique ID" + "description": "Unique ID", + "x-stoplight": { + "id": "e3ti3fc0ocjyu" + } }, - "lock_type": { - "enum": ["collaborative", "locked", "personal"], - "type": "string" + "project_id": { + "$ref": "#/components/schemas/Id", + "description": "Project ID", + "x-stoplight": { + "id": "e3ti3fc0ocjyu" + } }, - "order": { - "type": "number" + "base_id": { + "$ref": "#/components/schemas/Id", + "description": "Base ID", + "x-stoplight": { + "id": "m8v3iyf1tidy9" + } + }, + "fk_view_id": { + "$ref": "#/components/schemas/Id", + "description": "Foreign Key to View", + "x-stoplight": { + "id": "m8v3iyf1tidy9" + } }, "row_height": { - "type": "number" + "type": "number", + "example": 1, + "description": "Row Height" }, - "title": { - "type": "string" + "meta": { + "$ref": "#/components/schemas/Meta", + "x-stoplight": { + "id": "n8cud3jyqw5yv" + }, + "description": "Meta info for Grid Model" + }, + "columns": { + "type": "array", + "x-stoplight": { + "id": "22y0gipx2jdf8" + }, + "description": "Grid View Columns", + "items": { + "$ref": "#/components/schemas/GridColumn", + "x-stoplight": { + "id": "nmzp6w3o6b24u" + } + } } - }, - "title": "Grid Model", - "type": "object" + } }, "GridColumn": { "description": "Model for Grid Column", "examples": [ { - "fk_column_id": "string", - "help": "string", - "id": "string", - "label": "string", - "width": "string" + "id": "nc_c8jz4kxe6xvh11", + "fk_view_id": "vw_p2jcatxz4mvcfw", + "fk_column_id": "cl_c5knoi4xs4sfpt", + "project_id": "p_xm3thidrblw4n7", + "base_id": "ds_g4ccx6e77h1dmi", + "show": 0, + "order": 1, + "width": "200px", + "help": null } ], + "title": "Grid Column Model", + "type": "object", "properties": { + "id": { + "$ref": "#/components/schemas/Id", + "description": "Unique ID", + "x-stoplight": { + "id": "jc14yojp52rqj" + } + }, + "fk_view_id": { + "$ref": "#/components/schemas/Id", + "description": "Foreign Key to View", + "x-stoplight": { + "id": "vl18dbt5c2r8r" + } + }, "fk_column_id": { "$ref": "#/components/schemas/Id", - "description": "Foreign Key to Column" + "description": "Foreign Key to Column", + "x-stoplight": { + "id": "2drg88fmodf3v" + } }, - "help": { - "type": "string" + "project_id": { + "$ref": "#/components/schemas/Id", + "description": "Project ID", + "x-stoplight": { + "id": "2drg88fmodf3v" + } }, - "id": { - "description": "Unique ID of Grid Column", - "type": "string" + "base_id": { + "$ref": "#/components/schemas/Id", + "description": "Base ID", + "x-stoplight": { + "id": "2drg88fmodf3v" + } }, - "label": { - "type": "string" + "show": { + "$ref": "#/components/schemas/Bool", + "x-stoplight": { + "id": "d47eer13oa8yr" + } + }, + "order": { + "type": "number", + "x-stoplight": { + "id": "d47eer13oa8yr" + }, + "example": "1", + "description": "Grid Column Order" }, "width": { - "type": "string" + "type": "string", + "description": "Column Width", + "example": "200px" + }, + "help": { + "$ref": "#/components/schemas/StringOrNull", + "description": "Column Help Text", + "x-stoplight": { + "id": "azwh6zn37qzkc" + } } - }, - "title": "Grid Column Model", - "type": "object" + } }, "GridColumnReq": { "description": "Model for Grid Column Request", "examples": [ { - "fk_column_id": "string", - "help": "string", + "fk_column_id": "cl_c5knoi4xs4sfpt", "label": "My Column", "width": "200px" } @@ -13601,9 +14177,9 @@ { "email": "user@example.com", "email_verified": true, - "firstName": "Alice", + "firstname": "Alice", "id": "us_8kugj628ebjngs", - "lastName": "Smith", + "lastname": "Smith", "roles": "org-level-viewer" } ], From 80ab85d98a94e8b562dab78b8e53b72390bd0fbd Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 13:57:13 +0800 Subject: [PATCH 05/11] refactor(nocodb): implements GridType --- packages/nocodb/src/lib/models/GridView.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/models/GridView.ts b/packages/nocodb/src/lib/models/GridView.ts index 880254261a..28e4c3904c 100644 --- a/packages/nocodb/src/lib/models/GridView.ts +++ b/packages/nocodb/src/lib/models/GridView.ts @@ -4,13 +4,14 @@ import GridViewColumn from './GridViewColumn'; import View from './View'; import NocoCache from '../cache/NocoCache'; import { extractProps } from '../meta/helpers/extractProps'; +import type { GridType, MetaType } from 'nocodb-sdk'; -export default class GridView { +export default class GridView implements GridType { fk_view_id: string; project_id?: string; base_id?: string; - meta?: string; + meta?: MetaType; row_height?: number; columns?: GridViewColumn[]; From 66afb6fa9852190e9a355f869175aeab22c906ae Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 13:57:46 +0800 Subject: [PATCH 06/11] chore(sdk): regenerate Api.ts --- packages/nocodb-sdk/src/lib/Api.ts | 53 ++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index 8cded93ed5..1f6062d638 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -962,28 +962,53 @@ export interface GeoLocationType { * Model for Grid */ export interface GridType { - alias?: string; - /** Model for Bool */ - deleted?: BoolType; /** Unique ID */ id?: IdType; - lock_type?: 'collaborative' | 'locked' | 'personal'; - order?: number; + /** Project ID */ + project_id?: IdType; + /** Base ID */ + base_id?: IdType; + /** Foreign Key to View */ + fk_view_id?: IdType; + /** + * Row Height + * @example 1 + */ row_height?: number; - title?: string; + /** Meta info for Grid Model */ + meta?: MetaType; + /** Grid View Columns */ + columns?: GridColumnType[]; } /** * Model for Grid Column */ export interface GridColumnType { + /** Unique ID */ + id?: IdType; + /** Foreign Key to View */ + fk_view_id?: IdType; /** Foreign Key to Column */ fk_column_id?: IdType; - help?: string; - /** Unique ID of Grid Column */ - id?: string; - label?: string; + /** Project ID */ + project_id?: IdType; + /** Base ID */ + base_id?: IdType; + /** Model for Bool */ + show?: BoolType; + /** + * Grid Column Order + * @example 1 + */ + order?: number; + /** + * Column Width + * @example 200px + */ width?: string; + /** Column Help Text */ + help?: StringOrNullType; } /** @@ -3314,10 +3339,10 @@ export class Api< * @name Read * @summary Get Project * @request GET:/api/v1/db/meta/projects/{projectId} - * @response `200` `object` OK + * @response `200` `ProjectType` OK */ read: (projectId: IdType, params: RequestParams = {}) => - this.request({ + this.request({ path: `/api/v1/db/meta/projects/${projectId}`, method: 'GET', format: 'json', @@ -3614,10 +3639,10 @@ export class Api< * @name Read * @summary Get Base * @request GET:/api/v1/db/meta/projects/{projectId}/bases/{baseId} - * @response `200` `object` OK + * @response `200` `BaseType` OK */ read: (projectId: IdType, baseId: string, params: RequestParams = {}) => - this.request({ + this.request({ path: `/api/v1/db/meta/projects/${projectId}/bases/${baseId}`, method: 'GET', format: 'json', From e6116950743c174b40e58a1f4449c00c89384e80 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 14:20:43 +0800 Subject: [PATCH 07/11] refactor(nocodb): kanban & kanbanViewColumn model & add examples --- packages/nocodb/src/schema/swagger.json | 142 ++++++++++++++++-------- 1 file changed, 94 insertions(+), 48 deletions(-) diff --git a/packages/nocodb/src/schema/swagger.json b/packages/nocodb/src/schema/swagger.json index ca0a6f81a8..84bac5d0c9 100644 --- a/packages/nocodb/src/schema/swagger.json +++ b/packages/nocodb/src/schema/swagger.json @@ -11711,89 +11711,135 @@ "description": "Model for Kanban", "examples": [ { - "alias": "string", + "id": "vw_wqs4zheuo5lgdy", + "fk_grp_col_id": "cl_3704cxcbqt7sj7", + "fk_view_id": "vw_wqs4zheuo5lgdy", + "fk_cover_image_col_id": null, "columns": [ { - "fk_column_id": "string", - "fk_kanban_id": "string", - "help": "string", - "id": "string", - "label": "string" + "id": "kvc_2skkg5mi1eb37f", + "fk_column_id": "cl_hzos4ghyncqi4k", + "fk_view_id": "vw_wqs4zheuo5lgdy", + "base_id": "ds_hd4ojj0xpquaam", + "project_id": "p_kzfl5lb0t3tcok", + "title": "string", + "show": 0, + "order": "1" } ], - "fk_cover_image_col_id": "string", - "fk_grp_col_id": "string", - "fk_model_id": "string", - "id": "string", - "meta": {}, - "title": "string" + "meta": null, + "title": "My Kanban" } ], + "title": "Kanban Model", + "type": "object", "properties": { - "alias": { - "type": "string" - }, - "columns": { - "items": { - "$ref": "#/components/schemas/KanbanColumn" - }, - "type": "array" - }, - "fk_cover_image_col_id": { - "type": "string" + "id": { + "$ref": "#/components/schemas/Id", + "description": "Unique ID" }, "fk_grp_col_id": { - "$ref": "#/components/schemas/StringOrNull" + "$ref": "#/components/schemas/StringOrNull", + "description": "Grouping Field Column ID" }, - "fk_model_id": { - "type": "string" + "fk_view_id": { + "$ref": "#/components/schemas/Id", + "x-stoplight": { + "id": "1kgw1w06b97nl" + }, + "description": "View ID" }, - "id": { + "fk_cover_image_col_id": { "$ref": "#/components/schemas/Id", - "description": "Unique ID" + "description": "Cover Image Column ID" + }, + "columns": { + "type": "array", + "description": "Kanban Columns", + "items": { + "$ref": "#/components/schemas/KanbanColumn" + } }, "meta": { - "$ref": "#/components/schemas/Meta" + "$ref": "#/components/schemas/Meta", + "description": "Meta Info for Kanban" }, "title": { - "type": "string" + "type": "string", + "description": "Kanban Title", + "example": "My Kanban" } - }, - "title": "Kanban Model", - "type": "object" + } }, "KanbanColumn": { "description": "Model for Kanban Column", "examples": [ { - "fk_column_id": "string", - "fk_kanban_id": "string", - "help": "string", - "id": "string", - "label": "string" + "id": "kvc_2skkg5mi1eb37f", + "fk_column_id": "cl_hzos4ghyncqi4k", + "fk_view_id": "vw_wqs4zheuo5lgdy", + "base_id": "ds_hd4ojj0xpquaam", + "project_id": "p_kzfl5lb0t3tcok", + "title": "string", + "show": 0, + "order": "1" } ], + "title": "Kanban Column Model", + "type": "object", "properties": { + "id": { + "$ref": "#/components/schemas/Id", + "description": "Unique ID" + }, "fk_column_id": { "$ref": "#/components/schemas/Id", "description": "Foreign Key to Column" }, - "fk_kanban_id": { - "type": "string" + "fk_view_id": { + "$ref": "#/components/schemas/Id", + "x-stoplight": { + "id": "t1fy4zy561ih8" + }, + "description": "Foreign Key to View" }, - "help": { - "type": "string" + "base_id": { + "$ref": "#/components/schemas/Id", + "x-stoplight": { + "id": "uqq8xmyz97t1u" + }, + "description": "Baes ID\n" }, - "id": { + "project_id": { "$ref": "#/components/schemas/Id", - "description": "Unique ID" + "x-stoplight": { + "id": "uqq8xmyz97t1u" + }, + "description": "Project ID" }, - "label": { + "title": { + "x-stoplight": { + "id": "uqq8xmyz97t1u" + }, + "description": "Project ID", "type": "string" + }, + "show": { + "$ref": "#/components/schemas/Bool", + "x-stoplight": { + "id": "uqq8xmyz97t1u" + }, + "description": "Is this column shown?" + }, + "order": { + "type": "number", + "x-stoplight": { + "id": "pbnchzgci5dwa" + }, + "example": "1", + "description": "Column Order" } - }, - "title": "Kanban Column Model", - "type": "object" + } }, "KanbanReq": { "description": "Model for Kanban Request", From 56fb324ba4fe5f37a226ef3de134d21600a38c69 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 14:20:57 +0800 Subject: [PATCH 08/11] refactor(nocodb): implements KanbanColumnType --- packages/nocodb/src/lib/models/KanbanViewColumn.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/models/KanbanViewColumn.ts b/packages/nocodb/src/lib/models/KanbanViewColumn.ts index a0c2455831..3f0b22bef4 100644 --- a/packages/nocodb/src/lib/models/KanbanViewColumn.ts +++ b/packages/nocodb/src/lib/models/KanbanViewColumn.ts @@ -3,9 +3,9 @@ import { CacheGetType, CacheScope, MetaTable } from '../utils/globals'; import View from './View'; import NocoCache from '../cache/NocoCache'; import { extractProps } from '../meta/helpers/extractProps'; -import { BoolType } from 'nocodb-sdk'; +import { BoolType, KanbanColumnType } from 'nocodb-sdk'; -export default class KanbanViewColumn { +export default class KanbanViewColumn implements KanbanColumnType { id: string; title?: string; show?: BoolType; From 40d48d76f9345fce5a631045edd9455e5c98bfec Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 14:21:09 +0800 Subject: [PATCH 09/11] refactor(nocodb): use MetaType instead --- packages/nocodb/src/lib/models/KanbanView.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/models/KanbanView.ts b/packages/nocodb/src/lib/models/KanbanView.ts index 9bff3fbed4..b5ec87d85e 100644 --- a/packages/nocodb/src/lib/models/KanbanView.ts +++ b/packages/nocodb/src/lib/models/KanbanView.ts @@ -1,5 +1,5 @@ import Noco from '../Noco'; -import { BoolType, KanbanType, UITypes } from 'nocodb-sdk'; +import { BoolType, KanbanType, MetaType, UITypes } from 'nocodb-sdk'; import { CacheGetType, CacheScope, MetaTable } from '../utils/globals'; import View from './View'; import NocoCache from '../cache/NocoCache'; @@ -12,7 +12,7 @@ export default class KanbanView implements KanbanType { base_id?: string; fk_grp_col_id?: string; fk_cover_image_col_id?: string; - meta?: string | Record; + meta?: MetaType; // below fields are not in use at this moment // keep them for time being From 1243a9eb4376d07ebe7128e19d6f8680e21fa774 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 14:21:22 +0800 Subject: [PATCH 10/11] chore(sdk): regenerate Api.ts --- packages/nocodb-sdk/src/lib/Api.ts | 45 ++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index 1f6062d638..b3ca3a64b4 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -1228,16 +1228,22 @@ export type IdType = string; * Model for Kanban */ export interface KanbanType { - alias?: string; - columns?: KanbanColumnType[]; - fk_cover_image_col_id?: string; - /** Model for StringOrNull */ - fk_grp_col_id?: StringOrNullType; - fk_model_id?: string; /** Unique ID */ id?: IdType; - /** Model for Meta */ + /** Grouping Field Column ID */ + fk_grp_col_id?: StringOrNullType; + /** View ID */ + fk_view_id?: IdType; + /** Cover Image Column ID */ + fk_cover_image_col_id?: IdType; + /** Kanban Columns */ + columns?: KanbanColumnType[]; + /** Meta Info for Kanban */ meta?: MetaType; + /** + * Kanban Title + * @example My Kanban + */ title?: string; } @@ -1245,13 +1251,28 @@ export interface KanbanType { * Model for Kanban Column */ export interface KanbanColumnType { - /** Foreign Key to Column */ - fk_column_id?: IdType; - fk_kanban_id?: string; - help?: string; /** Unique ID */ id?: IdType; - label?: string; + /** Foreign Key to Column */ + fk_column_id?: IdType; + /** Foreign Key to View */ + fk_view_id?: IdType; + /** + * Baes ID + * + */ + base_id?: IdType; + /** Project ID */ + project_id?: IdType; + /** Project ID */ + title?: string; + /** Is this column shown? */ + show?: BoolType; + /** + * Column Order + * @example 1 + */ + order?: number; } /** From 1ea4815afe0f3e009edb485e83a04668af3447bf Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 6 Mar 2023 15:59:04 +0800 Subject: [PATCH 11/11] refactor(nocodb): change to number --- packages/nocodb/src/schema/swagger.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/schema/swagger.json b/packages/nocodb/src/schema/swagger.json index 84bac5d0c9..b656a26dcb 100644 --- a/packages/nocodb/src/schema/swagger.json +++ b/packages/nocodb/src/schema/swagger.json @@ -11233,7 +11233,7 @@ "x-stoplight": { "id": "d47eer13oa8yr" }, - "example": "1", + "example": 1, "description": "Grid Column Order" }, "width": { @@ -11836,7 +11836,7 @@ "x-stoplight": { "id": "pbnchzgci5dwa" }, - "example": "1", + "example": 1, "description": "Column Order" } }