Skip to main content

max / makenotwork

1.6 KB · 45 lines History Blame Raw
1 //! Blog post model.
2
3 use chrono::{DateTime, Utc};
4 use serde::Serialize;
5 use sqlx::FromRow;
6
7 use super::super::id_types::*;
8 use super::super::validated_types::*;
9
10 /// A blog post within a project.
11 #[derive(Debug, Clone, FromRow, Serialize)]
12 pub struct DbBlogPost {
13 /// Database primary key.
14 pub id: BlogPostId,
15 /// Parent project ID.
16 pub project_id: ProjectId,
17 /// Author user ID.
18 pub author_id: UserId,
19 /// Post title.
20 pub title: String,
21 /// URL-safe slug unique per project.
22 pub slug: Slug,
23 /// Raw markdown content.
24 pub body_markdown: String,
25 /// Rendered HTML content.
26 pub body_html: String,
27 /// When the post was published (set on first publish, cleared on unpublish).
28 pub published_at: Option<DateTime<Utc>>,
29 /// When the post was created.
30 pub created_at: DateTime<Utc>,
31 /// When the post was last modified.
32 pub updated_at: DateTime<Utc>,
33 /// Scheduled publication time (post stays draft until this time, then the scheduler publishes it).
34 pub publish_at: Option<DateTime<Utc>>,
35 /// Linked MT discussion thread ID (None if not yet created or MT unavailable).
36 pub mt_thread_id: Option<MtThreadId>,
37 /// Whether this post should only be published on the web (skip email announcements).
38 pub web_only: bool,
39 /// Operator-only flag marking this post as the landing-page "Last shipped"
40 /// line. Inert unless the post lives on the CHANGELOG_PROJECT_SLUG project.
41 pub show_on_landing: bool,
42 /// When a release announcement was sent (prevents re-announcement on unpublish/republish).
43 pub release_announced_at: Option<DateTime<Utc>>,
44 }
45