summaryrefslogtreecommitdiffstats
path: root/service-person
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-10-24 13:07:01 +0200
committerMatthias Beyer <mail@beyermatthias.de>2021-10-24 13:25:02 +0200
commit6f565074be9c4ef6c77145adb6139f63e48cd9e9 (patch)
tree298ba5f2d27481a29438b325ec376e70e248a941 /service-person
parent968dabc3653b7c19327021befb8b05ae806362fa (diff)
Outsource API type definitions to library crate
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'service-person')
-rw-r--r--service-person/Cargo.toml3
-rw-r--r--service-person/src/main.rs17
2 files changed, 4 insertions, 16 deletions
diff --git a/service-person/Cargo.toml b/service-person/Cargo.toml
index 833bdd2..9740298 100644
--- a/service-person/Cargo.toml
+++ b/service-person/Cargo.toml
@@ -12,3 +12,6 @@ serde = "1"
diesel = { version = "1.4.4", features = ["postgres", "r2d2"] }
diesel_migrations = "1.4"
getset = "0.1"
+
+person-api-types = { path = "./../person-api-types" }
+
diff --git a/service-person/src/main.rs b/service-person/src/main.rs
index 31050e0..75964b0 100644
--- a/service-person/src/main.rs
+++ b/service-person/src/main.rs
@@ -13,25 +13,10 @@ mod model;
mod schema;
use crate::db::DbPool;
+use person_api_types::v1::person::*;
embed_migrations!("migrations");
-#[derive(Debug, serde::Deserialize)]
-pub struct PersonCreateRequestData {
- name: String,
- age: i32,
-
- country: String,
- city: String,
- street: String,
- number: i32,
-}
-
-#[derive(Debug, serde::Serialize)]
-pub struct PersonCreateResponse {
- id: i32
-}
-
async fn create_person(db: web::Data<DbPool>, person: web::Json<PersonCreateRequestData>) -> impl Responder {
log::debug!("Creating person = {:?}", person);