Skip to content

Commit

Permalink
fix: add missing tag.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eason0729 committed Aug 23, 2024
1 parent 51a12a2 commit c255cfa
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions backend/src/entity/tag.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0
use super::*;
use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "tag")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
#[sea_orm(unique)]
pub name: String,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::tag_problem::Entity")]
TagProblem,
}

impl Related<tag_problem::Entity> for Entity {
fn to() -> RelationDef {
Relation::TagProblem.def()
}
}

impl Related<problem::Entity> for Entity {
fn to() -> RelationDef {
tag_problem::Relation::Problem.def()
}
fn via() -> Option<RelationDef> {
Some(tag_problem::Relation::Tag.def().rev())
}
}

impl ActiveModelBehavior for ActiveModel {}

0 comments on commit c255cfa

Please sign in to comment.