diff --git a/server/.sqlx/query-874f7f834952dc9935690debfad3d161757d7ce6fcee59c23c23abbf45e803cb.json b/server/.sqlx/query-c1d72e1bd0c218581f5b6259c85aee13b64b16adb36252d6c3135e1ce7ff0887.json similarity index 66% rename from server/.sqlx/query-874f7f834952dc9935690debfad3d161757d7ce6fcee59c23c23abbf45e803cb.json rename to server/.sqlx/query-c1d72e1bd0c218581f5b6259c85aee13b64b16adb36252d6c3135e1ce7ff0887.json index c8b7dc6b9..371820156 100644 --- a/server/.sqlx/query-874f7f834952dc9935690debfad3d161757d7ce6fcee59c23c23abbf45e803cb.json +++ b/server/.sqlx/query-c1d72e1bd0c218581f5b6259c85aee13b64b16adb36252d6c3135e1ce7ff0887.json @@ -1,57 +1,42 @@ { "db_name": "PostgreSQL", - "query": "SELECT * FROM en WHERE key = $1", + "query": "SELECT name,last_calendar_scrape_at,calendar_url,type,type_common_name,lat,lon FROM en WHERE key = $1", "describe": { "columns": [ { "ordinal": 0, - "name": "key", + "name": "name", "type_info": "Text" }, { "ordinal": 1, - "name": "data", - "type_info": "Jsonb" - }, - { - "ordinal": 2, "name": "last_calendar_scrape_at", "type_info": "Timestamptz" }, { - "ordinal": 3, - "name": "lat", - "type_info": "Float8" - }, - { - "ordinal": 4, - "name": "lon", - "type_info": "Float8" - }, - { - "ordinal": 5, - "name": "name", + "ordinal": 2, + "name": "calendar_url", "type_info": "Text" }, { - "ordinal": 6, - "name": "type_common_name", + "ordinal": 3, + "name": "type", "type_info": "Text" }, { - "ordinal": 7, - "name": "type", + "ordinal": 4, + "name": "type_common_name", "type_info": "Text" }, { - "ordinal": 8, - "name": "calendar_url", - "type_info": "Text" + "ordinal": 5, + "name": "lat", + "type_info": "Float8" }, { - "ordinal": 9, - "name": "tumonline_room_nr", - "type_info": "Int4" + "ordinal": 6, + "name": "lon", + "type_info": "Float8" } ], "parameters": { @@ -60,17 +45,14 @@ ] }, "nullable": [ - false, false, true, + true, false, false, false, - false, - false, - true, - true + false ] }, - "hash": "874f7f834952dc9935690debfad3d161757d7ce6fcee59c23c23abbf45e803cb" + "hash": "c1d72e1bd0c218581f5b6259c85aee13b64b16adb36252d6c3135e1ce7ff0887" } diff --git a/server/.sqlx/query-a87d33b55872d9135ab82391b36d1a495534817fb39a9e25f6720267c6025965.json b/server/.sqlx/query-c7501ce05d89b1453354acf8113b766a50309ca0b3dfb34b523468c5d13a4409.json similarity index 66% rename from server/.sqlx/query-a87d33b55872d9135ab82391b36d1a495534817fb39a9e25f6720267c6025965.json rename to server/.sqlx/query-c7501ce05d89b1453354acf8113b766a50309ca0b3dfb34b523468c5d13a4409.json index cec049836..3b7205a88 100644 --- a/server/.sqlx/query-a87d33b55872d9135ab82391b36d1a495534817fb39a9e25f6720267c6025965.json +++ b/server/.sqlx/query-c7501ce05d89b1453354acf8113b766a50309ca0b3dfb34b523468c5d13a4409.json @@ -1,57 +1,42 @@ { "db_name": "PostgreSQL", - "query": "SELECT * FROM de WHERE key = $1", + "query": "SELECT name,last_calendar_scrape_at,calendar_url,type,type_common_name,lat,lon FROM de WHERE key = $1", "describe": { "columns": [ { "ordinal": 0, - "name": "key", + "name": "name", "type_info": "Text" }, { "ordinal": 1, - "name": "data", - "type_info": "Jsonb" - }, - { - "ordinal": 2, "name": "last_calendar_scrape_at", "type_info": "Timestamptz" }, { - "ordinal": 3, - "name": "lat", - "type_info": "Float8" - }, - { - "ordinal": 4, - "name": "lon", - "type_info": "Float8" - }, - { - "ordinal": 5, - "name": "name", + "ordinal": 2, + "name": "calendar_url", "type_info": "Text" }, { - "ordinal": 6, - "name": "type_common_name", + "ordinal": 3, + "name": "type", "type_info": "Text" }, { - "ordinal": 7, - "name": "type", + "ordinal": 4, + "name": "type_common_name", "type_info": "Text" }, { - "ordinal": 8, - "name": "calendar_url", - "type_info": "Text" + "ordinal": 5, + "name": "lat", + "type_info": "Float8" }, { - "ordinal": 9, - "name": "tumonline_room_nr", - "type_info": "Int4" + "ordinal": 6, + "name": "lon", + "type_info": "Float8" } ], "parameters": { @@ -60,17 +45,14 @@ ] }, "nullable": [ - false, false, true, + true, false, false, false, - false, - false, - true, - true + false ] }, - "hash": "a87d33b55872d9135ab82391b36d1a495534817fb39a9e25f6720267c6025965" + "hash": "c7501ce05d89b1453354acf8113b766a50309ca0b3dfb34b523468c5d13a4409" } diff --git a/server/main-api/src/calendar/mod.rs b/server/main-api/src/calendar/mod.rs index 70d0eb68e..94d4723ba 100644 --- a/server/main-api/src/calendar/mod.rs +++ b/server/main-api/src/calendar/mod.rs @@ -65,7 +65,7 @@ pub async fn calendar_handler( } async fn get_location(pool: &PgPool, id: &str) -> Result, sqlx::Error> { - sqlx::query_as!(Location, "SELECT * FROM de WHERE key = $1", id) + sqlx::query_as!(Location, "SELECT name,last_calendar_scrape_at,calendar_url,type,type_common_name,lat,lon FROM de WHERE key = $1", id) .fetch_optional(pool) .await } diff --git a/server/main-api/src/maps/mod.rs b/server/main-api/src/maps/mod.rs index 94ed137cc..6d67ff514 100644 --- a/server/main-api/src/maps/mod.rs +++ b/server/main-api/src/maps/mod.rs @@ -35,11 +35,11 @@ async fn get_localised_data( should_use_english: bool, ) -> Result { let result = if should_use_english { - sqlx::query_as!(Location, "SELECT * FROM en WHERE key = $1", id) + sqlx::query_as!(Location, "SELECT name,last_calendar_scrape_at,calendar_url,type,type_common_name,lat,lon FROM en WHERE key = $1", id) .fetch_all(conn) .await } else { - sqlx::query_as!(Location, "SELECT * FROM de WHERE key = $1", id) + sqlx::query_as!(Location, "SELECT name,last_calendar_scrape_at,calendar_url,type,type_common_name,lat,lon FROM de WHERE key = $1", id) .fetch_all(conn) .await }; diff --git a/server/main-api/src/models.rs b/server/main-api/src/models.rs index 6e174d8f1..04424a9cb 100644 --- a/server/main-api/src/models.rs +++ b/server/main-api/src/models.rs @@ -1,18 +1,14 @@ use chrono::{DateTime, Utc}; -use serde_json::Value; #[derive(Debug, Clone)] pub struct Location { - pub key: String, pub name: String, pub last_calendar_scrape_at: Option>, - pub tumonline_room_nr: Option, pub calendar_url: Option, pub r#type: String, pub type_common_name: String, pub lat: f64, pub lon: f64, - pub data: Value, } #[derive(Debug, Clone)]