controller/src/handlers/v1/schedules.rs

24 lines
578 B
Rust

use crate::db;
use actix_web::{HttpResponse, Responder};
pub async fn index() -> impl Responder {
let schedules = db::get_schedules();
HttpResponse::Ok().json(schedules)
}
pub async fn get() -> impl Responder {
"hello from get schedules by id"
}
pub async fn add() -> impl Responder {
let new_schedule = db::create_schedule("TEST");
match new_schedule {
Ok(ok) => HttpResponse::Ok().json(ok),
Err(err) => HttpResponse::InternalServerError().json(err),
}
}
pub async fn delete() -> impl Responder {
"hello from delete schedule"
}