Z3MK2PJ5U222DXRS22WCDHVPZ7HVAR3HOCUNXIGX6VMEPBQDF6PQC
5OI44E4EEVYOMHDWNK2WA7K4L4JWRWCUJUNN2UAUGE5VY4W7GTNAC
NLZ3JXLOOIL37O3RRQWXHNPNSNEOOLPD6MCB754BEBECQB3KGR2AC
A6HKMINBNGQLLX4QJMYWKQ4JAEHVJ4HIRVDKPPDI3FJUO2AAB7OQC
W35DDBFYF6Z4ZPCFEO5RPAONZLYCSNTXUSTS6FIUUVZHCI6Q7GHAC
HALRDT2F22DAQ54M334YSKD2XJCAXDXEZPDKGMOWKH7XELBAS6MAC
Z7KS5XHHC6PAMTVBHXY7KUSS3BWAOU6FSYIITUCFOOJZU4OUJHBAC
GCVQD44VRPQVKPZEPIC4AOIXLJIG2ZMV3QI2Y7KALUT6NVUBSGSAC
7HPY3QPFPN35PSPUBVNW2GTFB3CBQZBST4J2BAVJ7QMXLIUN52JAC
KEP5WUFJXTMKRRNZLYTGYYWA4VLFCMHTKTJYF5EA5IWBYFMU6WYQC
NEDDHXUK3GNFMOFO3KLU7NRIHCTYNWBT3D6HTKZAOXFDE6HMDZ6AC
QMRKFEPGFBCEWAIXPEIG5ILKAJ2JH5L3TOITHR4HNJXK5FN3KXBQC
I2KHGVD44KT4MQJXGCTVSQKMBO6TVCY72F26TLXGWRL6PHGF6RNQC
2XQD6KKKD6QVHFHAEMVE3XXY7X2T7BLTLL7XIILZAXNJJH2YONUQC
RPAJLHMTUJU4AYNBOHVGHGGB4NY2NLY3BVPYN5FMWB3ZIMAUQHCQC
ADMKQQGCGVSHHIMVQ4XFRDCG544SBJCYALSKZV45CQQBZ4ACUH2AC
, "initiator" .= tshow (p ^. (initiator._UserId))
, "initiator" .= tshow (p ^. (P.initiator._UserId))
]
auctionJSON :: Auction -> Value
auctionJSON x = v1 $
object [ "projectId" .= tshow (x ^. (A.projectId._ProjectId))
, "initiator" .= tshow (x ^. (A.initiator._UserId))
, "raiseAmount" .= (x ^. (raiseAmount._Satoshi))
auctionGetHandler :: Handler App App Auction
auctionGetHandler = do
uid <- requireUserId
aid <- requireAuctionId
maybeAuc <- snapEval $ findAuction aid uid
maybe (snapError 404 $ "Auction not found for id " <> tshow aid) pure maybeAuc
requireAuctionId :: MonadSnap m => m AuctionId
requireAuctionId = do
maybeAid <- parseParam "auctionId" aidParser
maybe (snapError 400 "Value of parameter \"auctionId\" cannot be parsed as a valid UUID")
pure
maybeAid
where
aidParser = do
bs <- takeByteString
pure $ AuctionId <$> fromASCIIBytes bs