use chrono::{DateTime, Utc}; use sqlx::{FromRow, Type}; use std::fmt::{Display, Formatter}; use uuid::Uuid; #[derive(Debug, Clone, FromRow)] pub struct User { pub id: u64, pub pubkey: [u8; 32], pub created: DateTime, pub balance: i64, pub tos_accepted: DateTime, pub stream_key: String, pub is_admin: bool, pub is_blocked: bool, } #[derive(Default, Debug, Clone, Type)] #[repr(u8)] pub enum UserStreamState { #[default] Unknown = 0, Planned = 1, Live = 2, Ended = 3, } impl Display for UserStreamState { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { UserStreamState::Unknown => write!(f, "unknown"), UserStreamState::Planned => write!(f, "planned"), UserStreamState::Live => write!(f, "live"), UserStreamState::Ended => write!(f, "ended"), } } } #[derive(Debug, Clone, Default, FromRow)] pub struct UserStream { pub id: Uuid, pub user_id: u64, pub starts: DateTime, pub ends: Option>, pub state: UserStreamState, pub title: Option, pub summary: Option, pub image: Option, pub thumb: Option, pub tags: Option, pub content_warning: Option, pub goal: Option, pub pinned: Option, pub cost: u64, pub duration: f32, pub fee: Option, pub event: Option, }