add published-at to registry response (#120)

* add published-at to registry response

* ensure we get the timestamp for the version being returned

* cleaup import

Co-authored-by: Lucy Cifferello <12953208+elvece@users.noreply.github.com>
This commit is contained in:
Aiden McClelland
2022-08-10 11:52:02 -06:00
committed by GitHub
parent e42cd787b4
commit 6127135a4d
2 changed files with 8 additions and 0 deletions

View File

@@ -25,8 +25,10 @@ import Startlude (
(&),
(.),
(<$>),
UTCTime,
)
import Yesod
import Data.Time.Format.ISO8601 (iso8601Show)
dataUrl :: (ContentType, ByteString) -> Text
@@ -48,6 +50,7 @@ data PackageRes = PackageRes
, packageResLicense :: !Text
, packageResVersions :: !(NonEmpty Version)
, packageResDependencies :: !(HashMap PkgId DependencyRes)
, packageResPublishedAt :: !UTCTime
}
deriving (Show, Generic)
@@ -66,6 +69,7 @@ instance ApiResponse PackageRes where
, "categories" .= packageResCategories
, "versions" .= packageResVersions
, "dependency-metadata" .= (apiEncode v <$> packageResDependencies)
, "published-at" .= (iso8601Show packageResPublishedAt)
]