diff options
Diffstat (limited to 'server/src/Thermoprint/Server/Database.hs')
-rw-r--r-- | server/src/Thermoprint/Server/Database.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/src/Thermoprint/Server/Database.hs b/server/src/Thermoprint/Server/Database.hs index 29732e1..1e01680 100644 --- a/server/src/Thermoprint/Server/Database.hs +++ b/server/src/Thermoprint/Server/Database.hs | |||
@@ -9,16 +9,18 @@ | |||
9 | module Thermoprint.Server.Database | 9 | module Thermoprint.Server.Database |
10 | ( Job(..), JobId | 10 | ( Job(..), JobId |
11 | , Draft(..), DraftId | 11 | , Draft(..), DraftId |
12 | , Key(..) | ||
12 | , migrateAll | 13 | , migrateAll |
14 | , castId' | ||
13 | ) where | 15 | ) where |
14 | 16 | ||
15 | import Control.DeepSeq | 17 | import Control.DeepSeq |
16 | 18 | ||
17 | import Thermoprint.API (Printout, DraftTitle, JobStatus) | 19 | import Thermoprint.API (Printout, DraftTitle, JobStatus, castId) |
18 | 20 | ||
19 | import Database.Persist.TH | 21 | import Database.Persist.TH |
20 | import Database.Persist.Sql (unSqlBackendKey) | 22 | import Database.Persist.Sql (unSqlBackendKey, SqlBackend) |
21 | import Database.Persist.Class (Key) | 23 | import Database.Persist.Class (Key, BackendKey) |
22 | 24 | ||
23 | import Thermoprint.Server.Database.Instances | 25 | import Thermoprint.Server.Database.Instances |
24 | 26 | ||
@@ -32,3 +34,6 @@ Draft | |||
32 | 34 | ||
33 | instance NFData (Key Job) where | 35 | instance NFData (Key Job) where |
34 | rnf = rnf . unSqlBackendKey . unJobKey | 36 | rnf = rnf . unSqlBackendKey . unJobKey |
37 | |||
38 | castId' :: Enum b => BackendKey SqlBackend -> b | ||
39 | castId' = castId . unSqlBackendKey | ||