Files
oxspeak_server/src/domain/dto/message.rs
T
2026-08-17 01:12:07 +02:00

48 lines
1.2 KiB
Rust

use crate::domain::dto::reaction::ReactionGroupResponse;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use uuid::Uuid;
#[derive(Debug, Serialize, Deserialize, ToSchema)]
pub struct MessageResponse {
pub id: Uuid,
pub server_id: Option<Uuid>,
pub channel_id: Uuid,
pub user_id: Uuid,
pub content: String,
pub created_at: DateTime<Utc>,
pub updated_at: Option<DateTime<Utc>>,
pub reply_to_id: Option<Uuid>,
pub reactions: Vec<ReactionGroupResponse>,
}
#[derive(Debug, Serialize, ToSchema)]
pub struct MessagePageResponse {
pub messages: Vec<MessageResponse>,
pub oldest_id: Option<Uuid>,
pub newest_id: Option<Uuid>,
pub has_more_before: bool,
pub has_more_after: bool,
}
#[derive(Debug, Serialize, Deserialize, ToSchema)]
pub struct CreateMessageRequest {
pub channel_id: Uuid,
pub content: String,
pub reply_to_id: Option<Uuid>,
}
#[derive(Debug, Serialize, Deserialize, ToSchema)]
pub struct UpdateMessageRequest {
pub content: String,
}
#[derive(Debug, serde::Deserialize, utoipa::IntoParams)]
pub struct MessageQueryParams {
pub channel_id: Uuid,
pub before_id: Option<Uuid>,
pub after_id: Option<Uuid>,
pub limit: Option<u64>,
}