feat: Site Announcements routes migrated to Rust

- New SiteAnnouncement model (site_announcement.rs)
- Route handlers: list (with siteId/platform/read/status filters),
  mark read, mark all read, delete all
- In-memory status filtering for active/expired/dismissed (same as Node.js)
- Uses existing site_announcements table from migration
- 18/18 tests pass
This commit is contained in:
boos
2026-05-17 13:34:53 +08:00
parent 2793a7990d
commit 9329248e59
4 changed files with 202 additions and 0 deletions
+1
View File
@@ -6,5 +6,6 @@ pub mod event;
pub mod route_channel;
pub mod setting;
pub mod site;
pub mod site_announcement;
pub mod token_route;
pub mod user;
@@ -0,0 +1,24 @@
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
/// Site-level announcements (notifications from upstream providers).
#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct SiteAnnouncement {
pub id: i64,
pub site_id: i64,
pub platform: String,
pub source_key: String,
pub title: String,
pub content: String,
pub level: Option<String>,
pub source_url: Option<String>,
pub starts_at: Option<String>,
pub ends_at: Option<String>,
pub upstream_created_at: Option<String>,
pub upstream_updated_at: Option<String>,
pub first_seen_at: Option<String>,
pub last_seen_at: Option<String>,
pub read_at: Option<String>,
pub dismissed_at: Option<String>,
pub raw_payload: Option<String>,
}