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, pub permissions: Option>, } #[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, } #[derive(Clone, Debug, Serialize, Deserialize, ToSchema)] pub struct RolesItemListDto { pub id: String, pub name: String, pub created_at: Option, pub updated_at: Option, } #[derive(Clone, Debug, Serialize, Deserialize, ToSchema)] pub struct RolesItemDto { pub id: String, pub name: String, pub permissions: Vec, pub created_at: Option, pub updated_at: Option, } #[derive(Clone, Debug, Serialize, Deserialize, ToSchema)] pub struct RolesItemByIdDto { pub id: String, pub name: String, pub is_deleted: bool, pub permissions: Vec, pub created_at: Option, pub updated_at: Option, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct RolesItemByIdDtoRaw { pub id: Thing, pub name: String, pub permissions: Vec, pub is_deleted: bool, pub created_at: Option, pub updated_at: Option, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct RolesItemDtoRaw { pub id: Thing, pub name: String, pub permissions: Vec, pub is_deleted: bool, pub created_at: Option, pub updated_at: Option, }