Rebuild owner endpoints

This commit is contained in:
Rene Vergara 2023-05-09 11:03:26 -05:00
parent a201810134
commit d67d1937f5
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
1 changed files with 32 additions and 2 deletions

View File

@ -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