49 lines
1.3 KiB
Rust
49 lines
1.3 KiB
Rust
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.5
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::{icon::Icon, loader::GameLoader, package::{PackageType, Provider}, utility::DbVec};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "packages")]
|
|
#[onelauncher_macro::specta]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub hash: String,
|
|
pub file_name: String,
|
|
pub version_id: String,
|
|
pub published_at: DateTimeUtc,
|
|
pub display_name: String,
|
|
pub display_version: String,
|
|
pub package_type: PackageType,
|
|
pub provider: Provider,
|
|
pub package_id: String,
|
|
pub mc_versions: DbVec<String>,
|
|
pub mc_loader: DbVec<GameLoader>,
|
|
#[sea_orm(nullable)]
|
|
pub icon: Option<Icon>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::cluster_packages::Entity")]
|
|
ClusterPackages,
|
|
}
|
|
|
|
impl Related<super::cluster_packages::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::ClusterPackages.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::clusters::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
super::cluster_packages::Relation::Clusters.def()
|
|
}
|
|
fn via() -> Option<RelationDef> {
|
|
Some(super::cluster_packages::Relation::Packages.def().rev())
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|