Skip to content
1 change: 1 addition & 0 deletions changelog.d/5-internal/pr-2008
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Servantify Galley Teams API. (#2008)
7 changes: 3 additions & 4 deletions libs/galley-types/src/Galley/Types/Teams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,17 @@ module Galley.Types.Teams
teamListHasMore,
TeamMember,
userId,
nUserId,
permissions,
nPermissions,
invitation,
nInvitation,
legalHoldStatus,
teamMemberJson,
TeamMemberList,
ListType (..),
newTeamMemberList,
teamMembers,
teamMemberListType,
teamMemberListJson,
TeamConversation,
newTeamConversation,
conversationId,
Expand Down Expand Up @@ -105,8 +106,6 @@ module Galley.Types.Teams
newTeamIconKey,
newTeamMembers,
NewTeamMember,
newNewTeamMember,
ntmNewTeamMember,
Event,
newEvent,
eventType,
Expand Down
6 changes: 6 additions & 0 deletions libs/schema-profunctor/src/Data/Schema.hs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ instance With Text where
instance With Integer where
with _ = (A.parseJSON >=>)

instance With Bool where
with = A.withBool

-- | A schema for a single value of an enumeration.
element ::
forall a b.
Expand Down Expand Up @@ -766,6 +769,9 @@ instance HasEnum Text NamedSwaggerDoc where
instance HasEnum Integer NamedSwaggerDoc where
mkEnum = mkSwaggerEnum S.SwaggerInteger

instance HasEnum Bool NamedSwaggerDoc where
mkEnum = mkSwaggerEnum S.SwaggerBoolean

mkSwaggerEnum ::
S.SwaggerType 'S.SwaggerKindSchema ->
Text ->
Expand Down
22 changes: 21 additions & 1 deletion libs/wire-api/src/Wire/API/Routes/Public/Galley.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -Wno-orphans #-}

-- This file is part of the Wire Server implementation.
Expand Down Expand Up @@ -43,6 +44,7 @@ import Wire.API.Routes.Public
import Wire.API.Routes.Public.Util
import Wire.API.Routes.QualifiedCapture
import Wire.API.ServantProto (Proto, RawProto)
import Wire.API.Team
import Wire.API.Team.Conversation
import Wire.API.Team.Feature

Expand Down Expand Up @@ -705,7 +707,25 @@ data Api routes = Api
:- FeatureConfigGet 'WithLockStatus 'TeamFeatureSelfDeletingMessages,
featureConfigGuestLinksGet ::
routes
:- FeatureConfigGet 'WithLockStatus 'TeamFeatureGuestLinks
:- FeatureConfigGet 'WithLockStatus 'TeamFeatureGuestLinks,
-- teams
createNonBindingTeam ::
routes
:- Summary "Create a new non binding team"
:> ZUser
:> ZConn
:> CanThrow NotConnected
:> "teams"
:> ReqBody '[Servant.JSON] NonBindingNewTeam
:> MultiVerb
'POST
'[JSON]
'[ WithHeaders
'[DescHeader "Location" "Team ID" TeamId]
TeamId
(RespondEmpty 201 "Team ID as `Location` header value")
]
TeamId
}
deriving (Generic)

Expand Down
6 changes: 6 additions & 0 deletions libs/wire-api/src/Wire/API/Team.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ import Data.Id (TeamId, UserId)
import Data.Json.Util
import Data.Misc (PlainTextPassword (..))
import Data.Range
import Data.Schema (Schema (..), ToSchema, schema)
import qualified Data.Swagger as S
import qualified Data.Swagger.Build.Api as Doc
import Imports
import Test.QuickCheck.Gen (suchThat)
Expand Down Expand Up @@ -227,6 +229,10 @@ instance Arbitrary BindingNewTeam where
-- | FUTUREWORK: this is dead code! remove!
newtype NonBindingNewTeam = NonBindingNewTeam (NewTeam (Range 1 127 [TeamMember]))
deriving stock (Eq, Show, Generic)
deriving (S.ToSchema) via (Schema NonBindingNewTeam)

instance ToSchema NonBindingNewTeam where
schema = error "todo"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this, will fix it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

argh!! we should not have non-binding teams any more in the code, they have never been implemented on the client side and have been dead code since the beginning. i expect this to take less than an hour, but now i want to remove non-binding teams again. immediately!


modelNewNonBindingTeam :: Doc.Model
modelNewNonBindingTeam = Doc.defineModel "newNonBindingTeam" $ do
Expand Down
Loading