UILI6PILCRDPZ3XYA54LGIGPSU7ERWNHCE7R3CE64ZEC7ONOEMOQC
BWN72T44GRRZ6K2OPN56FTLNEB7J7AGC7T2U5HSMLEKUPGJP2NUAC
POX3UAMTGCNS3SU5I6IKDNCCSHEAUSFBZ3WCMQ3EXKPNXETOI6BAC
W35DDBFYF6Z4ZPCFEO5RPAONZLYCSNTXUSTS6FIUUVZHCI6Q7GHAC
O722AOKEWXWJPRHGJREU6QPW7HEFPPRETZIAADZ2RMAXHARCNEKAC
NEDDHXUK3GNFMOFO3KLU7NRIHCTYNWBT3D6HTKZAOXFDE6HMDZ6AC
QMRKFEPGFBCEWAIXPEIG5ILKAJ2JH5L3TOITHR4HNJXK5FN3KXBQC
BROSTG5KP3NUNLSYPVQID254TE47E5RKQAKLPIY7PGWETE6JNMTAC
ADMKQQGCGVSHHIMVQ4XFRDCG544SBJCYALSKZV45CQQBZ4ACUH2AC
2XQD6KKKD6QVHFHAEMVE3XXY7X2T7BLTLL7XIILZAXNJJH2YONUQC
RPAJLHMTUJU4AYNBOHVGHGGB4NY2NLY3BVPYN5FMWB3ZIMAUQHCQC
uid <- requireUserId
pid <- requireProjectId
requestBody <- readRequestBody 4096
timestamp <- liftIO C.getCurrentTime
case A.eitherDecode requestBody >>= parseEither (parseLogEntry evCtr) of
Left err -> snapError 400 $ "Unable to parse log entry " <> (tshow requestBody) <> ": " <> tshow err
Right entry -> snapEval $ createEvent pid uid (entry timestamp)
logWorkBTCHandler :: (C.UTCTime -> LogEvent) -> Handler App App EventId
logWorkBTCHandler evCtr = do
recordLogEntryHandler :: Handler App App EventId
recordLogEntryHandler = do
uid <- requireUserId
pid <- requireProjectId
requestBody <- readRequestBody 4096
timestamp <- liftIO C.getCurrentTime
case A.eitherDecode requestBody >>= parseEither parseLogEntry of
Left err -> snapError 400 $ "Unable to parse log entry " <> (tshow requestBody) <> ": " <> tshow err
Right entry -> snapEval $ createEvent pid uid (entry timestamp)
, ("projects/:projectId/logStart/:btcAddr", logWorkRoute StartWork)
, ("projects/:projectId/logEnd/:btcAddr", logWorkRoute StopWork)
, ("projects/:projectId/logWorkEvent", recordLogEntryRoute)
, ("projects/:projectId/logStart", logWorkRoute StartWork)
, ("projects/:projectId/logEnd", logWorkRoute StopWork)
, ("projects/:projectId/logStart/:btcAddr", logWorkBTCRoute StartWork)
, ("projects/:projectId/logEnd/:btcAddr", logWorkBTCRoute StopWork)