finalize todo
This commit is contained in:
@ -9,10 +9,21 @@ 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)
|
||||
#[get("/cal/personal/<user_id>/<uuid>")]
|
||||
async fn cal_registered(
|
||||
db: &State<SqlitePool>,
|
||||
user_id: i32,
|
||||
uuid: &str,
|
||||
) -> Result<(ContentType, String), String> {
|
||||
let Some(user) = User::find_by_id(db, user_id).await else {
|
||||
return Err("Invalid".into());
|
||||
};
|
||||
|
||||
if &user.user_token != uuid {
|
||||
return Err("Invalid".into());
|
||||
}
|
||||
|
||||
Ok((ContentType::Calendar, get_personal_cal(db, &user).await))
|
||||
}
|
||||
|
||||
pub fn routes() -> Vec<Route> {
|
||||
|
Reference in New Issue
Block a user