diff --git a/changelog.d/5-internal/pr-2991 b/changelog.d/5-internal/pr-2991 new file mode 100644 index 0000000000..150d50cf30 --- /dev/null +++ b/changelog.d/5-internal/pr-2991 @@ -0,0 +1 @@ +Make ID tags more readable by expanding abbreviations to full names. diff --git a/libs/types-common/src/Data/Id.hs b/libs/types-common/src/Data/Id.hs index bcdd57aa12..5663626362 100644 --- a/libs/types-common/src/Data/Id.hs +++ b/libs/types-common/src/Data/Id.hs @@ -87,54 +87,62 @@ import Servant (FromHttpApiData (..), ToHttpApiData (..)) import Test.QuickCheck import Test.QuickCheck.Instances () -data IdTag = A | C | I | U | P | S | T | STo +data IdTag + = Asset + | Conversation + | Invitation + | User + | Provider + | Service + | Team + | ScimToken idTagName :: IdTag -> Text -idTagName A = "Asset" -idTagName C = "Conv" -idTagName I = "Invitation" -idTagName U = "User" -idTagName P = "Provider" -idTagName S = "Service" -idTagName T = "Team" -idTagName STo = "ScimToken" +idTagName Asset = "Asset" +idTagName Conversation = "Conv" +idTagName Invitation = "Invitation" +idTagName User = "User" +idTagName Provider = "Provider" +idTagName Service = "Service" +idTagName Team = "Team" +idTagName ScimToken = "ScimToken" class KnownIdTag (t :: IdTag) where idTagValue :: IdTag -instance KnownIdTag 'A where idTagValue = A +instance KnownIdTag 'Asset where idTagValue = Asset -instance KnownIdTag 'C where idTagValue = C +instance KnownIdTag 'Conversation where idTagValue = Conversation -instance KnownIdTag 'I where idTagValue = I +instance KnownIdTag 'Invitation where idTagValue = Invitation -instance KnownIdTag 'U where idTagValue = U +instance KnownIdTag 'User where idTagValue = User -instance KnownIdTag 'P where idTagValue = P +instance KnownIdTag 'Provider where idTagValue = Provider -instance KnownIdTag 'S where idTagValue = S +instance KnownIdTag 'Service where idTagValue = Service -instance KnownIdTag 'T where idTagValue = T +instance KnownIdTag 'Team where idTagValue = Team -instance KnownIdTag 'STo where idTagValue = STo +instance KnownIdTag 'ScimToken where idTagValue = ScimToken -type AssetId = Id 'A +type AssetId = Id 'Asset -type InvitationId = Id 'I +type InvitationId = Id 'Invitation -- | A local conversation ID -type ConvId = Id 'C +type ConvId = Id 'Conversation -- | A local user ID -type UserId = Id 'U +type UserId = Id 'User -type ProviderId = Id 'P +type ProviderId = Id 'Provider -type ServiceId = Id 'S +type ServiceId = Id 'Service -type TeamId = Id 'T +type TeamId = Id 'Team -type ScimTokenId = Id 'STo +type ScimTokenId = Id 'ScimToken -- Id -------------------------------------------------------------------------