Browse Source

feat(nocodb): update swagger and create migration files for calendar view

pull/7611/head
DarkPhoenix2704 10 months ago
parent
commit
be3f2959b2
  1. 4
      packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts
  2. 64
      packages/nocodb/src/meta/migrations/v2/nc_041_calander_view.ts
  3. 0
      packages/nocodb/src/models/CalanderView.ts
  4. 250
      packages/nocodb/src/schema/swagger.json
  5. 3
      packages/nocodb/src/utils/globals.ts

4
packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts

@ -27,6 +27,7 @@ import * as nc_037_rename_project_and_base from '~/meta/migrations/v2/nc_037_ren
import * as nc_038_formula_parsed_tree_column from '~/meta/migrations/v2/nc_038_formula_parsed_tree_column';
import * as nc_039_sqlite_alter_column_types from '~/meta/migrations/v2/nc_039_sqlite_alter_column_types';
import * as nc_040_form_view_alter_column_types from '~/meta/migrations/v2/nc_040_form_view_alter_column_types';
import * as nc_041_calander_view from '~/meta/migrations/v2/nc_041_calander_view';
// Create a custom migration source class
export default class XcMigrationSourcev2 {
@ -65,6 +66,7 @@ export default class XcMigrationSourcev2 {
'nc_038_formula_parsed_tree_column',
'nc_039_sqlite_alter_column_types',
'nc_040_form_view_alter_column_types',
'nc_041_calander_view',
]);
}
@ -132,6 +134,8 @@ export default class XcMigrationSourcev2 {
return nc_039_sqlite_alter_column_types;
case 'nc_040_form_view_alter_column_types':
return nc_040_form_view_alter_column_types;
case 'nc_041_calander_view':
return nc_041_calander_view;
}
}
}

64
packages/nocodb/src/meta/migrations/v2/nc_041_calander_view.ts

@ -0,0 +1,64 @@
import type { Knex } from 'knex';
import { MetaTable } from '~/utils/globals';
const up = async (knex: Knex) => {
await knex.schema.createTable(MetaTable.CALANDER_VIEW, (table) => {
table.string('fk_view_id', 20).primary();
table.string('base_id', 20);
table.string('source_id', 128);
table.string('title');
table.string('fk_cover_image_col_id', 20);
table.text('meta');
table.dateTime('created_at');
table.dateTime('updated_at');
});
await knex.schema.createTable(MetaTable.CALANDER_VIEW_COLUMNS, (table) => {
table.string('id', 20).primary().notNullable();
table.string('base_id', 20);
table.string('source_id', 128);
table.string('fk_view_id', 20);
table.string('fk_column_id', 20);
table.boolean('show');
table.boolean('bold');
table.boolean('underline');
table.boolean('italic');
table.float('order');
table.timestamps(true, true);
});
await knex.schema.createTable(MetaTable.CALANDER_VIEW_RANGE, (table) => {
table.string('id', 20).primary().notNullable();
table.string('fk_view_id', 20);
table.string('fk_to_column_id', 20);
table.string('fk_from_column_id', 20);
table.timestamps(true, true);
});
};
const down = async (knex: Knex) => {
await knex.schema.dropTable(MetaTable.CALANDER_VIEW);
await knex.schema.dropTable(MetaTable.CALANDER_VIEW_COLUMNS);
await knex.schema.dropTable(MetaTable.CALANDER_VIEW_RANGE);
};
export { up, down };

0
packages/nocodb/src/models/CalanderView.ts

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

@ -20071,6 +20071,256 @@
"id": "9zirjgj9k1gqa"
}
},
"Calendar": {
"description": "Model for Calendar",
"examples": [
{
"id": "vw_wqs4zheuo5lgdy",
"fk_view_id": "vw_wqs4zheuo5lgdy",
"fk_cover_image_col_id": null,
"columns": [
{
"id": "kvc_2skkg5mi1eb37f",
"fk_column_id": "cl_hzos4ghyncqi4k",
"fk_view_id": "vw_wqs4zheuo5lgdy",
"source_id": "ds_hd4ojj0xpquaam",
"base_id": "p_kzfl5lb0t3tcok",
"title": "string",
"show": 1,
"bold": 0,
"italic": 0,
"underline": 0,
"order": "1"
}
],
"calendar_range_columns": [
{
"id": "kvc_2skkg5mi1eb37f",
"fk_view_id": "vw_wqs4zheuo5lgdy",
"fk_from_column_id": "cl_hzos4ghyncqi4k",
"fk_to_column_id": "cl_hzos4ghyncqi4k"
}
],
"meta": null,
"title": "My Calendar"
}
],
"title": "Calendar Model",
"type": "object",
"properties": {
"id": {
"$ref": "#/components/schemas/Id",
"description": "Unique ID"
},
"fk_view_id": {
"$ref": "#/components/schemas/Id",
"x-stoplight": {
"id": "1kgw1w06b97nl"
},
"description": "View ID"
},
"fk_cover_image_col_id": {
"$ref": "#/components/schemas/StringOrNull",
"description": "Cover Image Column ID"
},
"columns": {
"type": "array",
"description": "Calendar Columns",
"items": {
"$ref": "#/components/schemas/CalendarColumn"
}
},
"meta": {
"$ref": "#/components/schemas/Meta",
"description": "Meta Info for Kanban"
},
"title": {
"type": "string",
"description": "Kanban Title",
"example": "My Kanban"
}
},
"x-stoplight": {
"id": "gu721t0zw7jqq"
}
},
"CalendarColumn": {
"description": "Model for Calendar Column",
"examples": [
{
"id": "kvc_2skkg5mi1eb37f",
"fk_column_id": "cl_hzos4ghyncqi4k",
"fk_view_id": "vw_wqs4zheuo5lgdy",
"source_id": "ds_hd4ojj0xpquaam",
"base_id": "p_kzfl5lb0t3tcok",
"title": "string",
"show": 0,
"bold": 0,
"italic": 0,
"underline": 0,
"order": "1"
}
],
"title": "Calendar 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_view_id": {
"$ref": "#/components/schemas/Id",
"x-stoplight": {
"id": "t1fy4zy561ih8"
},
"description": "Foreign Key to View"
},
"source_id": {
"$ref": "#/components/schemas/Id",
"x-stoplight": {
"id": "uqq8xmyz97t1u"
},
"description": "Baes ID\n"
},
"base_id": {
"$ref": "#/components/schemas/Id",
"x-stoplight": {
"id": "uqq8xmyz97t1u"
},
"description": "Base ID"
},
"title": {
"x-stoplight": {
"id": "uqq8xmyz97t1u"
},
"description": "Base ID",
"type": "string"
},
"show": {
"$ref": "#/components/schemas/Bool",
"x-stoplight": {
"id": "uqq8xmyz97t1u"
},
"description": "Is this column shown?"
},
"bold": {
"$ref": "#/components/schemas/Bool",
"x-stoplight": {
"id": "uqq8xmyz97t1u"
},
"description": "Is this column shown as bold?"
},
"italic": {
"$ref": "#/components/schemas/Bool",
"x-stoplight": {
"id": "uqq8xmyz97t1u"
},
"description": "Is this column shown as italic?"
},
"underline": {
"$ref": "#/components/schemas/Bool",
"x-stoplight": {
"id": "uqq8xmyz97t1u"
},
"description": "Is this column shown underlines?"
},
"order": {
"type": "number",
"x-stoplight": {
"id": "pbnchzgci5dwa"
},
"example": 1,
"description": "Column Order"
}
},
"x-stoplight": {
"id": "psbv6c6y9qvbu"
}
},
"CalenderDateRange": {
"description": "Model for Calendar Date Range",
"examples": [
{
"id": "kvc_2skkg5mi1eb37f",
"fk_from_column_id": "cl_hzos4ghyncqi4k",
"fk_to_column_id": "cl_hzos4ghyncqi4k",
"fk_view_id": "vw_wqs4zheuo5lgdy",
"label": "string"
}
],
"title": "Calendar Date Range Model",
"type": "object",
"properties": {
"id": {
"$ref": "#/components/schemas/Id",
"description": "Unique ID"
},
"fk_from_column_id": {
"$ref": "#/components/schemas/Id",
"description": "Foreign Key to Column"
},
"fk_to_column_id": {
"$ref": "#/components/schemas/Id",
"description": "Foreign Key to Column"
},
"fk_view_id": {
"$ref": "#/components/schemas/Id",
"x-stoplight": {
"id": "t1fy4zy561ih8"
},
"description": "Foreign Key to View"
},
"label": {
"x-stoplight": {
"id": "uqq8xmyz97t1u"
},
"description": "Base ID",
"type": "string"
}
},
"x-stoplight": {
"id": "psbv6c6y9qvbu"
}
},
"CalanderUpdateReq": {
"description": "Model for Calendar Update Request",
"examples": [
{
"fk_cover_image_col_id": "cl_ib8l4j1kiu1efx",
"title": "Calander 2"
}
],
"title": "Calander Update Request Model",
"type": "object",
"properties": {
"fk_cover_image_col_id": {
"$ref": "#/components/schemas/StringOrNull",
"x-stoplight": {
"id": "81wn4hzj76wod"
},
"description": "Foreign Key to Cover Image Column"
},
"title": {
"type": "string",
"description": "Calander Title",
"example": "Calander 01"
},
"meta": {
"$ref": "#/components/schemas/Meta",
"x-stoplight": {
"id": "stsvdmkli1b0r"
},
"description": "Meta Info"
}
},
"x-stoplight": {
"id": "9zirjgj9k1gqa"
}
},
"LicenseReq": {
"description": "Model for Kanban Request",
"examples": [

3
packages/nocodb/src/utils/globals.ts

@ -21,6 +21,9 @@ export enum MetaTable {
FORM_VIEW_COLUMNS = 'nc_form_view_columns_v2',
GALLERY_VIEW = 'nc_gallery_view_v2',
GALLERY_VIEW_COLUMNS = 'nc_gallery_view_columns_v2',
CALANDER_VIEW = 'nc_calendar_view_v2',
CALANDER_VIEW_COLUMNS = 'nc_calendar_view_columns_v2',
CALANDER_VIEW_RANGE = 'nc_calendar_view_range_v2',
GRID_VIEW = 'nc_grid_view_v2',
GRID_VIEW_COLUMNS = 'nc_grid_view_columns_v2',
KANBAN_VIEW = 'nc_kanban_view_v2',

Loading…
Cancel
Save