From baa7430e3bb19d25f2264571c990f850e67bd969 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Wed, 31 Aug 2022 23:15:34 +0200 Subject: guess at future delays (horrible, incorrect, and unfinished) --- lib/Persist.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/Persist.hs') diff --git a/lib/Persist.hs b/lib/Persist.hs index e463195..371ddd0 100644 --- a/lib/Persist.hs +++ b/lib/Persist.hs @@ -47,6 +47,8 @@ import Data.Vector (Vector) import Database.Persist.Postgresql (SqlBackend) import GHC.Generics (Generic) import Web.PathPieces (PathPiece) +import Fmt + newtype Token = Token UUID deriving newtype @@ -58,13 +60,14 @@ instance ToSchema Token where instance ToParamSchema Token where toParamSchema _ = toParamSchema (Proxy @String) +deriving newtype instance PersistField Seconds +deriving newtype instance PersistFieldSql Seconds +-- deriving newtype instance PathPiece Seconds +-- deriving newtype instance ToParamSchema Seconds + data AmendmentStatus = Cancelled | Added | PartiallyCancelled Int Int deriving (ToJSON, FromJSON, Generic, Show, Read, Eq) derivePersistField "AmendmentStatus" --- instance FromHttpApiData AmendmentStatus where --- parseUrlPiece "Cancelled" = Right Cancelled --- parseUrlPiece "Added" = Right Added --- parseUrlPiece other = Left ("unknown AmendmentStatus: "<>other) share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase| -- | tokens which have been issued @@ -92,8 +95,8 @@ TrainAnchor json sql=tt_trip_anchor trip TripID day Day created UTCTime - when UTCTime - delay Int Maybe + when Seconds + delay Seconds Maybe msg Text Maybe deriving Show Generic Eq ToSchema -- cgit v1.2.3