aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-01-23 13:58:00 +0000
committerGregor Kleen <gkleen@yggdrasil.li>2016-01-23 13:58:00 +0000
commit19df7b59fef57b75d6dc6d23dc0cd0c79bc39028 (patch)
tree7be381fac2c277da707f58e49bc7785aee844693 /server/src
parent1c0ff2e51ba225617b17d7c26b64c89021cf8e83 (diff)
downloadthermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.tar
thermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.tar.gz
thermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.tar.bz2
thermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.tar.xz
thermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.zip
JobStatus in database is bad design
Diffstat (limited to 'server/src')
-rw-r--r--server/src/Thermoprint/Server/Database.hs9
-rw-r--r--server/src/Thermoprint/Server/Database/Instances.hs2
2 files changed, 8 insertions, 3 deletions
diff --git a/server/src/Thermoprint/Server/Database.hs b/server/src/Thermoprint/Server/Database.hs
index 65bfc37..29732e1 100644
--- a/server/src/Thermoprint/Server/Database.hs
+++ b/server/src/Thermoprint/Server/Database.hs
@@ -4,6 +4,7 @@
4{-# LANGUAGE TypeFamilies #-} 4{-# LANGUAGE TypeFamilies #-}
5{-# LANGUAGE ExistentialQuantification #-} 5{-# LANGUAGE ExistentialQuantification #-}
6{-# LANGUAGE GeneralizedNewtypeDeriving #-} 6{-# LANGUAGE GeneralizedNewtypeDeriving #-}
7{-# LANGUAGE FlexibleInstances #-}
7 8
8module Thermoprint.Server.Database 9module Thermoprint.Server.Database
9 ( Job(..), JobId 10 ( Job(..), JobId
@@ -11,17 +12,23 @@ module Thermoprint.Server.Database
11 , migrateAll 12 , migrateAll
12 ) where 13 ) where
13 14
15import Control.DeepSeq
16
14import Thermoprint.API (Printout, DraftTitle, JobStatus) 17import Thermoprint.API (Printout, DraftTitle, JobStatus)
15 18
16import Database.Persist.TH 19import Database.Persist.TH
20import Database.Persist.Sql (unSqlBackendKey)
21import Database.Persist.Class (Key)
17 22
18import Thermoprint.Server.Database.Instances 23import Thermoprint.Server.Database.Instances
19 24
20share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase| 25share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
21Job 26Job
22 content Printout 27 content Printout
23 status JobStatus
24Draft 28Draft
25 title DraftTitle Maybe 29 title DraftTitle Maybe
26 content Printout 30 content Printout
27|] 31|]
32
33instance NFData (Key Job) where
34 rnf = rnf . unSqlBackendKey . unJobKey
diff --git a/server/src/Thermoprint/Server/Database/Instances.hs b/server/src/Thermoprint/Server/Database/Instances.hs
index e54f90e..888e7a0 100644
--- a/server/src/Thermoprint/Server/Database/Instances.hs
+++ b/server/src/Thermoprint/Server/Database/Instances.hs
@@ -9,5 +9,3 @@ import Thermoprint.API (Printout, JobStatus, PrintingError)
9import Database.Persist.TH 9import Database.Persist.TH
10 10
11derivePersistFieldJSON "Printout" 11derivePersistFieldJSON "Printout"
12derivePersistField "PrintingError"
13derivePersistField "JobStatus"