support English
This commit is contained in:
1 parent
138a3d15d8
commit
b8ed110459
36 files changed
+523
-118
No files matched your search
@@ -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>,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user