add priority to order categories

This commit is contained in:
Lucy Cifferello
2021-07-14 18:04:15 -04:00
parent 259b786a6a
commit 0b78bfa9b3
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