refactor(schedule): move schedule utils
This commit is contained in:
parent
57c1cc768c
commit
df3262b8a0
@ -6,8 +6,8 @@ import Import
|
||||
|
||||
import Handler.Utils.Form
|
||||
|
||||
import Handler.Utils.Schedule.Types
|
||||
import Handler.Utils.Schedule.Week
|
||||
import Utils.Schedule.Types
|
||||
import Utils.Schedule.Week
|
||||
|
||||
|
||||
getScheduleR, postScheduleR :: Handler Html
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
module Handler.Utils.Schedule.Types
|
||||
( module Handler.Utils.Schedule.Types
|
||||
module Utils.Schedule.Types
|
||||
( module Utils.Schedule.Types
|
||||
) where
|
||||
|
||||
import Import
|
||||
|
||||
import Handler.Utils.Schedule.Types.ScheduleEntry as Handler.Utils.Schedule.Types
|
||||
import Handler.Utils.Schedule.Types.ScheduleOptions as Handler.Utils.Schedule.Types
|
||||
import Utils.Schedule.Types.ScheduleEntry as Utils.Schedule.Types
|
||||
import Utils.Schedule.Types.ScheduleOptions as Utils.Schedule.Types
|
||||
|
||||
|
||||
-- TODO: replace Info types with one joined type and fetch info in one single runDB
|
||||
@ -1,4 +1,4 @@
|
||||
module Handler.Utils.Schedule.Types.ScheduleEntry
|
||||
module Utils.Schedule.Types.ScheduleEntry
|
||||
( ScheduleEntry(..)
|
||||
) where
|
||||
|
||||
12
src/Utils/Schedule/Types/ScheduleOffset.hs
Normal file
12
src/Utils/Schedule/Types/ScheduleOffset.hs
Normal file
@ -0,0 +1,12 @@
|
||||
module Utils.Schedule.Types.ScheduleOffset
|
||||
( ScheduleOffset(..)
|
||||
) where
|
||||
|
||||
import Import.NoModel
|
||||
|
||||
|
||||
data ScheduleOffset = ScheduleOffsetNone
|
||||
| ScheduleOffsetDays Int
|
||||
deriving (Eq, Ord, Show, Read, Generic, Typeable)
|
||||
|
||||
derivePathPiece ''ScheduleOffset (camelToPathPiece' 1) "_"
|
||||
@ -1,32 +1,14 @@
|
||||
module Handler.Utils.Schedule.Types.ScheduleOptions
|
||||
( ScheduleView(..)
|
||||
, ScheduleOffset(..)
|
||||
module Utils.Schedule.Types.ScheduleOptions
|
||||
( ScheduleOffset(..)
|
||||
, ScheduleOptionsAction(..)
|
||||
, ScheduleOptions(..)
|
||||
) where
|
||||
|
||||
import Import
|
||||
import Import.NoModel
|
||||
|
||||
import Utils.Form
|
||||
|
||||
|
||||
data ScheduleView = ScheduleViewWeek
|
||||
deriving (Eq, Ord, Enum, Show, Read, Generic, Typeable)
|
||||
|
||||
instance Bounded ScheduleView where
|
||||
minBound = maxBound
|
||||
maxBound = ScheduleViewWeek
|
||||
instance Finite ScheduleView
|
||||
instance Universe ScheduleView
|
||||
|
||||
derivePathPiece ''ScheduleView (camelToPathPiece' 1) "_"
|
||||
|
||||
|
||||
data ScheduleOffset = ScheduleOffsetNone
|
||||
| ScheduleOffsetDays Int
|
||||
deriving (Eq, Ord, Show, Read, Generic, Typeable)
|
||||
|
||||
derivePathPiece ''ScheduleOffset (camelToPathPiece' 1) "_"
|
||||
import Utils.Schedule.Types.ScheduleOffset
|
||||
import Utils.Schedule.Types.ScheduleView
|
||||
|
||||
|
||||
data ScheduleOptionsAction = ScheduleSetView
|
||||
19
src/Utils/Schedule/Types/ScheduleView.hs
Normal file
19
src/Utils/Schedule/Types/ScheduleView.hs
Normal file
@ -0,0 +1,19 @@
|
||||
module Utils.Schedule.Types.ScheduleView
|
||||
( ScheduleView(..)
|
||||
) where
|
||||
|
||||
import Import.NoModel
|
||||
|
||||
|
||||
data ScheduleView = ScheduleViewWeek
|
||||
deriving (Eq, Ord, Enum, Show, Read, Generic, Typeable)
|
||||
|
||||
instance Bounded ScheduleView where
|
||||
minBound = maxBound
|
||||
maxBound = ScheduleViewWeek
|
||||
|
||||
instance Finite ScheduleView
|
||||
|
||||
instance Universe ScheduleView
|
||||
|
||||
derivePathPiece ''ScheduleView (camelToPathPiece' 1) "_"
|
||||
@ -1,4 +1,4 @@
|
||||
module Handler.Utils.Schedule.Week
|
||||
module Utils.Schedule.Week
|
||||
( weekSchedule
|
||||
) where
|
||||
|
||||
@ -13,9 +13,9 @@ import qualified Database.Esqueleto as E
|
||||
|
||||
import Handler.Utils.DateTime (formatTimeRangeW, formatTimeW)
|
||||
|
||||
import Handler.Utils.Schedule
|
||||
import Handler.Utils.Schedule.Types
|
||||
import Handler.Utils.Schedule.Week.TimeSlot
|
||||
import Utils.Schedule
|
||||
import Utils.Schedule.Types
|
||||
import Utils.Schedule.Week.TimeSlot
|
||||
|
||||
|
||||
weekSchedule :: UserId -> ScheduleOffset -> Widget
|
||||
@ -1,4 +1,4 @@
|
||||
module Handler.Utils.Schedule.Week.TimeSlot
|
||||
module Utils.Schedule.Week.TimeSlot
|
||||
( TimeSlot(..)
|
||||
, timeSlot
|
||||
, timeSlotsFromTo
|
||||
Reference in New Issue
Block a user