This repository has been archived on 2025-08-25. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Alexandria/src/entities/owner.rs
2025-07-30 16:55:07 +02:00

27 lines
748 B
Rust

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<super::book_instance::Entity> for Entity {
fn to() -> RelationDef {
Relation::BookInstance.def()
}
}
impl ActiveModelBehavior for ActiveModel {}