Skip to content

Commit

Permalink
fix group_create type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
logica0419 committed Nov 20, 2023
1 parent 46b51d3 commit bfa2796
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion service/bot/event/payload/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ type UserGroup struct {
UpdatedAt time.Time `json:"updatedAt"`
}

func MakeUserGroup(group model.UserGroup) UserGroup {
func MakeUserGroup(group *model.UserGroup) UserGroup {
admins := make([]*UserGroupAdmin, len(group.Admins))
for i, admin := range group.Admins {
a := MakeUserGroupAdmin(admin.GroupID, admin.UserID)
Expand Down
2 changes: 1 addition & 1 deletion service/bot/event/payload/ev_user_group_created.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type UserGroupCreated struct {
Group UserGroup `json:"group"`
}

func MakeUserGroupCreated(eventTime time.Time, group model.UserGroup) *UserGroupCreated {
func MakeUserGroupCreated(eventTime time.Time, group *model.UserGroup) *UserGroupCreated {
return &UserGroupCreated{
Base: MakeBase(eventTime),
Group: MakeUserGroup(group),
Expand Down
2 changes: 1 addition & 1 deletion service/bot/handler/ev_user_group_created.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func UserGroupCreated(ctx Context, datetime time.Time, _ string, fields hub.Fields) error {
group := fields["group"].(model.UserGroup)
group := fields["group"].(*model.UserGroup)
bots, err := ctx.GetBots(event.UserGroupCreated)
if err != nil {
return fmt.Errorf("failed to GetBots: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions service/bot/handler/ev_user_group_created_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestUserGroupCreated(t *testing.T) {
Status: model.UserAccountStatusActive,
Bot: false,
}
group := model.UserGroup{
group := &model.UserGroup{
ID: uuid.NewV3(uuid.Nil, "g"),
Name: "new_group",
Description: "new_group_description",
Expand Down Expand Up @@ -74,7 +74,7 @@ func TestUserGroupCreated(t *testing.T) {
Status: model.UserAccountStatusActive,
Bot: false,
}
group := model.UserGroup{
group := &model.UserGroup{
ID: uuid.NewV3(uuid.Nil, "g"),
Name: "new_group",
Description: "new_group_description",
Expand Down

0 comments on commit bfa2796

Please sign in to comment.