a06673b
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Default, EnumIter, DeriveActiveEnum, Serialize, Deserialize,
)]
#[sea_orm(rs_type = "i16", db_type = "SmallInteger")]
pub enum StickerKind {
#[default]
#[sea_orm(num_value = 0)]
Emoji = 0,
#[sea_orm(num_value = 1)]
Sticker = 1,
}
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "sticker")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: Uuid,
#[sea_orm(unique_key = "space_name")]
pub space_id: Uuid,
#[sea_orm(unique_key = "space_name")]
pub name: String,
pub pack_id: Option<Uuid>,
pub kind: StickerKind,
pub url: String,
pub content_type: String,
pub size: i64,
pub width: Option<i32>,
pub height: Option<i32>,
#[sea_orm(default_value = "false")]
pub is_animated: bool,
pub created_by: Option<Uuid>,
pub created_at: OffsetDateTime,
#[sea_orm(belongs_to, from = "space_id", to = "id")]
pub space: BelongsTo<super::super::space::spaces::Entity>,
#[sea_orm(belongs_to, from = "pack_id", to = "id")]
pub pack: BelongsTo<Option<super::sticker_packs::Entity>>,
#[sea_orm(belongs_to, from = "created_by", to = "uid")]
pub creator: BelongsTo<Option<super::super::user::users::Entity>>,
}
impl ActiveModelBehavior for ActiveModel {}