use chrono::prelude::*; use common::ron_api::Difficulty; use sqlx::{self, FromRow}; #[derive(Debug, Clone, FromRow)] pub struct User { pub id: i64, pub name: String, pub email: String, pub lang: String, } #[derive(Debug, FromRow)] pub struct UserLoginInfo { pub last_login_datetime: DateTime, pub ip: String, pub user_agent: String, } #[derive(Debug, FromRow)] pub struct Recipe { pub id: i64, pub user_id: i64, pub title: String, pub lang: String, pub estimated_time: Option, // [s]. pub description: String, #[sqlx(try_from = "u32")] pub difficulty: Difficulty, pub servings: Option, pub is_published: bool, #[sqlx(skip)] pub tags: Vec, #[sqlx(skip)] pub groups: Vec, } #[derive(Debug, FromRow)] pub struct Group { pub id: i64, pub name: String, pub comment: String, #[sqlx(skip)] pub steps: Vec, } #[derive(Debug, FromRow)] pub struct Step { pub id: i64, pub action: String, #[sqlx(skip)] pub ingredients: Vec, } #[derive(Debug, FromRow)] pub struct Ingredient { pub id: i64, pub name: String, pub comment: String, pub quantity_value: Option, pub quantity_unit: String, }