Skip to main content

pebble_cms/models/
series.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct Series {
5    pub id: i64,
6    pub title: String,
7    pub slug: String,
8    pub description: String,
9    pub status: String,
10    pub created_at: String,
11    pub updated_at: String,
12}
13
14#[derive(Debug, Clone, Serialize)]
15pub struct SeriesWithItems {
16    #[serde(flatten)]
17    pub series: Series,
18    pub items: Vec<SeriesItem>,
19}
20
21#[derive(Debug, Clone, Serialize)]
22pub struct SeriesItem {
23    pub id: i64,
24    pub content_id: i64,
25    pub position: i32,
26    pub title: String,
27    pub slug: String,
28    pub status: String,
29}
30
31/// Prev/next navigation context for a post within a series.
32#[derive(Debug, Clone, Serialize)]
33pub struct SeriesNavigation {
34    pub series: Series,
35    pub current_position: i32,
36    pub total_items: usize,
37    pub prev: Option<SeriesNavItem>,
38    pub next: Option<SeriesNavItem>,
39}
40
41#[derive(Debug, Clone, Serialize)]
42pub struct SeriesNavItem {
43    pub title: String,
44    pub slug: String,
45    pub position: i32,
46}
47
48#[derive(Debug, Deserialize)]
49pub struct CreateSeries {
50    pub title: String,
51    pub slug: Option<String>,
52    pub description: Option<String>,
53    pub status: Option<String>,
54}
55
56#[derive(Debug, Deserialize)]
57pub struct UpdateSeries {
58    pub title: Option<String>,
59    pub slug: Option<String>,
60    pub description: Option<String>,
61    pub status: Option<String>,
62}