Start of migration back toward snap.
[?]
Nov 26, 2014, 7:35 PM
WZUHEZSBRKHQMNWDKVG4X6DDIQEAXTGI6IGAJ5ERPRQ3W2KUMX4QCDependencies
- [2]
Z3M53KTLAdrift. - [3]
ADMKQQGCInitial empty Snap project. - [4]
64VI73NPServer now compiles using abstracted SQLite - [5]
RSEB2NFGReplacing Snap with Scotty. - [6]
64C6AWH6Rename Ananke -> Quixotic, project reboot. - [7]
5W5M56VJMove library code to 'lib' - [*]
EQXRXRZDChanged to use tasty instead of test-framework
Change contents
- replacement in quixotic.cabal at line 8
Maintainer: kris@nutty.langMaintainer: kris@nutty.land - replacement in quixotic.cabal at line 54[3.1863]→[3.1863:2037](∅→∅),[3.2037]→[3.1:30](∅→∅),[3.30]→[3.2037:2091](∅→∅),[3.2037]→[3.2037:2091](∅→∅),[3.2091]→[2.29:81](∅→∅),[2.81]→[3.2091:2273](∅→∅),[3.2091]→[3.2091:2273](∅→∅)
build-depends: quixotic, base, aeson, containers, either, mtl, sqlite, text, time, configurator == 0.2.*, optparse-applicative >= 0.9.0 && < 0.10, bytestring >= 0.9.1 && < 0.11, scotty >= 0.9.0[3.1863]build-depends:quixotic, base >= 4 && < 5, aeson, containers, either, mtl >= 2 && < 3, sqlite, text, time, MonadCatchIO-transformers >= 0.2.1 && < 0.4, configurator == 0.2.*, optparse-applicative >= 0.9.0 && < 0.10, bytestring >= 0.9.1 && < 0.11, snap-core >= 0.9 && < 0.10, snap-server >= 0.9 && < 0.10 - file addition: Api[9.1243]
- file addition: WorkLog.hs[0.547]
module Api.Worklog (resource) whereimport Control.Applicative ((<$>))import Control.Concurrent.STM (atomically, modifyTVar, readTVar)import Control.Monad.Error (throwError)import Control.Monad.Reader (ReaderT, asks)import Control.Monad.Trans (liftIO)import Data.Set (Set)import qualified Data.Foldable as Fimport qualified Data.Set as Setimport qualified Data.Text as Timport Rest (Handler, ListHandler, Range (count, offset), Resource, Void, domainReason, mkInputHandler, mkListing, mkResourceReader, named, singleRead,withListing, xmlJsonE, xmlJsonI, xmlJsonO)import qualified Rest.Resource as Rimport ApiTypes (BlogApi, ServerData (..))import Type.User (User)import Type.UserInfo (UserInfo (..))import Type.UserSignupError (UserSignupError (..))import qualified Type.User as Userimport qualified Type.UserInfo as UserInforesource :: - file addition: Api.hs[9.1243]
module Api (api) whereimport Rest.API - replacement in server/Main.hs at line 19
import Web.Scottyimport Snap.Coreimport Snap.Util.FileServeimport Snap.Http.Server - replacement in server/Main.hs at line 24
main = domain = do - replacement in server/Main.hs at line 28
dbMain cfg db adbquickHttpServe $ site cfg - replacement in server/Main.hs at line 30
data QConfig= QConfigsite :: QConfig -> a -> ADB IO a -> Snap ()site cfg db adb =route [ ("logStart/:btcAddr", handleLogRequest db adb StartWork), ("logEnd/:btcAddr", handleLogRequest db adb StopWork), ("payouts", currentPayouts db adb)]data QConfig = QConfig - edit in server/Main.hs at line 46[2.475]→[2.475:569](∅→∅),[2.569]→[3.1598:1816](∅→∅),[3.1598]→[3.1598:1816](∅→∅),[3.1816]→[3.339:468](∅→∅)
dbMain :: QConfig -> a -> ADB IO a -> IO ()dbMain cfg db adb = doscotty (port cfg) $ do{--Log the start time of a work interval.Log completion of the current work interval.Record change of a work interval start.Record change of a work interval end.Given a trusted token, authorize another token.--}post "/logStart/:btcAddr" $ handleLogRequest db adb StartWorkpost "/logEnd/:btcAddr" $ handleLogRequest db adb StopWork - replacement in server/Main.hs at line 47[3.5696]→[3.469:512](∅→∅),[3.512]→[3.5717:5718](∅→∅),[3.2808]→[3.5717:5718](∅→∅),[3.5717]→[3.5717:5718](∅→∅),[3.5718]→[3.513:587](∅→∅)
get "/payouts" $ currentPayouts db adbhandleLogRequest :: a -> ADB IO a -> (UTCTime -> WorkEvent) -> ActionM ()handleLogRequest :: a -> ADB IO a -> (UTCTime -> WorkEvent) -> Snap () - replacement in server/Main.hs at line 49
BtcAddrParam addr <- param "btcAddr"addrBytes <- getParam "btcAddr"let addr = fmap T.pack addrBytes >>= parseBtcAddr - replacement in server/Main.hs at line 54
currentPayouts :: a -> ADB IO a -> ActionM ()currentPayouts :: a -> ADB IO a -> Snap () - replacement in server/Main.hs at line 59
buildPayoutsResponse :: WorkIndex -> ActionM ()buildPayoutsResponse widx = json . PayoutsResponse $ payouts dep ptime widxbuildPayoutsResponse :: WorkIndex -> Snap ()buildPayoutsResponse widx = writeBS . encode . PayoutsResponse $ payouts dep ptime widx - replacement in server/Main.hs at line 62
payoutsAction :: EitherT T.Text ActionM WorkIndexpayoutsAction :: EitherT T.Text Snap WorkIndex - edit in server/Main.hs at line 66
newtype BtcAddrParam = BtcAddrParam BtcAddr - edit in server/Main.hs at line 67
instance Parsable BtcAddrParam whereparseParam t = maybe (Left "Invalid BTC address") (Right . BtcAddrParam) $ (parseBtcAddr . LT.toStrict) t