fixes timestamp parsing

This commit is contained in:
Keagan McClelland
2021-01-18 16:07:02 -07:00
committed by Aiden McClelland
parent 718d556080
commit 68a87c8c4f
2 changed files with 3 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ import Lib.SystemPaths
import Lib.Types.Core
import Lib.Types.Emver
import Lib.Types.ServerApp
import Data.Time.ISO8601 ( parseISO8601 )
newtype AppManifestRes = AppManifestRes
{ storeApps :: [StoreApp] } deriving (Eq, Show)
@@ -135,7 +136,7 @@ parseAppData = do
storeAppVersions <- ad .: "version-info" >>= \case
[] -> fail "No Valid Version Info"
(x : xs) -> pure $ x :| xs
storeAppTimestamp <- ad .: "timestamp"
storeAppTimestamp <- ad .: "timestamp" >>= maybe (fail "Invalid ISO8601 Timestamp") pure . parseISO8601
pure StoreApp { .. }
getAppVersionForSpec :: (Has RegistryUrl sig m, Has (Error S9Error) sig m, MonadIO m)

View File

@@ -36,7 +36,7 @@ instance FromJSON StoreAppVersionInfo where
parseJSON = withObject "Store App Version Info" $ \o -> do
storeAppVersionInfoVersion <- o .: "version"
storeAppVersionInfoReleaseNotes <- o .: "release-notes"
storeAppVersionInfoInstallAlert <- o .: "install-alert"
storeAppVersionInfoInstallAlert <- o .:? "install-alert"
pure StoreAppVersionInfo { .. }
instance ToJSON StoreAppVersionInfo where
toJSON StoreAppVersionInfo {..} =