Files
home-api/packages/model/lib/id_card/mod.rs
2025-08-15 10:50:54 +08:00

32 lines
920 B
Rust

use sea_orm::entity::prelude::*;
use sea_orm::{ActiveModelBehavior, DeriveActiveEnum, DeriveEntityModel, DerivePrimaryKey, DeriveRelation, EnumIter};
use serde::{Deserialize, Serialize};
#[derive(DeriveEntityModel, Clone, Debug, PartialEq, Serialize, Deserialize)]
#[sea_orm(table_name = "id_card")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: String,
pub name: String,
pub gender: Gender,
pub birth: String,
pub address: Option<String>,
pub nation: String,
pub create_at: DateTime,
}
pub type IDCardModel = Model;
#[derive(Debug, DeriveRelation, EnumIter)]
pub enum Relation {}
#[derive(Serialize, Deserialize, Debug, Clone, EnumIter, PartialEq, DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "gender")]
pub enum Gender {
#[sea_orm(string_value = "female")]
Female,
#[sea_orm(string_value = "male")]
Male,
}
impl ActiveModelBehavior for ActiveModel {}