mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 10:21:51 +00:00
adds name to /package/data
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
!/package/#S9PK AppR GET -- get most recent appId at appversion spec, defaults to >=0.0.0 -- ?spec={semver-spec}
|
||||
/package/data CategoriesR GET -- get all marketplace categories
|
||||
/package/data InfoR GET -- get all marketplace categories
|
||||
/package/index PackageListR GET -- filter marketplace services by various query params
|
||||
-- /package/updates
|
||||
/eos/latest EosVersionR GET -- get eos information
|
||||
|
||||
@@ -78,7 +78,6 @@ import Yesod.Core
|
||||
import Yesod.Core.Types hiding ( Logger )
|
||||
import Yesod.Default.Config2
|
||||
|
||||
import Control.Arrow ( (***) )
|
||||
import Control.Lens
|
||||
import Data.List ( lookup )
|
||||
import Data.String.Interpolate.IsString
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -56,6 +56,7 @@ data AppSettings = AppSettings
|
||||
, torPort :: AppPort
|
||||
, staticBinDir :: FilePath
|
||||
, errorLogRoot :: FilePath
|
||||
, marketplaceName :: Text
|
||||
}
|
||||
instance Has PkgRepo AppSettings where
|
||||
extract = liftA2 PkgRepo ((</> "apps") . resourcesDir) staticBinDir
|
||||
@@ -84,6 +85,8 @@ instance FromJSON AppSettings where
|
||||
let sslCertLocation = sslPath </> "certificate.pem"
|
||||
let registryVersion = fromJust . parseMaybe parseJSON . String . toS . showVersion $ version
|
||||
|
||||
marketplaceName <- o .:? "marketplace-name" .!= "Start9 Embassy Marketplace"
|
||||
|
||||
return AppSettings { .. }
|
||||
|
||||
-- | Raw bytes at compile time of @config/settings.yml@
|
||||
|
||||
@@ -44,11 +44,7 @@ extra-deps:
|
||||
- esqueleto-3.5.1.0
|
||||
- monad-logger-extras-0.1.1.1
|
||||
- wai-request-spec-0.10.2.4
|
||||
- git: https://github.com/ProofOfKeags/wai
|
||||
commit: 2eef8506c7eec67fa5c1be0e0470a38e277ab5d8
|
||||
subdirs:
|
||||
- warp
|
||||
- warp-tls
|
||||
- warp-3.3.19
|
||||
# Override default flag values for local packages and extra-deps
|
||||
# flags: {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user