Spaces:
Sleeping
Sleeping
File size: 1,221 Bytes
e04bde8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | use chrono::{DateTime, Utc};
use serde::Serialize;
use sqlx::FromRow;
use uuid::Uuid;
#[derive(Debug, Clone, FromRow)]
pub struct UserRecord {
pub id: Uuid,
pub first_name: String,
pub email: String,
pub username: String,
pub password_hash: String,
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AuthUser {
pub id: Uuid,
pub first_name: String,
pub email: String,
pub username: String,
}
impl From<UserRecord> for AuthUser {
fn from(value: UserRecord) -> Self {
Self {
id: value.id,
first_name: value.first_name,
email: value.email,
username: value.username,
}
}
}
#[derive(Debug, Clone, FromRow, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ItemRecord {
pub id: Uuid,
pub user_id: Uuid,
pub youtube_url: String,
pub youtube_video_id: String,
pub title: String,
pub label: String,
pub is_favorite: bool,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
#[derive(Debug, Clone, FromRow, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct LabelSummary {
pub label: String,
pub item_count: i64,
}
|