Skip to content

Commit

Permalink
fix: Remove inheritance from reference
Browse files Browse the repository at this point in the history
  • Loading branch information
parksb committed Feb 10, 2021
1 parent a38f3e4 commit 79b3cfc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 7 additions & 3 deletions api-gateway/src/models/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -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<String>,
pub content: Option<String>,
pub date: Option<NaiveDateTime>,
}

/// Post DTO using between api gateway and the service.
Expand Down
16 changes: 6 additions & 10 deletions api-gateway/src/routes/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,9 @@ pub async fn create_post(session: Session, args: web::Json<CreateArgs>) -> impl
date,
} = args.into_inner();
ServiceCreateArgs {
create_args: CreateArgs {
title,
content,
date,
},
title,
content,
date,
user_id: user_session.user_id,
}
};
Expand Down Expand Up @@ -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,
}
};
Expand Down

0 comments on commit 79b3cfc

Please sign in to comment.