blob: 7f21bf9d1c7e95d74615429d22fd672ea82e3512 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
module Thermoprint.Server.Database where
import Control.DeepSeq
import Thermoprint.API (Printout, DraftTitle, JobStatus, castId)
import Database.Persist.TH
import Database.Persist.Sql (unSqlBackendKey, SqlBackend)
import Database.Persist.Class (Key, BackendKey)
import Thermoprint.Server.Database.Instances
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
Job
content Printout
Draft
title DraftTitle Maybe
content Printout
|]
deriving instance Enum (Key Job)
deriving instance Num (Key Job)
deriving instance Real (Key Job)
deriving instance Integral (Key Job)
deriving instance Enum (Key Draft)
deriving instance Num (Key Draft)
deriving instance Real (Key Draft)
deriving instance Integral (Key Draft)
instance NFData (Key Job) where
rnf = rnf . unSqlBackendKey . unJobKey
|