Skip to content

Commit

Permalink
usergroupを作るときにteamidを入れられるように (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
x86taka authored Mar 2, 2023
1 parent 1f1487a commit 48a266f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/controller/user_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ type CreateUserGroupRequest struct {
BastionPassword string `json:"bastion_password"`
BastionHost string `json:"bastion_host"`
BastionPort int `json:"bastion_port"`
TeamID string `json:"team_id"`
}

type CreateUserGroupResponse struct {
UserGroup *entity.UserGroup `json:"user_group"`
}

func (c *UserGroupController) Create(req *CreateUserGroupRequest) (*CreateUserGroupResponse, error) {
userGroup, err := c.userGroupService.Create(req.Name, req.Organization, req.InvitationCode, req.IsFullAccess)
userGroup, err := c.userGroupService.Create(req.Name, req.Organization, req.InvitationCode, req.IsFullAccess, req.TeamID)
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/service/user_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func NewUserGroupService(userGroupRepo repository.UserGroupRepository) *UserGrou
}
}

func (s *UserGroupService) Create(name, organization, invitationCode string, isFullAccess bool) (*entity.UserGroup, error) {
func (s *UserGroupService) Create(name, organization, invitationCode string, isFullAccess bool, teamId string) (*entity.UserGroup, error) {
digest, err := bcrypt.GenerateFromPassword([]byte(invitationCode), bcrypt.DefaultCost)
if err != nil {
return nil, err
Expand All @@ -27,6 +27,7 @@ func (s *UserGroupService) Create(name, organization, invitationCode string, isF
Organization: organization,
InvitationCodeDigest: string(digest),
IsFullAccess: isFullAccess,
TeamID: teamId,
})
}

Expand Down

0 comments on commit 48a266f

Please sign in to comment.