use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Deserialize, Serialize, utoipa::ToSchema)] #[sea_orm(table_name = "Owners")] #[schema(title="Owner", as=entities::Owner)] pub struct Model { #[sea_orm(primary_key, auto_increment = true)] pub id: u32, pub first_name: String, pub last_name: String, pub contact: String } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm(has_many = "super::book_instance::Entity")] BookInstance } impl Related for Entity { fn to() -> RelationDef { Relation::BookInstance.def() } } impl ActiveModelBehavior for ActiveModel {}