Skip to content

Commit

Permalink
change model
Browse files Browse the repository at this point in the history
  • Loading branch information
sho0126hiro committed Oct 26, 2022
1 parent 31ab33e commit 227b344
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/internal/domain/service/slack_reaction_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ func (s *slackReactionUsersService) ListUsersEmailByReaction(ctx context.Context
}

// getReactionUserIDs get reaction users by reactionName
func (s *slackReactionUsersService) getReactionUserIDs(ctx context.Context, reactions []*model.SlackReactions, reactionName string) []string {
func (s *slackReactionUsersService) getReactionUserIDs(ctx context.Context, reactions []*model.SlackReaction, reactionName string) []string {
var userIDs []string
var targetReaction *model.SlackReactions
var targetReaction *model.SlackReaction
for _, reaction := range reactions {
for _, st := range model.ReactionSkinTones {
if reaction.Name == reactionName+st {
Expand Down
6 changes: 3 additions & 3 deletions app/internal/domain/service/slack_reaction_users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Test_slackReactionUsersService_ListUsersEmailByReaction(t *testing.T) {
}
sampleMessage := &model.SlackMessage{
ChannelID: "sampleCID",
Reactions: []*model.SlackReactions{
Reactions: []*model.SlackReaction{
{
Name: "join",
UserIDs: []string{"user01", "user02"},
Expand Down Expand Up @@ -130,10 +130,10 @@ func Test_slackReactionUsersService_ListUsersEmailByReaction(t *testing.T) {

func Test_slackReactionUsersService_getReactionUserIDs(t *testing.T) {
type args struct {
reactions []*model.SlackReactions
reactions []*model.SlackReaction
reactionName string
}
slackReactions := []*model.SlackReactions{
slackReactions := []*model.SlackReaction{
{
Name: "join",
UserIDs: []string{"user01", "user02"},
Expand Down
10 changes: 5 additions & 5 deletions app/internal/model/skin_colors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ package model
// A reaction with skin-tone can be expressed by combining the following array elements with the reaction specified by the user
var ReactionSkinTones []string = []string{
"", // this value is used to express reactions without skin-tone
":skin-tone-2:",
":skin-tone-3:",
":skin-tone-4:",
":skin-tone-5:",
":skin-tone-6:",
"skin-tone-2",
"skin-tone-3",
"skin-tone-4",
"skin-tone-5",
"skin-tone-6",
}
4 changes: 2 additions & 2 deletions app/internal/model/slack_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ package model

type SlackMessage struct {
ChannelID string
Reactions []*SlackReactions
Reactions []*SlackReaction
}

type SlackReactions struct {
type SlackReaction struct {
Name string
UserIDs []string
}
Expand Down
4 changes: 2 additions & 2 deletions app/internal/repository/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ func (r *slackRepository) GetParentMessage(ctx context.Context, channelID, ts st
if len(msgs) > 0 {
fmt.Printf("%#v \n", msgs[0])
parentMessage := msgs[0]
var reactions []*model.SlackReactions
var reactions []*model.SlackReaction
for _, reaction := range parentMessage.Reactions {
reactions = append(reactions, &model.SlackReactions{
reactions = append(reactions, &model.SlackReaction{
Name: reaction.Name,
UserIDs: reaction.Users,
})
Expand Down

0 comments on commit 227b344

Please sign in to comment.