feat: add shared Annotation, AnnotationType, Geometry interfaces in src/types/annotations.ts

Creates src/types/annotations.ts with typed interfaces matching actual
usage in CandleChart.tsx, page.tsx, and DB schema. Marks task 9.2 done.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marko Djordjevic 2026-02-18 15:27:13 +01:00
parent 8b40a2cb9a
commit f05a0081f7
2 changed files with 36 additions and 1 deletions

35
src/types/annotations.ts Normal file
View file

@ -0,0 +1,35 @@
/**
* Annotation types for point and line/rectangle annotations on charts.
*
* Geometry fields use Unix epoch seconds for time values.
* startTime / endTime correspond to candle timestamps.
* startPrice / endPrice correspond to price axis values.
*/
export interface Geometry {
startTime?: number;
startPrice?: number;
endTime?: number;
endPrice?: number;
}
export interface AnnotationType {
id: number;
name: string;
display_name: string;
color: string;
category: string; // 'marker' | 'line' | 'rectangle'
icon: string | null;
is_active: boolean;
created_at?: number | Date;
}
export interface Annotation {
id: number;
chart_id: number;
timestamp: number; // Unix epoch seconds
label_type: string;
color: string | null;
geometry: Geometry | null;
created_at: number | Date;
}