refactor: rename User Groups to Teams

This commit is contained in:
Alexander Zobnin
2017-12-08 18:25:45 +03:00
parent b03b360414
commit d8612380e9
40 changed files with 384 additions and 382 deletions
+5 -5
View File
@@ -24,7 +24,7 @@ func (p PermissionType) String() string {
// Typed errors
var (
ErrDashboardAclInfoMissing = errors.New("User id and user group id cannot both be empty for a dashboard permission.")
ErrDashboardAclInfoMissing = errors.New("User id and team id cannot both be empty for a dashboard permission.")
ErrDashboardPermissionDashboardEmpty = errors.New("Dashboard Id must be greater than zero for a dashboard permission.")
)
@@ -35,7 +35,7 @@ type DashboardAcl struct {
DashboardId int64
UserId int64
UserGroupId int64
TeamId int64
Role *RoleType // pointer to be nullable
Permission PermissionType
@@ -54,8 +54,8 @@ type DashboardAclInfoDTO struct {
UserId int64 `json:"userId"`
UserLogin string `json:"userLogin"`
UserEmail string `json:"userEmail"`
UserGroupId int64 `json:"userGroupId"`
UserGroup string `json:"userGroup"`
TeamId int64 `json:"teamId"`
Team string `json:"team"`
Role *RoleType `json:"role,omitempty"`
Permission PermissionType `json:"permission"`
PermissionName string `json:"permissionName"`
@@ -74,7 +74,7 @@ type SetDashboardAclCommand struct {
DashboardId int64
OrgId int64
UserId int64
UserGroupId int64
TeamId int64
Permission PermissionType
Result DashboardAcl
+16 -16
View File
@@ -7,12 +7,12 @@ import (
// Typed errors
var (
ErrUserGroupNotFound = errors.New("User Group not found")
ErrUserGroupNameTaken = errors.New("User Group name is taken")
ErrTeamNotFound = errors.New("Team not found")
ErrTeamNameTaken = errors.New("Team name is taken")
)
// UserGroup model
type UserGroup struct {
// Team model
type Team struct {
Id int64 `json:"id"`
OrgId int64 `json:"orgId"`
Name string `json:"name"`
@@ -24,45 +24,45 @@ type UserGroup struct {
// ---------------------
// COMMANDS
type CreateUserGroupCommand struct {
type CreateTeamCommand struct {
Name string `json:"name" binding:"Required"`
OrgId int64 `json:"-"`
Result UserGroup `json:"-"`
Result Team `json:"-"`
}
type UpdateUserGroupCommand struct {
type UpdateTeamCommand struct {
Id int64
Name string
}
type DeleteUserGroupCommand struct {
type DeleteTeamCommand struct {
Id int64
}
type GetUserGroupByIdQuery struct {
type GetTeamByIdQuery struct {
Id int64
Result *UserGroup
Result *Team
}
type GetUserGroupsByUserQuery struct {
type GetTeamsByUserQuery struct {
UserId int64 `json:"userId"`
Result []*UserGroup `json:"userGroups"`
Result []*Team `json:"teams"`
}
type SearchUserGroupsQuery struct {
type SearchTeamsQuery struct {
Query string
Name string
Limit int
Page int
OrgId int64
Result SearchUserGroupQueryResult
Result SearchTeamQueryResult
}
type SearchUserGroupQueryResult struct {
type SearchTeamQueryResult struct {
TotalCount int64 `json:"totalCount"`
UserGroups []*UserGroup `json:"userGroups"`
Teams []*Team `json:"teams"`
Page int `json:"page"`
PerPage int `json:"perPage"`
}
+13 -13
View File
@@ -7,14 +7,14 @@ import (
// Typed errors
var (
ErrUserGroupMemberAlreadyAdded = errors.New("User is already added to this user group")
ErrTeamMemberAlreadyAdded = errors.New("User is already added to this team")
)
// UserGroupMember model
type UserGroupMember struct {
// TeamMember model
type TeamMember struct {
Id int64
OrgId int64
UserGroupId int64
TeamId int64
UserId int64
Created time.Time
@@ -24,31 +24,31 @@ type UserGroupMember struct {
// ---------------------
// COMMANDS
type AddUserGroupMemberCommand struct {
type AddTeamMemberCommand struct {
UserId int64 `json:"userId" binding:"Required"`
OrgId int64 `json:"-"`
UserGroupId int64 `json:"-"`
TeamId int64 `json:"-"`
}
type RemoveUserGroupMemberCommand struct {
type RemoveTeamMemberCommand struct {
UserId int64
UserGroupId int64
TeamId int64
}
// ----------------------
// QUERIES
type GetUserGroupMembersQuery struct {
UserGroupId int64
Result []*UserGroupMemberDTO
type GetTeamMembersQuery struct {
TeamId int64
Result []*TeamMemberDTO
}
// ----------------------
// Projections and DTOs
type UserGroupMemberDTO struct {
type TeamMemberDTO struct {
OrgId int64 `json:"orgId"`
UserGroupId int64 `json:"userGroupId"`
TeamId int64 `json:"teamId"`
UserId int64 `json:"userId"`
Email string `json:"email"`
Login string `json:"login"`