diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-23 13:58:00 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-23 13:58:00 +0000 |
commit | 19df7b59fef57b75d6dc6d23dc0cd0c79bc39028 (patch) | |
tree | 7be381fac2c277da707f58e49bc7785aee844693 | |
parent | 1c0ff2e51ba225617b17d7c26b64c89021cf8e83 (diff) | |
download | thermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.tar thermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.tar.gz thermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.tar.bz2 thermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.tar.xz thermoprint-19df7b59fef57b75d6dc6d23dc0cd0c79bc39028.zip |
JobStatus in database is bad design
-rw-r--r-- | server/src/Thermoprint/Server/Database.hs | 9 | ||||
-rw-r--r-- | server/src/Thermoprint/Server/Database/Instances.hs | 2 |
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 | ||
8 | module Thermoprint.Server.Database | 9 | module 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 | ||
15 | import Control.DeepSeq | ||
16 | |||
14 | import Thermoprint.API (Printout, DraftTitle, JobStatus) | 17 | import Thermoprint.API (Printout, DraftTitle, JobStatus) |
15 | 18 | ||
16 | import Database.Persist.TH | 19 | import Database.Persist.TH |
20 | import Database.Persist.Sql (unSqlBackendKey) | ||
21 | import Database.Persist.Class (Key) | ||
17 | 22 | ||
18 | import Thermoprint.Server.Database.Instances | 23 | import Thermoprint.Server.Database.Instances |
19 | 24 | ||
20 | share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase| | 25 | share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase| |
21 | Job | 26 | Job |
22 | content Printout | 27 | content Printout |
23 | status JobStatus | ||
24 | Draft | 28 | Draft |
25 | title DraftTitle Maybe | 29 | title DraftTitle Maybe |
26 | content Printout | 30 | content Printout |
27 | |] | 31 | |] |
32 | |||
33 | instance 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) | |||
9 | import Database.Persist.TH | 9 | import Database.Persist.TH |
10 | 10 | ||
11 | derivePersistFieldJSON "Printout" | 11 | derivePersistFieldJSON "Printout" |
12 | derivePersistField "PrintingError" | ||
13 | derivePersistField "JobStatus" | ||