mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-30 11:51:57 +00:00
handle proper version info parsing
This commit is contained in:
@@ -13,24 +13,43 @@ import Settings
|
||||
fetchApp :: MonadIO m => AppIdentifier -> AppVersion -> ReaderT SqlBackend m (Maybe (Entity App))
|
||||
fetchApp appId appVersion = selectFirst [AppAppId ==. appId, AppSemver ==. appVersion] []
|
||||
|
||||
createApp :: MonadIO m => AppIdentifier -> AppSeed -> ReaderT SqlBackend m (Key App)
|
||||
createApp :: MonadIO m => AppIdentifier -> AppSeed -> ReaderT SqlBackend m (Maybe (Key App))
|
||||
createApp appId AppSeed{..} = do
|
||||
time <- liftIO $ getCurrentTime
|
||||
insert $ App
|
||||
insertUnique $ App
|
||||
time
|
||||
Nothing
|
||||
title
|
||||
appId
|
||||
descShort
|
||||
descLong
|
||||
semver
|
||||
releaseNotes
|
||||
appVersion
|
||||
releaseNotes'
|
||||
iconType
|
||||
|
||||
createMetric :: MonadIO m => Maybe (Key App) -> AppIdentifier -> ReaderT SqlBackend m (Key Metric)
|
||||
createMetric :: MonadIO m => Maybe (Key App) -> AppIdentifier -> ReaderT SqlBackend m ()
|
||||
createMetric appId event = do
|
||||
time <- liftIO $ getCurrentTime
|
||||
insert $ Metric
|
||||
insert_ $ Metric
|
||||
time
|
||||
appId
|
||||
event
|
||||
event
|
||||
|
||||
createAllAppVersions :: MonadIO m => StoreApp -> AppIdentifier -> ReaderT SqlBackend m ()
|
||||
createAllAppVersions app appId = do
|
||||
time <- liftIO $ getCurrentTime
|
||||
-- inseryt new records and replace existing records (matching any unique constraint)
|
||||
putMany $ toList $ storeAppToSeed time appId app
|
||||
|
||||
storeAppToSeed :: UTCTime -> AppIdentifier -> StoreApp -> NonEmpty App
|
||||
storeAppToSeed time appId StoreApp{..} = map (\b -> App
|
||||
time
|
||||
Nothing
|
||||
storeAppTitle
|
||||
appId
|
||||
storeAppDescShort
|
||||
storeAppDescLong
|
||||
(semver b)
|
||||
(releaseNotes b)
|
||||
storeAppIconType
|
||||
) storeAppSemver
|
||||
|
||||
Reference in New Issue
Block a user