corrugatedcardboard/src/entities/user.rs

41 lines
986 B
Rust
Raw Normal View History

2023-03-22 03:57:52 -07:00
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "user")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: i64,
2023-03-22 03:57:52 -07:00
#[sea_orm(column_type = "Text")]
pub username: String,
#[sea_orm(column_type = "Text")]
pub email: String,
#[sea_orm(column_type = "Text")]
pub password_hash: String,
pub bio: String,
pub flags: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::post::Entity")]
Post,
2023-03-22 03:57:52 -07:00
#[sea_orm(has_many = "super::session::Entity")]
Session,
}
impl Related<super::post::Entity> for Entity {
fn to() -> RelationDef {
Relation::Post.def()
}
}
2023-03-22 03:57:52 -07:00
impl Related<super::session::Entity> for Entity {
fn to() -> RelationDef {
Relation::Session.def()
}
}
impl ActiveModelBehavior for ActiveModel {}