67 lines
1.8 KiB
Rust
67 lines
1.8 KiB
Rust
use crate::{PermissionsItemDto, PermissionsItemDtoRaw};
|
|
use serde::{Deserialize, Serialize};
|
|
use surrealdb::sql::Thing;
|
|
use utoipa::ToSchema;
|
|
use validator::Validate;
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, ToSchema, Validate)]
|
|
pub struct RolesRequestUpdateDto {
|
|
#[validate(length(min = 1, message = "Role name must not be empty"))]
|
|
pub name: Option<String>,
|
|
pub permissions: Option<Vec<String>>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, ToSchema, Validate)]
|
|
pub struct RolesRequestCreateDto {
|
|
#[validate(length(min = 1, message = "Role name must not be empty"))]
|
|
pub name: String,
|
|
pub permissions: Vec<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, ToSchema)]
|
|
pub struct RolesItemListDto {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub created_at: Option<String>,
|
|
pub updated_at: Option<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, ToSchema)]
|
|
pub struct RolesItemDto {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub permissions: Vec<PermissionsItemDto>,
|
|
pub created_at: Option<String>,
|
|
pub updated_at: Option<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, ToSchema)]
|
|
pub struct RolesItemByIdDto {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub is_deleted: bool,
|
|
pub permissions: Vec<PermissionsItemDto>,
|
|
pub created_at: Option<String>,
|
|
pub updated_at: Option<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct RolesItemByIdDtoRaw {
|
|
pub id: Thing,
|
|
pub name: String,
|
|
pub permissions: Vec<PermissionsItemDtoRaw>,
|
|
pub is_deleted: bool,
|
|
pub created_at: Option<String>,
|
|
pub updated_at: Option<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct RolesItemDtoRaw {
|
|
pub id: Thing,
|
|
pub name: String,
|
|
pub permissions: Vec<PermissionsItemDtoRaw>,
|
|
pub is_deleted: bool,
|
|
pub created_at: Option<String>,
|
|
pub updated_at: Option<String>,
|
|
}
|