use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize, ToSchema)] #[sea_orm(table_name = "family")] pub struct Model { #[sea_orm(primary_key)] pub id: i32, pub name: String, #[serde(skip_serializing)] pub password_hash: String, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm(has_many = "super::category::Entity")] Category, #[sea_orm(has_many = "super::shopping_item::Entity")] ShoppingItem, } impl Related for Entity { fn to() -> RelationDef { Relation::Category.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::ShoppingItem.def() } } impl ActiveModelBehavior for ActiveModel {}