From d67d1937f5afb0b095ba74f2a605e384776f9f18 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 9 May 2023 11:03:26 -0500 Subject: [PATCH] Rebuild owner endpoints --- src/ZGoBackend.hs | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/ZGoBackend.hs b/src/ZGoBackend.hs index 6cb8276..f74084e 100644 --- a/src/ZGoBackend.hs +++ b/src/ZGoBackend.hs @@ -918,7 +918,22 @@ routes pipe config = do Web.Scotty.json (object [ "message" .= ("Owner found!" :: String) - , "owner" .= toJSON (q :: Owner) + , "owner" .= + object + [ "_id" .= (show $ o_id q :: String) + , "address" .= oaddress q + , "name" .= oname q + , "currency" .= ocurrency q + , "tax" .= otax q + , "taxValue" .= otaxValue q + , "vat" .= ovat q + , "vatValue" .= ovatValue q + , "paid" .= opaid q + , "zats" .= ozats q + , "invoices" .= oinvoices q + , "expiration" .= oexpiration q + , "crmToken" .= ocrmToken q + ] ]) get "/api/ownerid" $ do id <- param "id" @@ -934,7 +949,22 @@ routes pipe config = do Web.Scotty.json (object [ "message" .= ("Owner found!" :: String) - , "owner" .= toJSON (q :: Owner) + , "owner" .= + object + [ "_id" .= (show $ o_id q :: String) + , "address" .= oaddress q + , "name" .= oname q + , "currency" .= ocurrency q + , "tax" .= otax q + , "taxValue" .= otaxValue q + , "vat" .= ovat q + , "vatValue" .= ovatValue q + , "paid" .= opaid q + , "zats" .= ozats q + , "invoices" .= oinvoices q + , "expiration" .= oexpiration q + , "crmToken" .= ocrmToken q + ] ]) --Upsert owner to DB post "/api/owner" $ do