Alisa/crates/entity/src/license.rs

38 lines
1 KiB
Rust

//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "license")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
#[serde(skip_deserializing)]
pub id: Uuid,
pub name: String,
pub start: Option<DateTimeWithTimeZone>,
pub end: Option<DateTimeWithTimeZone>,
pub amount: Option<i32>,
pub key: String,
pub group_id: Uuid,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::license_group::Entity",
from = "Column::GroupId",
to = "super::license_group::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
LicenseGroup,
}
impl Related<super::license_group::Entity> for Entity {
fn to() -> RelationDef {
Relation::LicenseGroup.def()
}
}
impl ActiveModelBehavior for ActiveModel {}