Skip to content

Commit

Permalink
made sure that we are ready for the comming api change
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Jul 10, 2024
1 parent b55de62 commit 2b62c12
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
8 changes: 4 additions & 4 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2099,12 +2099,12 @@ components:
format: int32
examples:
- 42
stp_title_de:
title_de:
description: The german title of the Entry
type: string
examples:
- Quantenteleportation
stp_title_en:
title_en:
description: The english title of the Entry
type: string
examples:
Expand Down Expand Up @@ -2137,8 +2137,8 @@ components:
- Vorlesung mit Zentralübung
required:
- id
- stp_title_de
- stp_title_en
- title
- title_en
- start_at
- end_at
- entry_type
Expand Down
34 changes: 17 additions & 17 deletions server/main-api/src/calendar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async fn get_from_db(
) -> Result<LimitedHashMap<String, LocationEvents>, crate::BoxedError> {
let mut located_events: HashMap<String, LocationEvents> = HashMap::new();
for location in locations {
let events = sqlx::query_as!(Event, r#"SELECT id,room_code,start_at,end_at,stp_title_de,stp_title_en,stp_type,entry_type,detailed_entry_type
let events = sqlx::query_as!(Event, r#"SELECT id,room_code,start_at,end_at,title_de,title_en,stp_type,entry_type,detailed_entry_type
FROM calendar
WHERE room_code = $1 AND start_at >= $2 AND end_at <= $3"#,
location.key, start_after, end_before).fetch_all(pool).await?;
Expand Down Expand Up @@ -199,8 +199,8 @@ mod tests {
room_code: "5121.EG.003".into(),
start_at: *TIME_2012,
end_at: *TIME_2014,
stp_title_de: "Quantenteleportation".into(),
stp_title_en: "Quantum teleportation".into(),
title_de: "Quantenteleportation".into(),
title_en: "Quantum teleportation".into(),
stp_type: "Vorlesung mit Zentralübung".into(),
entry_type: models::EventType::Lecture.to_string(),
detailed_entry_type: "Abhaltung".into(),
Expand All @@ -210,8 +210,8 @@ mod tests {
room_code: "5121.EG.003".into(),
start_at: *TIME_2014,
end_at: *TIME_2016,
stp_title_de: "Quantenteleportation 2".into(),
stp_title_en: "Quantum teleportation 2".into(),
title_de: "Quantenteleportation 2".into(),
title_en: "Quantum teleportation 2".into(),
stp_type: "Vorlesung mit Zentralübung".into(),
entry_type: models::EventType::Lecture.to_string(),
detailed_entry_type: "Abhaltung".into(),
Expand All @@ -221,8 +221,8 @@ mod tests {
room_code: "5121.EG.001".into(),
start_at: *TIME_2014,
end_at: *TIME_2016,
stp_title_de: "Wartung".into(),
stp_title_en: "maintenance".into(),
title_de: "Wartung".into(),
title_en: "maintenance".into(),
stp_type: "Vorlesung mit Zentralübung".into(),
entry_type: models::EventType::Barred.to_string(),
detailed_entry_type: "Abhaltung".into(),
Expand All @@ -232,8 +232,8 @@ mod tests {
room_code: "5121.EG.001".into(),
start_at: *TIME_Y2K,
end_at: *TIME_2020,
stp_title_de: "Quantenteleportation 3".into(),
stp_title_en: "Quantum teleportation 3".into(),
title_de: "Quantenteleportation 3".into(),
title_en: "Quantum teleportation 3".into(),
stp_type: "Vorlesung".into(),
entry_type: models::EventType::Other.to_string(),
detailed_entry_type: "Abhaltung".into(),
Expand All @@ -243,8 +243,8 @@ mod tests {
room_code: "5121.EG.001".into(),
start_at: *TIME_Y2K,
end_at: *TIME_2010,
stp_title_de: "Quantenteleportation 3".into(),
stp_title_en: "Quantum teleportation 3".into(),
title_de: "Quantenteleportation 3".into(),
title_en: "Quantum teleportation 3".into(),
stp_type: "Vorlesung".into(),
entry_type: models::EventType::Exam.to_string(),
detailed_entry_type: "Abhaltung".into(),
Expand Down Expand Up @@ -367,8 +367,8 @@ mod tests {
"room_code": "5121.EG.003",
"start_at": "2012-01-01T00:00:00Z",
"end_at": "2014-01-01T00:00:00Z",
"stp_title_de": "Quantenteleportation",
"stp_title_en": "Quantum teleportation",
"title_de": "Quantenteleportation",
"title_en": "Quantum teleportation",
"stp_type": "Vorlesung mit Zentralübung",
"entry_type": "lecture",
"detailed_entry_type": "Abhaltung"
Expand All @@ -378,8 +378,8 @@ mod tests {
"room_code": "5121.EG.003",
"start_at": "2014-01-01T00:00:00Z",
"end_at": "2016-01-01T00:00:00Z",
"stp_title_de": "Quantenteleportation 2",
"stp_title_en": "Quantum teleportation 2",
"title_de": "Quantenteleportation 2",
"title_en": "Quantum teleportation 2",
"stp_type": "Vorlesung mit Zentralübung",
"entry_type": "lecture",
"detailed_entry_type": "Abhaltung"
Expand Down Expand Up @@ -431,8 +431,8 @@ mod tests {
"id": 1,
"room_code": "5121.EG.003",
"start_at": "2012-01-01T00:00:00Z",
"stp_title_de": "Quantenteleportation",
"stp_title_en": "Quantum teleportation",
"title_de": "Quantenteleportation",
"title_en": "Quantum teleportation",
"stp_type": "Vorlesung mit Zentralübung",
},
],
Expand Down
14 changes: 7 additions & 7 deletions server/main-api/src/calendar/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ pub(super) struct Event {
/// e.g. 2019-01-01T00:00:00
pub(super) end_at: DateTime<Utc>,
/// e.g. Quantenteleportation
pub(super) stp_title_de: String,
pub(super) title_de: String,
/// e.g. Quantum teleportation
pub(super) stp_title_en: String,
pub(super) title_en: String,
/// e.g. Vorlesung mit Zentralübung
pub(super) stp_type: String,
/// e.g. lecture
Expand All @@ -62,23 +62,23 @@ impl Event {
tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,
) -> Result<sqlx::postgres::PgQueryResult, sqlx::Error> {
sqlx::query!(
r#"INSERT INTO calendar (id,room_code,start_at,end_at,stp_title_de,stp_title_en,stp_type,entry_type,detailed_entry_type)
r#"INSERT INTO calendar (id,room_code,start_at,end_at,title_de,title_en,stp_type,entry_type,detailed_entry_type)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
ON CONFLICT (id) DO UPDATE SET
room_code = EXCLUDED.room_code,
start_at = EXCLUDED.start_at,
end_at = EXCLUDED.end_at,
stp_title_de = EXCLUDED.stp_title_de,
stp_title_en = EXCLUDED.stp_title_en,
title_de = EXCLUDED.title_de,
title_en = EXCLUDED.title_en,
stp_type = EXCLUDED.stp_type,
entry_type = EXCLUDED.entry_type,
detailed_entry_type = EXCLUDED.detailed_entry_type"#,
self.id,
self.room_code,
self.start_at,
self.end_at,
self.stp_title_de,
self.stp_title_en,
self.title_de,
self.title_en,
self.stp_type,
self.entry_type,
self.detailed_entry_type,
Expand Down
4 changes: 2 additions & 2 deletions webclient/api_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,9 @@ export type components = {
*/
readonly id: number;
/** @description The german title of the Entry */
readonly stp_title_de: string;
readonly title_de: string;
/** @description The english title of the Entry */
readonly stp_title_en: string;
readonly title_en: string;
/**
* Format: date-time
* @description The start of the entry
Expand Down
2 changes: 1 addition & 1 deletion webclient/components/CalendarFull.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function fetchEvents(arg: EventSourceFuncArg): Promise<EventInput[]> {
for (const [k, v] of Object.entries(data)) {
items.push(
...v.events.map((e) => {
const title = locale.value == "de" ? e.stp_title_de : e.stp_title_en;
const title = locale.value == "de" ? e.title_de : e.title_en;
return {
id: e.id.toString(),
title: show_room_names ? `${k} ${title}` : title,
Expand Down

0 comments on commit 2b62c12

Please sign in to comment.