fix db columns for files

This commit is contained in:
Steffen Jost 2019-05-03 08:27:11 +02:00
parent 88fc32e13f
commit 126381a409
2 changed files with 6 additions and 9 deletions

View File

@ -127,8 +127,8 @@ getMShowR tid ssh csh mnm = do
, dbtFilterUI = mempty , dbtFilterUI = mempty
, dbtIdent = "material-files" :: Text , dbtIdent = "material-files" :: Text
, dbtSorting = Map.fromList , dbtSorting = Map.fromList
[ sortFilePath $ $(sqlIJproj 2 2) E.^. FileTitle [ sortFilePath $(sqlIJproj 2 2)
, sortFileModification $ $(sqlIJproj 2 2) E.^. FileModified , sortFileModification $(sqlIJproj 2 2)
] ]
} }

View File

@ -60,14 +60,11 @@ colFilePathSimple row2path row2link = sortable (Just "path") (i18nCell MsgFileTi
colFileModification :: (IsDBTable m c) => (t -> E.Value UTCTime) -> Colonnade Sortable t (DBCell m c) colFileModification :: (IsDBTable m c) => (t -> E.Value UTCTime) -> Colonnade Sortable t (DBCell m c)
colFileModification row2time = sortable (Just "time") (i18nCell MsgFileModified) (timeCell . E.unValue . row2time) colFileModification row2time = sortable (Just "time") (i18nCell MsgFileModified) (timeCell . E.unValue . row2time)
-- sortFilePath :: IsString a => (t -> E.SqlExpr (Entity ???)) -> (a, SortColumn t) sortFilePath :: IsString s => (r -> E.SqlExpr (Entity File)) -> (s, SortColumn r)
sortFilePath :: (PersistField a2, IsString a1) => sortFilePath queryPath = ("path", SortColumn $ queryPath >>> (E.^. FileTitle))
(t -> E.SqlExpr (E.Value a2)) -> (a1, SortColumn t)
sortFilePath queryPath = ("path", SortColumn queryPath)
sortFileModification :: (PersistField a2, IsString a1) => sortFileModification :: IsString s => (r -> E.SqlExpr (Entity File)) -> (s, SortColumn r)
(t -> E.SqlExpr (E.Value a2)) -> (a1, SortColumn t) sortFileModification queryModification = ("time", SortColumn $ queryModification >>> (E.^. FileModified))
sortFileModification queryModification = ("time", SortColumn queryModification)
defaultSortingByFileTitle :: PSValidator m x -> PSValidator m x defaultSortingByFileTitle :: PSValidator m x -> PSValidator m x
defaultSortingByFileTitle = defaultSorting [SortAscBy "path"] defaultSortingByFileTitle = defaultSorting [SortAscBy "path"]