feat: add annotation types management system

- Created annotation_types table with name, display_name, color, category, icon
- Implemented CRUD API endpoints for annotation types management
- Built annotation types management UI page at /annotation-types
- Updated Toolbox component to dynamically load and display annotation types
- Updated CandleChart component to use dynamic annotation types for markers
- Added seed functionality for default types (break_up, break_down, line)
- Cleaned up duplicate migration files
This commit is contained in:
Marko Djordjevic 2026-02-12 18:16:09 +01:00
parent 50229e2ccf
commit 974d9f5598
13 changed files with 942 additions and 79 deletions

View file

@ -1,18 +0,0 @@
CREATE TABLE `annotations` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`timestamp` integer NOT NULL,
`label_type` text NOT NULL,
`geometry` text,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `candles` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`time` integer NOT NULL,
`open` real NOT NULL,
`high` real NOT NULL,
`low` real NOT NULL,
`close` real NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `candles_time_unique` ON `candles` (`time`);

View file

@ -1 +0,0 @@
ALTER TABLE `annotations` ADD `color` text DEFAULT '#3b82f6';

View file

@ -0,0 +1,12 @@
CREATE TABLE `annotation_types` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`name` text NOT NULL,
`display_name` text NOT NULL,
`color` text NOT NULL,
`category` text NOT NULL,
`icon` text,
`is_active` integer DEFAULT 1 NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `annotation_types_name_unique` ON `annotation_types` (`name`);

View file

@ -1,9 +1,84 @@
{
"version": "6",
"dialect": "sqlite",
"id": "9a43200c-01b1-41fc-ac10-8071afa36f6f",
"prevId": "4f92efce-343c-4fa1-a55b-53b8dd7ed42e",
"id": "111e1b91-6d7b-45e4-aeb9-9762725d6905",
"prevId": "9a43200c-01b1-41fc-ac10-8071afa36f6f",
"tables": {
"annotation_types": {
"name": "annotation_types",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"category": {
"name": "category",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"is_active": {
"name": "is_active",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"annotation_types_name_unique": {
"name": "annotation_types_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"annotations": {
"name": "annotations",
"columns": {

View file

@ -8,6 +8,13 @@
"when": 1770907611962,
"tag": "0000_goofy_captain_midlands",
"breakpoints": true
},
{
"idx": 1,
"version": "6",
"when": 1770915891699,
"tag": "0001_sticky_shinko_yamashiro",
"breakpoints": true
}
]
}