Change to use UUIDs instead of ints for primary keys.
[?]
May 12, 2015, 11:43 PM
RPAJLHMTUJU4AYNBOHVGHGGB4NY2NLY3BVPYN5FMWB3ZIMAUQHCQCDependencies
- [2]
4SCFOJGNSpecs for recovering intervals from the log now pass. - [3]
O5FVTOM6Undo JSON silliness, enable a couple more routes. - [4]
BROSTG5KBeginning of modularization of server. - [5]
7KZP4RHZSwitch from Data.Time to Data.Thyme - [6]
LAROLAYUWIP - [7]
FD7SV5I6Fix handling of event_t columns. - [8]
TNR3TEHKSwitch to Postgres + snaplet arch compiles. - [9]
NVOCQVASInitial failing tests. - [10]
RSEB2NFGReplacing Snap with Scotty. - [11]
VJPT6HDRFix remaining type errors after addition of login handler. - [12]
PBD7LZYQPostgres & auth are beginning to function. - [13]
XTBSG4C7Adding serveJSON combinator to eliminate some boilerplate from handlers. - [14]
TCOAKCGGCompleted conversion to snap. - [15]
HE3JTXO3Added client call to payouts. - [16]
GKGVYBZGAdded JSON serialization to TimeLog - [17]
5DRIWGLUImproving TimeLog specs - [18]
NJZ3DKZYTHEY CAN TALK! - [19]
EMVTF2IWWIP moving back to snap. - [20]
I2KHGVD4Require project permissions for access to most data. - [21]
A6HKMINBAttempting to improve JSON handling. - [22]
75N3UJ4JMore progression toward lenses. - [23]
TLQ72DSJLenses, sqlite-simple - [24]
KNSI575VCleanup of EventLog types. - [25]
7DBNV3GVInitial, stack-based impl of time log event reduction. - [26]
W35DDBFYFactor common JSON conversions up into client lib module. - [27]
MWUPXTBFA few steps down a road to be abandoned. - [28]
IZEVQF62Work in progress replacing sqlite with postgres. - [29]
OBFPJS2GProject successfully builds and tests under nix. - [30]
4IQVQL4TAdded client for payouts endpoint. - [31]
SLL7262CMake depreciation functions more flexible. - [32]
2G3GNDDUEvent logging is now functioning in postgres. - [33]
Z7KS5XHHVery WIP. Wow. - [34]
Y35QCWYWMinor improvement in WorkIndex type to eliminate duplicated information. - [35]
64C6AWH6Rename Ananke -> Quixotic, project reboot. - [36]
Z3M53KTLAdrift. - [37]
EZQG2APBUpdate task list. - [38]
WO2MINIFAuctions now compile! - [39]
2Y2QZFVFSwitch to more modern cabal2nix-based workflow. - [*]
5XFJNUAZStart of addition of project infrastructure. - [*]
EQXRXRZDChanged to use tasty instead of test-framework - [*]
SCXG6TJWMake log reduction safer in presence of overlapping events. - [*]
7XN3I3QJAdd 'loggedIntervals' endpoint. - [*]
WZUHEZSBStart of migration back toward snap. - [*]
ADMKQQGCInitial empty Snap project.
Change contents
- edit in lib/Quixotic/Auction.hs at line 8
import Data.UUID - replacement in lib/Quixotic/Auction.hs at line 13
newtype AuctionId = AuctionId Int64 deriving (Show, Eq)newtype AuctionId = AuctionId UUID deriving (Show, Eq) - edit in lib/Quixotic/Database/PostgreSQL.hs at line 23
import Quixotic.Interval - edit in lib/Quixotic/Database/PostgreSQL.hs at line 112
newtype PUTCTime = PUTCTime C.UTCTimeinstance ToField PUTCTime wheretoField (PUTCTime t) = toField $ fromThyme t - replacement in lib/Quixotic/Database/PostgreSQL.hs at line 166
, fromThyme $ eventTime e, fromThyme $ e ^. eventTime - edit in lib/Quixotic/Database/PostgreSQL.hs at line 171
findEvents' :: ProjectId -> UserId -> Interval' -> QDBM [LogEntry]findEvents' (ProjectId pid) (UserId uid) ival =let q (Before e) = pquery"SELECT btc_addr, event_type, event_time, event_metadata FROM work_events \\WHERE project_id = ? AND user_id = ? AND event_time <= ?"(pid, uid, PUTCTime e)q (During s e) = pquery"SELECT btc_addr, event_type, event_time, event_metadata FROM work_events \\WHERE project_id = ? AND user_id = ? \\AND event_time >= ? AND event_time <= ?"(pid, uid, PUTCTime s, PUTCTime e)q (After s) = pquery"SELECT btc_addr, event_type, event_time, event_metadata FROM work_events \\WHERE project_id = ? AND user_id = ? AND event_time >= ?"(pid, uid, PUTCTime s)in fmap pLogEntry <$> q ival - replacement in lib/Quixotic/Database/PostgreSQL.hs at line 207
"SELECT btc_addr, event_type, event_time, event_metadata from work_events WHERE project_id = ?""SELECT btc_addr, event_type, event_time, event_metadata FROM work_events WHERE project_id = ?" - edit in lib/Quixotic/Database/PostgreSQL.hs at line 296
, findEvents = findEvents' - edit in lib/Quixotic/Database.hs at line 10
import Quixotic.Interval - edit in lib/Quixotic/Database.hs at line 28
, findEvents :: ProjectId -> UserId -> Interval' -> m [LogEntry] - edit in lib/Quixotic/Interval.hs at line 5
, Interval'(..), interval', start', end' - edit in lib/Quixotic/Interval.hs at line 23
data Interval' = Before { _end' :: C.UTCTime }| During { _start' :: C.UTCTime, _end' :: C.UTCTime }| After { _start' :: C.UTCTime } - edit in lib/Quixotic/Interval.hs at line 29
makeLenses ''Interval' - edit in lib/Quixotic/Interval.hs at line 34
interval' :: C.UTCTime -> C.UTCTime -> Interval'interval' s e = if s < e then During s e else During e s - replacement in lib/Quixotic/Json.hs at line 63
object [ "projectId" .= (qp ^. (projectId._ProjectId))object [ "projectId" .= (tshow $ qp ^. (projectId._ProjectId)) - replacement in lib/Quixotic/Json.hs at line 71
, "initiator" .= (p ^. (initiator._UserId)) ], "initiator" .= (tshow $ p ^. (initiator._UserId)) ] - edit in lib/Quixotic/Json.hs at line 86
logEntryJSON :: LogEntry -> ValuelogEntryJSON (LogEntry a ev m) =object [ "btcAddr" .= (a ^. _BtcAddr), "eventType" .= eventName ev, "eventTime" .= (ev ^. eventTime), "eventMeta" .= m] - replacement in lib/Quixotic/TimeLog.hs at line 8
, eventName, nameEvent, eventName, nameEvent, eventTime - replacement in lib/Quixotic/TimeLog.hs at line 37
data LogEvent = StartWork { eventTime :: C.UTCTime }| StopWork { eventTime :: C.UTCTime }data LogEvent = StartWork { _eventTime :: C.UTCTime }| StopWork { _eventTime :: C.UTCTime } - replacement in lib/Quixotic/TimeLog.hs at line 40
makePrisms ''LogEventmakeLenses ''LogEvent - edit in lib/Quixotic.hs at line 8
import Data.UUID - replacement in lib/Quixotic.hs at line 17
newtype UserId = UserId Int64 deriving (Show, Eq)newtype UserId = UserId UUID deriving (Show, Eq) - replacement in lib/Quixotic.hs at line 30
newtype ProjectId = ProjectId Int64 deriving (Show, Eq)newtype ProjectId = ProjectId UUID deriving (Show, Eq) - replacement in payouts/Main.hs at line 38
cfg <- C.load [C.Required (fpToString cfgFile)]cfg <- C.load [C.Required cfgFile] - replacement in quixotic.cabal at line 32[4.1607]→[4.1607:1650](∅→∅),[4.1667]→[4.1667:1742](∅→∅),[4.1742]→[4.1104:1143](∅→∅),[4.1143]→[4.1214:1252](∅→∅)
base >= 4 && < 5, classy-prelude >= 0.10.1, aeson >= 0.8.0.2, attoparsec >= 0.12.1.2, base64-bytestring >= 1.0.0.1base >= 4 && < 5, classy-prelude >= 0.10.1, aeson >= 0.8.0.2, attoparsec >= 0.12.1.2, base64-bytestring >= 1.0.0.1 - replacement in quixotic.cabal at line 38
, blaze-builder, blaze-builder - replacement in quixotic.cabal at line 40[4.1161]→[4.1780:1818](∅→∅),[4.3089]→[4.1780:1818](∅→∅),[4.1780]→[4.1780:1818](∅→∅),[4.1818]→[4.1014:1047](∅→∅),[4.1047]→[4.1818:1854](∅→∅),[4.1818]→[4.1818:1854](∅→∅),[4.5084]→[4.5084:5120](∅→∅),[4.5120]→[4.1282:1474](∅→∅)
, containers >= 0.5.5.1, configurator, either >= 4.3.1, errors >= 1.4.7, groups >= 0.4, heaps >= 0.3.1, hourglass >= 0.2.6 && < 0.3, lens >= 4.4.0.2, network-bitcoin >= 1.7.0, containers >= 0.5.5.1, configurator, either >= 4.3.1, errors >= 1.4.7, groups >= 0.4, heaps >= 0.3.1, hourglass >= 0.2.6 && < 0.3, lens >= 4.4.0.2, network-bitcoin >= 1.7.0 - replacement in quixotic.cabal at line 50
, postgresql-simple >= 0.4.9 && < 0.5, safe >= 0.3.8, postgresql-simple >= 0.4.9 && < 0.5, safe >= 0.3.8 - replacement in quixotic.cabal at line 53
, sqlite-simple >= 0.4.8 && < 0.5, sqlite-simple >= 0.4.8 && < 0.5 - replacement in quixotic.cabal at line 55[4.1599]→[4.1947:1981](∅→∅),[4.5169]→[4.1947:1981](∅→∅),[4.7351]→[4.1947:1981](∅→∅),[4.1947]→[4.1947:1981](∅→∅),[4.1981]→[4.2850:2886](∅→∅)
, text >= 1.2, thyme >= 0.3.5, text >= 1.2, thyme >= 0.3.5, uuid >= 1.3.10 - edit in quixotic.cabal at line 105
, iso8601-time - replacement in server/Main.hs at line 50
initCookieSessionManager (fpToString authSiteKey) "quookie" cookieTimeoutinitCookieSessionManager authSiteKey "quookie" cookieTimeout - replacement in server/Main.hs at line 58
loggedIntervalsRoute = serveJSON workIndexJSON $ method GET loggedIntervalsHandlerlogEntriesRoute = serveJSON (fmap logEntryJSON) $ method GET logEntriesHandlerlogIntervalsRoute = serveJSON workIndexJSON $ method GET loggedIntervalsHandler--amendEventRoute = void $ method PUT amendEventHandler - edit in server/Main.hs at line 70
--, ("events/:eventId/amend", amendEventHandler), - replacement in server/Main.hs at line 72
, ("projects/:projectId/logEnd/:btcAddr", logEventRoute StopWork), ("projects/:projectId/log/:btcAddr", loggedIntervalsRoute), ("projects/:projectId", projectRoute), ("projects", listProjectsRoute), ("projects/:projectId/logEnd/:btcAddr", logEventRoute StopWork), ("projects/:projectId/logEntries", logEntriesRoute), ("projects/:projectId/intervals", logIntervalsRoute) - replacement in server/Main.hs at line 76
, ("payouts/:projectId", payoutsRoute), ("projects", listProjectsRoute), ("projects/:projectId", projectRoute), ("projects/:projectId/payouts", payoutsRoute) - replacement in server/Main.hs at line 84
cfg <- C.load [C.Required (fpToString cfgFile)]cfg <- C.load [C.Required cfgFile] - replacement in server/Main.hs at line 91
<*> (fmap fpFromText $ C.require cfg "siteKey")<*> C.require cfg "siteKey" - replacement in server/Quixotic/Snaplet/Auth.hs at line 41
requireProjectAccess :: UserId -> Handler App App ProjectIdrequireProjectAccess uid = dorequireProjectAccess :: Handler App App (UserId, ProjectId)requireProjectAccess = do - edit in server/Quixotic/Snaplet/Auth.hs at line 48
uid <- requireUserId - replacement in server/Quixotic/Snaplet/Auth.hs at line 51
then pure pidthen pure (uid, pid) - replacement in server/Quixotic/Snaplet/Projects.hs at line 43
uid <- requireUserIdpid <- requireProjectAccess uidpid <- fmap snd requireProjectAccess - file addition: Util.hs[4.182]
module Quixotic.Snaplet.Util whereimport ClassyPreludeimport Control.Monad.Trans.Maybeimport Data.ByteString.Char8 as Bimport Data.Time.ISO8601import Data.Thyme.Timeimport Data.Thyme.Clock as Cimport Snap.CoretimeParam :: MonadSnap m => ByteString -> m (Maybe C.UTCTime)timeParam k = runMaybeT $ dobs <- MaybeT $ getParam kt <- MaybeT . pure . parseISO8601 $ B.unpack bspure $ toThyme t - edit in server/Quixotic/Snaplet/WorkLog.hs at line 12
import Quixotic.Interval - edit in server/Quixotic/Snaplet/WorkLog.hs at line 17
import Quixotic.Snaplet.Util - replacement in server/Quixotic/Snaplet/WorkLog.hs at line 26
uid <- requireUserIdpid <- requireProjectAccess uid(uid, pid) <- requireProjectAccess - replacement in server/Quixotic/Snaplet/WorkLog.hs at line 31
storeEv addr = runReaderT . createEvent pid uid $ logEntry addrstoreEv addr = runReaderT . createEvent pid uid $ logEntry addr - replacement in server/Quixotic/Snaplet/WorkLog.hs at line 39
uid <- requireUserIdpid <- requireProjectAccess uidpid <- fmap snd requireProjectAccess - edit in server/Quixotic/Snaplet/WorkLog.hs at line 42
logEntriesHandler :: Handler App App [LogEntry]logEntriesHandler = doQDB{..} <- view qdb <$> with qm get(uid, pid) <- requireProjectAccessendpoints <- (,) <$> timeParam "after" <*> timeParam "before"ival <- case endpoints of(Just s, Just e) -> pure $ During s e(Nothing, Just e) -> pure $ Before e(Just s, Nothing) -> pure $ After s(Nothing, Nothing) -> snapError 400 $ "You must at least one of the \"after\" or \"before\" query parameter"liftPG . runReaderT $ findEvents pid uid ival - replacement in server/Quixotic/Snaplet/WorkLog.hs at line 57
uid <- requireUserIdpid <- requireProjectAccess uidpid <- fmap snd requireProjectAccess - edit in server/Quixotic/Snaplet/WorkLog.hs at line 62[4.3782]
-- amendEventHandler :: Handler App App AmendmentId