91 lines
1.5 KiB
Rust
91 lines
1.5 KiB
Rust
use super::schema::resources;
|
|
use beteran_common_rust as bcr;
|
|
|
|
///
|
|
#[derive(Eq, Hash, Identifiable, Queryable, PartialEq, Debug, Clone)]
|
|
#[table_name = "resources"]
|
|
pub struct Resource {
|
|
///
|
|
pub id: uuid::Uuid,
|
|
///
|
|
pub parent_id: Option<uuid::Uuid>,
|
|
///
|
|
pub name: String,
|
|
///
|
|
pub key: String,
|
|
///
|
|
pub description: String,
|
|
///
|
|
pub can_use: bool,
|
|
///
|
|
pub created_at: i64,
|
|
///
|
|
pub updated_at: i64,
|
|
}
|
|
|
|
///
|
|
#[derive(Insertable, Debug, Clone)]
|
|
#[table_name = "resources"]
|
|
pub struct NewResource {
|
|
///
|
|
pub parent_id: Option<uuid::Uuid>,
|
|
///
|
|
pub name: String,
|
|
///
|
|
pub key: String,
|
|
///
|
|
pub description: String,
|
|
///
|
|
pub can_use: bool,
|
|
}
|
|
|
|
///
|
|
#[derive(AsChangeset, Debug, Clone)]
|
|
#[table_name = "resources"]
|
|
pub struct ModifyResource {
|
|
///
|
|
pub parent_id: Option<uuid::Uuid>,
|
|
///
|
|
pub name: String,
|
|
///
|
|
pub key: String,
|
|
///
|
|
pub description: String,
|
|
///
|
|
pub can_use: bool,
|
|
}
|
|
|
|
///
|
|
#[derive(AsChangeset, Debug, Clone)]
|
|
#[table_name = "resources"]
|
|
pub struct ModifyResource4CanUse {
|
|
///
|
|
pub can_use: bool,
|
|
}
|
|
|
|
///
|
|
#[derive(Debug, Clone)]
|
|
pub struct FindAllSearch {
|
|
///
|
|
pub parent_id: Option<uuid::Uuid>,
|
|
///
|
|
pub name_like: Option<String>,
|
|
///
|
|
pub key_like: Option<String>,
|
|
///
|
|
pub description_like: Option<String>,
|
|
///
|
|
pub can_use: Option<bool>,
|
|
}
|
|
|
|
///
|
|
#[derive(Debug, Clone)]
|
|
pub struct FindAll {
|
|
///
|
|
pub search: Option<FindAllSearch>,
|
|
///
|
|
pub pagination: Option<bcr::models::pagination::Pagination>,
|
|
///
|
|
pub sorts: Option<Vec<bcr::models::pagination::Sort>>,
|
|
}
|