sqlite: clean up get_events

This commit is contained in:
Lennart
2024-05-25 22:27:37 +02:00
parent 7e02a7e095
commit 1c88821b21

View File

@@ -74,14 +74,12 @@ impl CalendarStore for SqliteCalendarStore {
} }
async fn get_events(&self, cid: &str) -> Result<Vec<Event>> { async fn get_events(&self, cid: &str) -> Result<Vec<Event>> {
let events = sqlx::query_as!(EventRow, "SELECT uid, ics FROM events WHERE cid = ?", cid) sqlx::query_as!(EventRow, "SELECT uid, ics FROM events WHERE cid = ?", cid)
.fetch_all(&self.db) .fetch_all(&self.db)
.await? .await?
.into_iter() .into_iter()
// TODO: this is an ugly bodge :( .map(|row| row.try_into())
.filter_map(|row| row.try_into().ok()) .collect()
.collect();
Ok(events)
} }
async fn get_event(&self, cid: &str, uid: &str) -> Result<Event> { async fn get_event(&self, cid: &str, uid: &str) -> Result<Event> {