add priority to order categories

This commit is contained in:
Lucy Cifferello
2021-07-14 18:04:15 -04:00
committed by Keagan McClelland
parent 0d27703b33
commit d53262e143
2 changed files with 5 additions and 1 deletions

View File

@@ -150,7 +150,10 @@ instance ToTypedContent EosRes where
getCategoriesR :: Handler CategoryRes
getCategoriesR = do
allCategories <- runDB $ select $ do from $ table @Category
allCategories <- runDB $ select $ do
cats <- from $ table @Category
orderBy [desc (cats ^. CategoryPriority)]
pure cats
pure $ CategoryRes $ categoryName . entityVal <$>allCategories
getEosR :: Handler EosRes

View File

@@ -64,6 +64,7 @@ Category
parent CategoryId Maybe
description Text
UniqueName name
priority Int default=0
deriving Eq
deriving Show