1
0

Added method to add a user to a team

This commit is contained in:
konrad
2018-07-26 09:53:32 +02:00
committed by kolaente
parent 0b2f66965a
commit bc580e0115
8 changed files with 66 additions and 8 deletions

View File

@ -2,7 +2,19 @@ package models
// Create implements the create method to assign a user to a team
func (tm *TeamMember) Create(doer *User) (err error) {
// TODO: Check if it exists etc
// Check if the team extst
_, err = GetTeamByID(tm.TeamID)
if err != nil {
return
}
// Check if the user exists
_, _, err = GetUserByID(tm.UserID)
if err != nil {
return
}
// Insert the user
_, err = x.Insert(tm)
return
}