Cleanup db/schedule namespace

This commit is contained in:
Tobias Reisinger 2023-11-21 16:33:41 +01:00
parent 09c50411d1
commit effd3f3b18
8 changed files with 155 additions and 209 deletions

View file

@ -5,7 +5,7 @@ use sqlx::{Pool, Sqlite};
use crate::db::errors::DatabaseError;
use crate::db::model_utils::Period;
use crate::db::models::{Periods, Schedule};
use crate::db::schedules::{Periods, Schedule};
use crate::types::EmgauwaUid;
pub mod errors;
@ -29,7 +29,7 @@ async fn init_schedule(
periods: Periods,
) -> Result<(), DatabaseError> {
trace!("Initializing schedule {:?}", name);
match schedules::get_schedule_by_uid(&mut pool.acquire().await.unwrap(), uid).await {
match Schedule::get_by_uid(&mut pool.acquire().await.unwrap(), uid).await {
Ok(_) => Ok(()),
Err(err) => match err {
DatabaseError::NotFound => {