You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/oab/src/models/mod.rs

38 lines
911 B
Rust

3 years ago
//
// mod.rs
// Copyright (C) 2022 veypi <veypi@qq.com>
// 2022-06-02 23:04
// Distributed under terms of the MIT license.
//
mod app_plugin;
pub mod entity;
mod user_plugin;
2 years ago
use chrono::DateTime;
use sea_orm::EntityTrait;
use serde::{Deserialize, Serialize};
3 years ago
use tracing::info;
pub use app_plugin::{AUStatus, AppJoin};
pub use entity::{access, app, app_user, role, user, user_role};
pub use user_plugin::{rand_str, AccessCore, AccessLevel, Token, UserPlugin};
3 years ago
use crate::AppState;
3 years ago
pub async fn init(data: AppState) {
info!("init database");
sqlx::migrate!().run(data.sqlx()).await.unwrap();
3 years ago
}
2 years ago
#[derive(Debug, Deserialize, Serialize)]
pub struct UnionAppUser {
pub created: Option<chrono::NaiveDateTime>,
pub updated: Option<chrono::NaiveDateTime>,
pub app: Option<app::Model>,
pub user: Option<user::Model>,
pub app_id: String,
pub user_id: String,
pub status: i32,
}