53 lines
1.4 KiB
Haskell
53 lines
1.4 KiB
Haskell
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
|
|
|
module Model
|
|
( module Model
|
|
, module Model.Types
|
|
, module Cron.Types
|
|
) where
|
|
|
|
import Import.NoModel
|
|
import Database.Persist.Quasi
|
|
import Database.Persist.TH.Directory
|
|
-- import Data.Time
|
|
-- import Data.ByteString
|
|
import Model.Types hiding (_maxPoints, _passingPoints)
|
|
import Cron.Types
|
|
|
|
import Data.Aeson (Value)
|
|
|
|
import Data.CaseInsensitive (CI, original)
|
|
import Data.CaseInsensitive.Instances ()
|
|
|
|
import Utils.Message (MessageStatus)
|
|
|
|
import Settings.Cluster (ClusterSettingsKey)
|
|
|
|
import Text.Blaze (ToMarkup(..))
|
|
|
|
|
|
-- You can define all of your database entities in the entities file.
|
|
-- You can find more information on persistent and how to declare entities
|
|
-- at:
|
|
-- http://www.yesodweb.com/book/persistent/
|
|
share [mkPersist sqlSettings, mkDeleteCascade sqlSettings, mkMigrate "migrateAll'", mkSave "currentModel"]
|
|
$(persistDirectoryWith lowerCaseSettings "models")
|
|
|
|
|
|
submissionRatingDone :: Submission -> Bool
|
|
submissionRatingDone Submission{..} = isJust submissionRatingTime
|
|
|
|
-- ToMarkup and ToMessage instances for displaying selected database primary keys
|
|
|
|
instance ToMarkup (Key School) where
|
|
toMarkup = toMarkup . unSchoolKey
|
|
|
|
instance ToMessage (Key School) where
|
|
toMessage = original . unSchoolKey
|
|
|
|
instance ToMarkup (Key Term) where
|
|
toMarkup = toMarkup . termToText . unTermKey
|
|
|
|
instance ToMessage (Key Term) where
|
|
toMessage = termToText . unTermKey
|