2023-04-26 11:25:29 +02:00

33 lines
663 B
Rust

use chrono::NaiveDate;
use serde::Serialize;
use sqlx::SqlitePool;
use self::{
planned_event::{PlannedEvent, PlannedEventWithUser},
trip::{Trip, TripWithUser},
};
pub mod log;
pub mod planned_event;
pub mod trip;
pub mod tripdetails;
pub mod user;
pub mod usertrip;
#[derive(Serialize)]
pub struct Day {
day: NaiveDate,
planned_events: Vec<PlannedEventWithUser>,
trips: Vec<TripWithUser>,
}
impl Day {
pub async fn new(db: &SqlitePool, day: NaiveDate) -> Self {
Self {
day,
planned_events: PlannedEvent::get_for_day(db, day).await,
trips: Trip::get_for_day(db, day).await,
}
}
}