generated from azures04/Base-REST-API
Add database DDL and server-side data access/service layers for transport domain. New SQL DDL files create transport_types, lines, stations, platforms and platform_lines tables (with FKs, indexes, spatial POINT column, CHECK constraints, and triggers to populate location). New repositories implement queries and CRUD for lines, stations, platforms and platform_lines (including distance/nearest-platform and accessibility queries). A transportService aggregates repo functions and exposes high-level operations (CRUD, station/line lookups, platform-line management and nearest-platform validation).
17 lines
524 B
SQL
17 lines
524 B
SQL
CREATE TABLE IF NOT EXISTS `lines` (
|
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`code` VARCHAR(50) NOT NULL UNIQUE,
|
|
`name` VARCHAR(255),
|
|
`textColorHex` VARCHAR(7),
|
|
`backColorHex` VARCHAR(7),
|
|
`transportTypeId` INT UNSIGNED NOT NULL,
|
|
`createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
CONSTRAINT `fk_lines_transport_type`
|
|
FOREIGN KEY (`transportTypeId`)
|
|
REFERENCES `transport_types` (`id`),
|
|
|
|
INDEX `idx_transport_type` (`transportTypeId`)
|
|
); |