68 lines
1.7 KiB
Rust
68 lines
1.7 KiB
Rust
use crate::models::channel::ChannelType;
|
|
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use utoipa::ToSchema;
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Serialize, Deserialize, ToSchema, utoipa::IntoParams)]
|
|
pub struct ChannelQueryParams {
|
|
pub server_id: Option<Uuid>,
|
|
}
|
|
|
|
impl Default for ChannelQueryParams {
|
|
fn default() -> Self {
|
|
Self { server_id: None }
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, ToSchema)]
|
|
pub struct CreateChannelRequest {
|
|
pub server_id: Option<Uuid>,
|
|
pub category_id: Option<Uuid>,
|
|
pub channel_type: ChannelType,
|
|
#[schema(example = "général")]
|
|
pub name: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, ToSchema)]
|
|
pub struct UpdateChannelRequest {
|
|
pub server_id: Option<Uuid>,
|
|
pub category_id: Option<Uuid>,
|
|
pub channel_type: ChannelType,
|
|
pub name: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, ToSchema)]
|
|
pub struct ChannelResponse {
|
|
pub id: Uuid,
|
|
pub server_id: Option<Uuid>,
|
|
pub category_id: Option<Uuid>,
|
|
pub channel_type: ChannelType,
|
|
pub name: Option<String>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, ToSchema)]
|
|
pub struct SetChannelPermissionRequest {
|
|
/// Bitmask des permissions à appliquer.
|
|
#[schema(example = 15)]
|
|
pub permissions: u64,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, ToSchema)]
|
|
pub struct ChannelUserPermissionResponse {
|
|
pub id: Uuid,
|
|
pub channel_id: Uuid,
|
|
pub user_id: Uuid,
|
|
pub permissions: u64,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, ToSchema)]
|
|
pub struct ChannelRolePermissionResponse {
|
|
pub id: Uuid,
|
|
pub channel_id: Uuid,
|
|
pub role_id: Uuid,
|
|
pub permissions: u64,
|
|
}
|