Skip to content

Conversation

battermann
Copy link
Contributor

@battermann battermann commented Dec 20, 2021

https://wearezeta.atlassian.net/browse/SQSERVICES-1011

  • PUT /teams/:tid

Checklist

  • The PR Title explains the impact of the change.
  • The PR description provides context as to why the change should occur and what the code contributes to that effect. This could also be a link to a JIRA ticket or a Github issue, if there is one.
  • changelog.d contains the following bits of information (details):
    • A file with the changelog entry in one or more suitable sub-sections. The sub-sections are marked by directories inside changelog.d.

@battermann battermann marked this pull request as ready for review December 22, 2021 14:45
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!

Copy link
Contributor

@fisx fisx left a comment

Choose a reason for hiding this comment

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

sorry about missing the non-binding teams thing in the issue, but i'm hopeful that most of the code is still going to be usdful for non-dead end-points?

I can take another look tomorrow when the last hole is filled, then this should be good to merge.

@@ -317,7 +317,7 @@ testObject_NewTeamMember_team_19 =

testObject_NewTeamMember_team_20 :: NewTeamMember
testObject_NewTeamMember_team_20 =
( newNewTeamMember
( mkNewTeamMember
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be helpful if you did these renamings in separate PRs.

@@ -724,6 +706,7 @@ getTeamMemberH ::
Sem r Response
getTeamMemberH (zusr ::: tid ::: uid ::: _) = do
(member, withPerms) <- getTeamMember zusr tid uid
-- pure $ member & permissions .~ \p -> guard (withPerms member) $> p
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Contributor

@pcapriotti pcapriotti left a comment

Choose a reason for hiding this comment

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

Looks good to me, except for the missing schema. I guess since we don't need this endpoint at all, it's maybe better if we just remove it instead of servantifying it (and then we don't need the missing schema either).

I left some minor comments, most of which are about mistakes that I made.


deriving instance Show (PermissionType tag) => Show (TeamMember' tag)

deriving instance Generic (TeamMember' tag)
Copy link
Contributor

Choose a reason for hiding this comment

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

This one instance has no context, so it doesn't need to be standalone.

Comment on lines 181 to 183
-- FUTUREWORK:
-- There must be a cleaner way to do this, with a separate type
-- instead of logic in the JSON instance.
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this FUTUREWORK now.


deriving instance (Show (PermissionType tag)) => Show (NewTeamMember' tag)

deriving instance (Generic (PermissionType tag)) => Generic (NewTeamMember' tag)
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't need a context, so it can also be a normal deriving clause.

invitation :: Lens' TeamMember (Maybe (UserId, UTCTimeMillis))
invitation = newTeamMember . nInvitation

-- JSON serialisation utilities (TODO: remove after servantification)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since these are staying for the time being, we should turn the TODO into a FUTUREWORK.

@@ -724,6 +706,7 @@ getTeamMemberH ::
Sem r Response
getTeamMemberH (zusr ::: tid ::: uid ::: _) = do
(member, withPerms) <- getTeamMember zusr tid uid
-- pure $ member & permissions .~ \p -> guard (withPerms member) $> p
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- pure $ member & permissions .~ \p -> guard (withPerms member) $> p

@fisx
Copy link
Contributor

fisx commented Dec 24, 2021

testObject_NewUser_user_7.json:                                                 FAIL
test/golden/Test/Wire/API/Golden/Runner.hs:61:
NewUser: FromJSON of testObject_NewUser_user_7.json should match object
expected: Success (NewUser {newUserDisplayName = Name {fromName = "test name"}, newUserUUID = Nothing, newUserIdentity = Just (PhoneIdentity (Phone {fromPhone = "+12345678"})), newUserPict = Nothing, newUserAssets = [], newUserAccentId = Nothing, newUserEmailCode = Nothing, newUserPhoneCode = Nothing, newUserOrigin = Just (NewUserOriginTeamUser (NewTeamCreator (BindingNewTeamUser {bnuTeam = BindingNewTeam (NewTeam {_newTeamName = Range {fromRange = "\fe\ENQ\1011760zm"}, _newTeamIcon = Range {fromRange = "Coq\52427\v\182208"}, _newTeamIconKey = Just (Range {fromRange = "\ACKc\151665L ,"}), _newTeamMembers = Nothing}), bnuCurrency = Just XUA}))), newUserLabel = Nothing, newUserLocale = Nothing, newUserPassword = Just PlainTextPassword <hidden>, newUserExpiresIn = Nothing, newUserManagedBy = Nothing})
but got: Success (NewUser {newUserDisplayName = Name {fromName = "test name"}, newUserUUID = Nothing, newUserIdentity = Just (PhoneIdentity (Phone {fromPhone = "+12345678"})), newUserPict = Nothing, newUserAssets = [], newUserAccentId = Nothing, newUserEmailCode = Nothing, newUserPhoneCode = Nothing, newUserOrigin = Just (NewUserOriginTeamUser (NewTeamCreator (BindingNewTeamUser {bnuTeam = BindingNewTeam (NewTeam {_newTeamName = Range {fromRange = "\fe\ENQ\1011760zm"}, _newTeamIcon = Range {fromRange = "Coq\52427\v\182208"}, _newTeamIconKey = Just (Range {fromRange = "\ACKc\151665L ,"}), _newTeamMembers = Just ()}), bnuCurrency = Just XUA}))), newUserLabel = Nothing, newUserLocale = Nothing, newUserPassword = Just PlainTextPassword <hidden>, newUserExpiresIn = Nothing, newUserManagedBy = Nothing})

_newTeamMembers is landing on Just () instead of Nothing. this looks like we collapse two different haskell values on the same json. not sure if there's a good solution. (I'll also take a hack to make the golden tests pass!)

@pcapriotti
Copy link
Contributor

I merged the schemas for binding and non-binding NewTeam. This should also fix the tests.

@battermann battermann merged commit f6fd70d into develop Jan 3, 2022
@battermann battermann deleted the SQSERVICES-1011-servantify-gally-team-api branch January 3, 2022 08:28
@akshaymankar akshaymankar mentioned this pull request Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants