backend/model/dto/
timeline.rsuse chrono::NaiveDate;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use typeshare::typeshare;
use utoipa::{IntoParams, ToSchema};
#[typeshare]
#[derive(Debug, Clone, Copy, Serialize, Deserialize, ToSchema, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct TimelineEntryDto {
pub additions: i32,
pub removals: i32,
}
#[typeshare]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct TimelineDto {
#[schema(example = "{ \"2020\": { \"additions\": 7, \"removals\": 7 } }")]
pub years: HashMap<String, TimelineEntryDto>,
#[schema(example = "{ \"2020-01\": { \"additions\": 7, \"removals\": 7 } }")]
pub months: HashMap<String, TimelineEntryDto>,
#[schema(
example = "{ \"2020-01-01\": { \"additions\": 3, \"removals\": 2 }, \"2020-01-05\": { \"additions\": 4, \"removals\": 5 } }"
)]
pub dates: HashMap<String, TimelineEntryDto>,
}
#[typeshare]
#[derive(Debug, Deserialize, IntoParams)]
#[serde(rename_all = "camelCase")]
pub struct TimelineParameters {
pub start: NaiveDate,
pub end: NaiveDate,
}