mapdash/frontend/src/types.ts

70 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Domain types — mirror the JSON returned by the FastAPI backend (main.py).
// Keeping these in one place lets TypeScript catch drift between the frontend
// and the ClickHouse-backed API (e.g. a renamed or missing field) at build time.
/** GET /api/meta */
export interface Meta {
cities: string[];
dimensions: string[];
brands: string[];
managers: string[];
}
/** One row of GET /api/boards (grouped per board_id). */
export interface Board {
board_id: string;
board_address: string;
board_city: string;
board_dimension: string;
}
/** One row of GET /api/bookings. task_id/task_status added in the July 2026 change. */
export interface Booking {
board_id: string;
task_id: string;
task_status: string;
start_date: string; // ISO date YYYY-MM-DD
end_date: string; // ISO date YYYY-MM-DD
brand: string;
company_name: string;
}
/** Current filter selection shared by boards/bookings queries. */
export interface Filters {
cities: string[];
dimensions: string[];
brands: string[];
managers: string[];
search: string;
dateStart: string; // YYYY-MM-DD or '' — start_date >= dateStart
dateEnd: string; // YYYY-MM-DD or '' — end_date <= dateEnd
}
/** A booking active "today" attached to a map surface (for the balloon). */
export interface MapBooking {
task_id: string;
task_status: string;
start_date: string;
end_date: string;
brand: string;
company_name: string;
}
/** One surface returned by GET /api/map (from board_info, joined to bookings). */
export interface MapSurface {
board_key: number;
board_id: string;
city: string;
address: string;
dimension: string;
board_type: string;
side: string;
lat: number | null;
lon: number | null;
occupied_now: boolean;
bookings: MapBooking[];
}
/** task_status value that marks an archived booking (painted slate #708090). */
export const ARCHIVED_STATUS = 'РК. Архив';