52 lines
1.4 KiB
Rust
52 lines
1.4 KiB
Rust
use crate::domain::dto::reaction::ReactionGroupResponse;
|
|
use crate::domain::dto::attachment::AttachmentResponse;
|
|
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>,
|
|
pub attachments: Vec<AttachmentResponse>,
|
|
}
|
|
|
|
#[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>,
|
|
#[serde(default)]
|
|
pub file_ids: Vec<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>,
|
|
}
|