JKMHA2QGDSVHD4DKDYQUYNJJ3LUQCOPOWEC3543BDWDXLYIBBZXQC
TLQ72DSJD7GGPWN6HGBHAVPBRQFKEQ6KSK43U7JWWID4ZWAF47JAC
EMVTF2IWNQGRL44FC4JNG5FYYQTZSFPNM6SOM7IAEH6T7PPK2NVAC
64C6AWH66FDKU6UE6Z6JPX2J2GBM2JOPTH2GL6LHKAIUBGNGDZ5AC
75N3UJ4JK56KXF56GASGPAWLFYGJDETVJNYTF4KXFCQM767JUU5AC
LUM4VQJIHJKQWWD5NVWTVSNPKQTMGQQICTFOTM6W4BMME2G3G5RQC
MWUPXTBF2LATVOJLJTXSDFB3OMFGMXDNETWJA3JHUOUBTUJ7WJAAC
LAROLAYUGJ4Q5AEFV5EJMIA2ZKBNCBWHHHPCJ3CKCNIUIYUKRFVQC
WO2MINIF4TXOHWSE7JWXRZYN64XRVLYIRFMF4SMPSOXKA2V77KMQC
newtype PBid = PBid Bid
makePrisms ''PBid
instance FromRow PBid where
fromRow =
let bidParser = Bid <$> fmap UserId field <*> fmap Seconds field <*> fmap BTC field <*> field
in fmap PBid bidParser
newtype PSeconds = PSeconds Seconds
instance ToField PSeconds where
toField (PSeconds (Seconds i)) = toField i
newtype PUserId = PUserId UserId
instance ToField PUserId where
toField (PUserId (UserId i)) = toField i
newtype PAuctionId = PAuctionId AuctionId
instance ToField PAuctionId where
toField (PAuctionId (AuctionId i)) = toField i
newtype PBTC = PBTC BTC
instance ToField PBTC where
toField (PBTC (BTC i)) = toField i
readBids' :: AuctionId -> ReaderT Connection IO [(UTCTime, Bid)]
readBids' = undefined
readBids' :: AuctionId -> ReaderT Connection IO [Bid]
readBids' aucId = do
conn <- ask
rows <- lift $ query conn
"SELECT user_id, bid_seconds, bid_amount, bid_time FROM bids WHERE auction_id = ?"
(Only $ PAuctionId aucId)
lift . return $ fmap (^. _PBid) rows
makeLenses ''User