mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
ensure we get the timestamp for the version being returned
This commit is contained in:
@@ -14,6 +14,7 @@ import Data.Conduit.List qualified as CL
|
||||
import Data.HashMap.Internal.Strict (HashMap)
|
||||
import Data.HashMap.Strict qualified as HM
|
||||
import Data.List (lookup)
|
||||
import Data.List.NonEmpty (head)
|
||||
import Data.List.NonEmpty qualified as NE
|
||||
import Data.Text qualified as T
|
||||
import Database.Persist.Sql (SqlBackend)
|
||||
@@ -63,6 +64,7 @@ import Startlude (
|
||||
fromMaybe,
|
||||
headMay,
|
||||
id,
|
||||
liftA2,
|
||||
mappend,
|
||||
maximumOn,
|
||||
nonEmpty,
|
||||
@@ -81,7 +83,6 @@ import Startlude (
|
||||
(<&>),
|
||||
(<>),
|
||||
(=<<),
|
||||
liftA2,
|
||||
)
|
||||
import UnliftIO (Concurrently (..), mapConcurrently)
|
||||
import Yesod (
|
||||
@@ -93,7 +94,6 @@ import Yesod (
|
||||
sendResponseStatus,
|
||||
)
|
||||
import Yesod.Core (logWarn)
|
||||
import Data.List.NonEmpty (head)
|
||||
|
||||
|
||||
data PackageReq = PackageReq
|
||||
@@ -218,6 +218,8 @@ constructPackageListApiRes PackageMetadata{..} dependencies = do
|
||||
let pkgCategories = packageMetadataPkgCategories
|
||||
let pkgVersions = packageMetadataPkgVersionRecords
|
||||
let pkgVersion = packageMetadataPkgVersion
|
||||
-- get the version record for the version being returned - the version will always be in this list ie. it will always be not empty
|
||||
let versionRecord = NE.head $ NE.fromList $ NE.filter (\v -> versionRecordNumber v == pkgVersion) pkgVersions
|
||||
manifest <-
|
||||
flip runReaderT settings $
|
||||
(snd <$> getManifest pkgId pkgVersion) >>= \bs ->
|
||||
@@ -232,7 +234,7 @@ constructPackageListApiRes PackageMetadata{..} dependencies = do
|
||||
, packageResLicense = basicRender $ LicenseR V0 pkgId
|
||||
, packageResVersions = versionRecordNumber <$> pkgVersions
|
||||
, packageResDependencies = dependencies
|
||||
, packageResPublishedAt = ((liftA2 fromMaybe) versionRecordCreatedAt versionRecordUpdatedAt) (head pkgVersions)
|
||||
, packageResPublishedAt = ((liftA2 fromMaybe) versionRecordCreatedAt versionRecordUpdatedAt) versionRecord
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user