Spaces:
Sleeping
Sleeping
nishantcoder108
func: implement model for items and users, what to stored and what to response
e04bde8 Download src/models.rs from nishantcoder/aura-rs-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/nishantcoder/aura-rs-backend/resolve/main/src/models.rs
- Command line
-
hf download hf://spaces/nishantcoder/aura-rs-backend/src/models.rs
-
curl -L -o models.rs https://huggingface.co/spaces/nishantcoder/aura-rs-backend/resolve/main/src/models.rs
1.22 kB
| use chrono::{DateTime, Utc}; | |
| use serde::Serialize; | |
| use sqlx::FromRow; | |
| use uuid::Uuid; | |
| pub struct UserRecord { | |
| pub id: Uuid, | |
| pub first_name: String, | |
| pub email: String, | |
| pub username: String, | |
| pub password_hash: String, | |
| } | |
| 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, | |
| } | |
| } | |
| } | |
| 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>, | |
| } | |
| pub struct LabelSummary { | |
| pub label: String, | |
| pub item_count: i64, | |
| } | |