mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 10:32:19 +00:00
sqlite: clean up get_events
This commit is contained in:
@@ -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> {
|
||||||
|
|||||||
Reference in New Issue
Block a user