start working on cal
All checks were successful
CI/CD Pipeline / test (push) Successful in 11m36s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
2024-09-09 21:51:01 +03:00
parent f116b97072
commit d404636261
7 changed files with 151 additions and 29 deletions

View File

@ -1,7 +1,7 @@
use rocket::{get, http::ContentType, routes, Route, State};
use sqlx::SqlitePool;
use crate::model::event::Event;
use crate::model::{event::Event, personal::cal::get_personal_cal, user::User};
#[get("/cal")]
async fn cal(db: &State<SqlitePool>) -> (ContentType, String) {
@ -9,8 +9,14 @@ async fn cal(db: &State<SqlitePool>) -> (ContentType, String) {
(ContentType::Calendar, Event::get_ics_feed(db).await)
}
#[get("/cal/registered")]
async fn cal_registered(db: &State<SqlitePool>, user: User) -> (ContentType, String) {
//TODO: add unit test once proper functionality is there
(ContentType::Calendar, get_personal_cal(db, &user).await)
}
pub fn routes() -> Vec<Route> {
routes![cal]
routes![cal, cal_registered]
}
#[cfg(test)]