From 79b3cfc1e82ad898045017d25fe79880a3624426 Mon Sep 17 00:00:00 2001 From: parksb Date: Wed, 10 Feb 2021 17:29:31 +0900 Subject: [PATCH] fix: Remove inheritance from reference --- api-gateway/src/models/post.rs | 10 +++++++--- api-gateway/src/routes/post.rs | 16 ++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api-gateway/src/models/post.rs b/api-gateway/src/models/post.rs index fe88e9d..8e0a619 100644 --- a/api-gateway/src/models/post.rs +++ b/api-gateway/src/models/post.rs @@ -2,7 +2,7 @@ use chrono::NaiveDateTime; use serde::{Deserialize, Serialize}; /// Arguments for `POST /posts` API. -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Deserialize)] pub struct CreateArgs { pub title: String, pub content: String, @@ -12,8 +12,10 @@ pub struct CreateArgs { /// Arguments for `POST /posts` API of the service. #[derive(Serialize, Deserialize)] pub struct ServiceCreateArgs { - pub create_args: CreateArgs, pub user_id: u64, + pub title: String, + pub content: String, + pub date: NaiveDateTime, } /// Arguments for `PATCH /posts/:id` API. @@ -27,8 +29,10 @@ pub struct UpdateArgs { /// Arguments for `PATCH /posts/:id` API of the service. #[derive(Serialize, Deserialize)] pub struct ServiceUpdateArgs { - pub update_args: UpdateArgs, pub user_id: u64, + pub title: Option, + pub content: Option, + pub date: Option, } /// Post DTO using between api gateway and the service. diff --git a/api-gateway/src/routes/post.rs b/api-gateway/src/routes/post.rs index 13b9d4f..96c67e3 100644 --- a/api-gateway/src/routes/post.rs +++ b/api-gateway/src/routes/post.rs @@ -137,11 +137,9 @@ pub async fn create_post(session: Session, args: web::Json) -> impl date, } = args.into_inner(); ServiceCreateArgs { - create_args: CreateArgs { - title, - content, - date, - }, + title, + content, + date, user_id: user_session.user_id, } }; @@ -236,11 +234,9 @@ pub async fn update_post( date, } = args.into_inner(); ServiceUpdateArgs { - update_args: UpdateArgs { - title, - content, - date, - }, + title, + content, + date, user_id: user_session.user_id, } };