mirror of
https://github.com/Start9Labs/registry.git
synced 2026-04-01 04:33:39 +00:00
adds name to /package/data
This commit is contained in:
@@ -129,13 +129,14 @@ import Yesod.Core ( MonadResource
|
||||
import Yesod.Persist ( YesodDB )
|
||||
import Yesod.Persist.Core ( YesodPersist(runDB) )
|
||||
|
||||
getCategoriesR :: Handler CategoryRes
|
||||
getCategoriesR = do
|
||||
getInfoR :: Handler InfoRes
|
||||
getInfoR = do
|
||||
name <- getsYesod $ marketplaceName . appSettings
|
||||
allCategories <- runDB $ select $ do
|
||||
cats <- from $ table @Category
|
||||
orderBy [desc (cats ^. CategoryPriority)]
|
||||
pure cats
|
||||
pure $ CategoryRes $ categoryName . entityVal <$> allCategories
|
||||
pure $ InfoRes name $ categoryName . entityVal <$> allCategories
|
||||
|
||||
getEosVersionR :: Handler EosRes
|
||||
getEosVersionR = do
|
||||
|
||||
@@ -19,13 +19,15 @@ import Yesod
|
||||
|
||||
|
||||
type URL = Text
|
||||
newtype CategoryRes = CategoryRes {
|
||||
categories :: [CategoryTitle]
|
||||
} deriving (Show, Generic)
|
||||
instance ToJSON CategoryRes
|
||||
instance ToContent CategoryRes where
|
||||
data InfoRes = InfoRes
|
||||
{ name :: Text
|
||||
, categories :: [CategoryTitle]
|
||||
}
|
||||
deriving (Show, Generic)
|
||||
instance ToJSON InfoRes
|
||||
instance ToContent InfoRes where
|
||||
toContent = toContent . toJSON
|
||||
instance ToTypedContent CategoryRes where
|
||||
instance ToTypedContent InfoRes where
|
||||
toTypedContent = toTypedContent . toJSON
|
||||
data PackageRes = PackageRes
|
||||
{ packageResIcon :: URL
|
||||
|
||||
Reference in New Issue
Block a user