reimplement JobOccurrence as newtype; add JSON and PersistField instances
This commit is contained in:
parent
cacf2d291d
commit
1f7808ddf1
@ -1,5 +1,5 @@
|
||||
-- Jobs to be fetched and distributed to the workers by the scheduler
|
||||
-- part of the *new* job system
|
||||
JobMeta
|
||||
occurrence JobOccurrence default='{"dnf-terms":[]}' -- when should the job be executed? (Possibly recurring)
|
||||
occurrence JobOccurrence -- when should the job be executed? (Possibly recurring)
|
||||
deriving Eq Ord Show Generic
|
||||
|
||||
@ -1,9 +1,18 @@
|
||||
module Model.Types.Jobsystem
|
||||
( JobOccurrence
|
||||
( JobOccurrence(..)
|
||||
) where
|
||||
|
||||
import Import.NoModel
|
||||
|
||||
type JobOccurrence = Occurrence LocalTime () -- latter is specialtime; not used yet
|
||||
|
||||
derivePersistFieldJSON ''Occurrence LocalTime ()
|
||||
newtype JobOccurrence = JobOccurrence
|
||||
{ jobOccurrence :: Occurrence LocalTime () -- latter is specialtime; not used yet
|
||||
}
|
||||
deriving (Eq, Ord, Read, Show, Generic)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
deriveJSON defaultOptions
|
||||
{ tagSingleConstructors = False
|
||||
, unwrapUnaryRecords = True
|
||||
} ''JobOccurrence
|
||||
derivePersistFieldJSON ''JobOccurrence
|
||||
|
||||
Reference in New Issue
Block a user