chore(versionbump): Reverted old versionbump of CryptoID.hs and implemented a new one.

This commit is contained in:
Stephan Barth 2024-10-06 16:57:30 +02:00
parent 081310c656
commit 9e48b4b8c1

View File

@ -30,7 +30,7 @@ import qualified Data.Text as Text
import qualified Data.CaseInsensitive as CI
import Data.Aeson (withText)
--import Data.Aeson.Encoding (text)
import Data.Aeson.Encoding (text)
import Text.Blaze (ToMarkup(..))
@ -72,10 +72,8 @@ instance {-# OVERLAPS #-} PathPiece (E.CryptoID "Submission" (CI FilePath)) wher
instance {-# OVERLAPS #-} ToJSON (E.CryptoID "Submission" (CI FilePath)) where
toJSON = String . toPathPiece
instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "Submission" (CI FilePath))
-- Versionbump: Instance can be made automatically now; also old instance does not work any more due to type changes
--where
-- toJSONKey = ToJSONKeyText toPathPiece (text . toPathPiece)
instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "Submission" (CI FilePath)) where
toJSONKey = ToJSONKeyText (fromText . toPathPiece) (text . toPathPiece)
instance {-# OVERLAPS #-} FromJSON (E.CryptoID "Submission" (CI FilePath)) where
parseJSON = withText "CryptoFileNameSubmission" $ maybe (fail "Could not parse CryptoFileNameSubmission") return . fromPathPiece
instance {-# OVERLAPS #-} FromJSONKey (E.CryptoID "Submission" (CI FilePath)) where
@ -93,11 +91,8 @@ instance {-# OVERLAPS #-} PathPiece (E.CryptoID "User" (CI FilePath)) where
instance {-# OVERLAPS #-} ToJSON (E.CryptoID "User" (CI FilePath)) where
toJSON = String . toPathPiece
instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "User" (CI FilePath))
-- Versionbump: Instance can be made automatically now; also old instance does not work any more due to type changes
-- where
-- toJSONKey = ToJSONKeyText toPathPiece (text . toPathPiece)
instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "User" (CI FilePath)) where
toJSONKey = ToJSONKeyText (fromText . toPathPiece) (text . toPathPiece)
instance {-# OVERLAPS #-} FromJSON (E.CryptoID "User" (CI FilePath)) where
parseJSON = withText "CryptoFileNameUser" $ maybe (fail "Could not parse CryptoFileNameUser") return . fromPathPiece
instance {-# OVERLAPS #-} FromJSONKey (E.CryptoID "User" (CI FilePath)) where
@ -114,10 +109,8 @@ instance {-# OVERLAPS #-} PathPiece (E.CryptoID "PrintJob" (CI FilePath)) where
toPathPiece = Text.pack . ("uwl" <>) . CI.foldedCase . ciphertext
instance {-# OVERLAPS #-} ToJSON (E.CryptoID "PrintJob" (CI FilePath)) where
toJSON = String . toPathPiece
instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "PrintJob" (CI FilePath))
-- Versionbump: Instance can be made automatically now; also old instance does not work any more due to type changes
-- where
-- toJSONKey = ToJSONKeyText toPathPiece (text . toPathPiece)
instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "PrintJob" (CI FilePath)) where
toJSONKey = ToJSONKeyText (fromText . toPathPiece) (text . toPathPiece)
instance {-# OVERLAPS #-} FromJSON (E.CryptoID "PrintJob" (CI FilePath)) where
parseJSON = withText "CryptoFileNameUser" $ maybe (fail "Could not parse CryptoPrintJob") return . fromPathPiece
instance {-# OVERLAPS #-} FromJSONKey (E.CryptoID "PrintJob" (CI FilePath)) where