controller/src/return_models.rs

21 lines
466 B
Rust
Raw Normal View History

2022-04-02 23:35:51 +00:00
use serde::{Serialize};
use crate::db::models::Schedule;
use crate::db::schedule::get_schedule_tags;
#[derive(Debug, Serialize)]
pub struct ReturnSchedule {
#[serde(flatten)]
pub schedule: Schedule,
pub tags: Vec<String>,
}
impl From<Schedule> for ReturnSchedule {
fn from(schedule: Schedule) -> Self {
let tags: Vec<String> = get_schedule_tags(&schedule);
ReturnSchedule {
schedule,
tags,
}
}
}