support English

This commit is contained in:
Bkk1234 committed 2026-10-23 17:43:11 +07:00
1 parent 138a3d15d8
commit b8ed110459
36 files changed
+523 -118

No files matched your search

+3
View File
@@ -6,8 +6,11 @@ pub struct StopDetail {
pub id: i32,
pub code: String,
pub name_th: String,
pub name_en: Option<String>,
pub city_th: Option<String>,
pub city_en: Option<String>,
pub province_th: Option<String>,
pub province_en: Option<String>,
pub station_type: String,
pub attributes: SqlxJson<serde_json::Value>,
pub metadata: SqlxJson<serde_json::Value>,
+5 -2
View File
@@ -3,7 +3,8 @@ use sqlx::PgPool;
pub async fn fetch(pool: &PgPool, code: &str) -> Result<Option<StopDetail>, sqlx::Error> {
let sql = r#"
SELECT s.id, s.code, s.name_th, s.city_th, s.province_th,
SELECT s.id, s.code, s.name_th, s.name_en, s.city_th, s.city_en,
s.province_th, s.province_en,
s.station_type::text AS station_type,
s.attributes, s.metadata,
COALESCE((
@@ -18,9 +19,11 @@ pub async fn fetch(pool: &PgPool, code: &str) -> Result<Option<StopDetail>, sqlx
SELECT jsonb_agg(jsonb_build_object(
'route_id', r.route_id,
'name_th', r.name_th,
'name_en', r.name_en,
'vehicle_type', r.vehicle_type::text,
'route_group_code', g.code,
'route_group_label_th', g.label_th
'route_group_label_th', g.label_th,
'route_group_label_en', g.label_en
) ORDER BY rs.stop_sequence, r.route_id)
FROM route_stops rs
JOIN routes r ON r.route_id = rs.route_id