v0.02
This commit is contained in:
68
backend/entity/src/entities/book.rs
Normal file
68
backend/entity/src/entities/book.rs
Normal file
@@ -0,0 +1,68 @@
|
||||
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "book")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub open_library_key: String,
|
||||
pub title: String,
|
||||
pub edition_count: i32,
|
||||
pub first_publish_year: i32,
|
||||
pub median_page_count: i32,
|
||||
pub goodread_id: String,
|
||||
pub description: String,
|
||||
pub cover: String,
|
||||
pub location: String,
|
||||
pub time_added: String,
|
||||
pub rating: i32,
|
||||
pub comments: String,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::book_author::Entity")]
|
||||
BookAuthor,
|
||||
#[sea_orm(has_many = "super::book_person::Entity")]
|
||||
BookPerson,
|
||||
#[sea_orm(has_many = "super::book_place::Entity")]
|
||||
BookPlace,
|
||||
#[sea_orm(has_many = "super::book_subject::Entity")]
|
||||
BookSubject,
|
||||
#[sea_orm(has_many = "super::book_time::Entity")]
|
||||
BookTime,
|
||||
}
|
||||
|
||||
impl Related<super::book_author::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::BookAuthor.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::book_person::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::BookPerson.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::book_place::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::BookPlace.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::book_subject::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::BookSubject.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::book_time::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::BookTime.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
Reference in New Issue
Block a user