Skip to content

Comments

[NEW] New/teams back owner#21086

Merged
sampaiodiego merged 8 commits intonew/teams-backfrom
new/teams-back-owner
Mar 12, 2021
Merged

[NEW] New/teams back owner#21086
sampaiodiego merged 8 commits intonew/teams-backfrom
new/teams-back-owner

Conversation

@KevLehman
Copy link
Member

@KevLehman KevLehman commented Mar 11, 2021

Proposed changes (including videos or screenshots)

  • Allows users to specify the owner of the team when using the API (useful for bots :) )
  • Allows users to retrieve a list of the members of a team (when they are either admin, have permissions or are members of the team)
  • Add some e2e tests to the functionality
  • Create unique indexes for Team.name and (TeamMember.userId & TeamMember.teamId)

Issue(s)

Steps to test or reproduce

Further comments

Add unique indexes to team name and team membership

Add posibility to assign ownership of team to another user
Create endpoint to fetch all members of a given team
@KevLehman KevLehman added area: backend Touches the code on backend side feat:teams labels Mar 11, 2021
@KevLehman KevLehman requested a review from sampaiodiego March 11, 2021 21:34
@@ -1,4 +1,5 @@
import { Db } from 'mongodb';
import { Meteor } from 'meteor/meteor';
Copy link
Member

Choose a reason for hiding this comment

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

we should avoid importing Meteor on services, as doing so we cannot run this service standalone

teamId = result.insertedId;
} catch (e) {
// TODO should we throw a generic error instead of saying that the team already exists?
if (e.code === 11000) {
Copy link
Member

Choose a reason for hiding this comment

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

not sure what is the best, but we usually check the data before executing the insert instead of trying to guess the error.

}

async members(userId: string, teamId: string): Promise<Array<ITeamMember>> {
const isMember = await this.TeamMembersModel.findOne({ userId, teamId });
Copy link
Member

Choose a reason for hiding this comment

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

we should have a method on model class to perform this query

return [];
}

return this.TeamMembersModel.find({ teamId }).toArray();
Copy link
Member

Choose a reason for hiding this comment

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

same as before, we should have a method on model class to perform this query

@sampaiodiego sampaiodiego merged commit 0b295b3 into new/teams-back Mar 12, 2021
@sampaiodiego sampaiodiego deleted the new/teams-back-owner branch March 12, 2021 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: backend Touches the code on backend side

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants