Skip to content
Clone
a06673b
35 lines 986 B Rust
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use uuid::Uuid;
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Default, EnumIter, DeriveActiveEnum, Serialize, Deserialize,
)]
#[sea_orm(rs_type = "i32", db_type = "SmallInteger")]
pub enum OAuthAppStatus {
#[default]
Active = 0,
Disabled = 1,
}
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "oauth_app")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub name: String,
#[sea_orm(unique)]
pub client_id: String,
pub client_secret: String,
pub redirect_urls: String,
pub status: OAuthAppStatus,
pub space_id: Option<Uuid>,
pub created_by: Uuid,
pub created_at: OffsetDateTime,
#[sea_orm(belongs_to, from = "created_by", to = "uid")]
pub creator: BelongsTo<super::super::user::users::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}