broadcasts segments enum

This commit is contained in:
2024-10-07 10:08:56 +02:00
parent e04e4f6491
commit 08050baf98
8 changed files with 82 additions and 61 deletions

View File

@ -1,14 +1,23 @@
use chrono::{DateTime, Utc};
use serde::Deserialize;
use serde::{Deserialize, Serialize};
use crate::post_utils::post_parser::deserialize_date;
pub const BLOG_POST_PATH: &str = "_posts/blog";
#[derive(Deserialize, Debug, Clone)]
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")] // Optional, this converts enum variants to lowercase
pub enum Segment {
Blog,
Broadcasts,
Featured,
Cookbook,
}
#[derive(Deserialize, Debug)]
pub struct BlogPostMetadata {
pub title: String,
pub segments: Vec<String>,
pub segments: Vec<Segment>,
pub published: bool,
#[serde(deserialize_with = "deserialize_date")]
pub date: DateTime<Utc>,