This commit is contained in:
2026-07-25 01:17:19 +02:00
parent 62f7c6edba
commit b54b60c988
12 changed files with 224 additions and 98 deletions
-4
View File
@@ -8,15 +8,12 @@ pub struct CreateCategoryRequest {
pub server_id: Uuid,
#[schema(example = "Discussion")]
pub name: String,
#[serde(default)]
pub position: i32,
}
#[derive(Debug, Serialize, Deserialize, ToSchema)]
pub struct UpdateCategoryRequest {
#[schema(example = "Discussion (Maj)")]
pub name: String,
pub position: i32,
}
#[derive(Debug, Serialize, Deserialize, ToSchema)]
@@ -24,7 +21,6 @@ pub struct CategoryResponse {
pub id: Uuid,
pub server_id: Uuid,
pub name: String,
pub position: i32,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
-3
View File
@@ -10,7 +10,6 @@ pub fn category_model_to_category_response(model: category::Model) -> CategoryRe
id: model.id,
server_id: model.server_id,
name: model.name,
position: model.position,
created_at: model.created_at,
updated_at: model.updated_at,
}
@@ -21,7 +20,6 @@ pub fn create_request_to_am(req: CreateCategoryRequest) -> category::ActiveModel
id: Set(Uuid::new_v4()),
server_id: Set(req.server_id),
name: Set(req.name),
position: Set(req.position),
..Default::default()
}
}
@@ -35,7 +33,6 @@ pub fn update_request_to_am(
id: Set(id),
server_id: Set(server_id),
name: Set(req.name),
position: Set(req.position),
..Default::default()
}
}
-4
View File
@@ -8,8 +8,6 @@ use uuid::Uuid;
pub struct CreateChannelRequest {
pub server_id: Option<Uuid>,
pub category_id: Option<Uuid>,
#[serde(default)]
pub position: i32,
pub channel_type: ChannelType,
#[schema(example = "général")]
pub name: Option<String>,
@@ -19,7 +17,6 @@ pub struct CreateChannelRequest {
pub struct UpdateChannelRequest {
pub server_id: Option<Uuid>,
pub category_id: Option<Uuid>,
pub position: i32,
pub channel_type: ChannelType,
pub name: Option<String>,
}
@@ -29,7 +26,6 @@ pub struct ChannelResponse {
pub id: Uuid,
pub server_id: Option<Uuid>,
pub category_id: Option<Uuid>,
pub position: i32,
pub channel_type: ChannelType,
pub name: Option<String>,
pub created_at: DateTime<Utc>,
-3
View File
@@ -11,7 +11,6 @@ pub fn channel_model_to_channel_response(model: channel::Model) -> ChannelRespon
id: model.id,
server_id: model.server_id,
category_id: model.category_id,
position: model.position,
channel_type: model.channel_type,
name: model.name,
created_at: model.created_at,
@@ -24,7 +23,6 @@ pub fn create_request_to_am(req: CreateChannelRequest) -> channel::ActiveModel {
id: Set(Uuid::new_v4()),
server_id: Set(req.server_id),
category_id: Set(req.category_id),
position: Set(req.position),
channel_type: Set(req.channel_type),
name: Set(req.name),
..Default::default()
@@ -36,7 +34,6 @@ pub fn update_request_to_am(id: Uuid, req: UpdateChannelRequest) -> channel::Act
id: Set(id),
server_id: Set(req.server_id),
category_id: Set(req.category_id),
position: Set(req.position),
channel_type: Set(req.channel_type),
name: Set(req.name),
..Default::default()