You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: server/src/locations/details.rs
+51-4
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,57 @@
1
+
usecrate::localisation;
2
+
usecrate::models::LocationKeyAlias;
1
3
use actix_web::{get, web,HttpResponse};
4
+
use chrono::DateTime;
5
+
use chrono::Utc;
2
6
use sqlx::Error::RowNotFound;
3
7
use sqlx::PgPool;
4
8
use tracing::error;
9
+
use serde::{Deserialize,Serialize};
5
10
6
-
usecrate::localisation;
7
-
usecrate::models::LocationKeyAlias;
11
+
#[derive(Debug,Clone)]
12
+
pubstructUsage{
13
+
id:i64,
14
+
name:String,
15
+
din_277:String,
16
+
din_277_desc:String,
17
+
}
18
+
19
+
#[derive(Debug,Clone)]
20
+
pubstructOperator{
21
+
id:String,
22
+
url:String,
23
+
code:String,
24
+
name:String,
25
+
}
26
+
27
+
#[derive(Debug,Clone)]
28
+
pubstructUrl{
29
+
name:String,
30
+
url:String,
31
+
}
32
+
33
+
#[derive(Debug,Clone)]
34
+
pubstructDBLocationDetails{
35
+
pubkey:String,
36
+
pubname:String,
37
+
publast_calendar_scrape_at:Option<DateTime<Utc>>,
38
+
pubcalendar_url:Option<String>,
39
+
pubr#type:String,
40
+
pubtype_common_name:String,
41
+
publat:f64,
42
+
publon:f64,
43
+
pubcoordinate_source:String,
44
+
pubrank_type:String,
45
+
pubrank_combined:String,
46
+
pubrank_usage:String,
47
+
pubcomment:Option<String>,
48
+
pubroom_key:Option<String>,
49
+
pubadress:Option<String>,
50
+
publevel:Option<String>,
51
+
pubarch_name:Option<String>,
52
+
pubroom_cnt:Option<String>,
53
+
pubbuilding_cnt:Option<String>,
54
+
}
8
55
9
56
#[get("/{id}")]
10
57
pubasyncfnget_handler(
@@ -19,11 +66,11 @@ pub async fn get_handler(
19
66
returnHttpResponse::NotFound().body("Not found");
20
67
};
21
68
let result = if args.should_use_english(){
22
-
sqlx::query_scalar!("SELECT data FROM en WHERE key = $1", probable_id)
69
+
sqlx::query_as!(DBLocationDetails,"SELECT key,name,last_calendar_scrape_at,calendar_url,type,type_common_name,lat,lon,coordinate_source,rank_type,rank_combined,rank_usage,comment,room_key,adress,level,arch_name,room_cnt,building_cnt FROM en WHERE key = $1", probable_id)
23
70
.fetch_optional(&data.pool)
24
71
.await
25
72
}else{
26
-
sqlx::query_scalar!("SELECT data FROM de WHERE key = $1", probable_id)
73
+
sqlx::query_as!(DBLocationDetails,"SELECT key,name,last_calendar_scrape_at,calendar_url,type,type_common_name,lat,lon,coordinate_source,rank_type,rank_combined,rank_usage,comment,room_key,adress,level,arch_name,room_cnt,building_cnt FROM de WHERE key = $1", probable_id)
0 commit comments