From 6d577ddb9f2ecc3571bafcc4e2027d55380c92d6 Mon Sep 17 00:00:00 2001 From: Franklin Date: Tue, 25 Apr 2023 06:36:09 -0400 Subject: [PATCH] Addded update methods to backend api clients --- src/api/backend/mod.rs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/api/backend/mod.rs b/src/api/backend/mod.rs index 6d3b17b..2011b2f 100644 --- a/src/api/backend/mod.rs +++ b/src/api/backend/mod.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; use jl_types::{ - domain::{agent::Agent, contact::Contact, count::Count, location::Location, project::Project}, + domain::{agent::Agent, contact::Contact, count::Count, location::Location, project::Project, unit::Unit}, dto::{ filters::Filter, item::Item, @@ -9,7 +9,7 @@ use jl_types::{ payloads::{ contact::ContactPayload, location::NewLocationPayload, - project::{NewProjectPayload, UpdateProjectPayload}, + project::{NewProjectPayload, UpdateProjectPayload}, unit::UpdateUnitPayload, agent::UpdateAgentPayload, }, project_card::ProjectCardDto, }, @@ -197,6 +197,18 @@ pub async fn create_location(location: NewLocationPayload) -> Result Result { + perform_request_without_client( + BASE_URL.into(), + Method::PUT, + format!("admin/agent"), + Some(agent), + 200, + Vec::new(), + None, + ) + .await +} pub async fn update_project(project: UpdateProjectPayload) -> Result { perform_request_without_client( @@ -211,6 +223,19 @@ pub async fn update_project(project: UpdateProjectPayload) -> Result Result { + perform_request_without_client( + BASE_URL.into(), + Method::PUT, + format!("admin/unit"), + Some(unit), + 200, + Vec::new(), + None, + ) + .await +} + pub async fn delete_project(project_id: &Uuid) -> Result<(), err::Error> { perform_request_without_client::( BASE_URL.into(),