-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TeamDetail.MembersをTeamに移した #484
Merged
Merged
Changes from 17 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
876769e
TeamDetail.MembersをTeamに移した
0214sh7 171a9c0
Membersの箇所を修正
0214sh7 b637650
メンバーが空になるケースでの処理を変更
0214sh7 916b896
Merge branch 'main' of https://github.com/traPtitech/traPortfolio int…
0214sh7 8704e2e
単体/結合テストにおいてmembersがnilになっている箇所を修正
0214sh7 e86e891
rcontest.Teams[0].Membersが空であることを明示
0214sh7 484ed10
Merge branch 'main' of https://github.com/traPtitech/traPortfolio int…
0214sh7 26314d6
mockのユーザー情報をMembersに入れる
0214sh7 5d9eccd
HMockContestTeamMembersByIDを作成
0214sh7 6129f5d
HMockContestTeamMembersByIDを使ったID指定を残りの箇所にも反映
0214sh7 dfd2fdd
Merge branch 'main' of https://github.com/traPtitech/traPortfolio int…
0214sh7 4f6f677
mapがnilを返すときの場合分け
0214sh7 816841a
Merge branch 'main' of https://github.com/traPtitech/traPortfolio int…
0214sh7 8ee9ed2
ContestTeamWithoutMembersを追加しUserContestのメンバを変更
0214sh7 ecb1f28
軽微な修正
0214sh7 fa9bcf9
軽微な修正2
0214sh7 8c7785e
コンテストチームにチームメンバーを追加する処理(N+1)を追加
0214sh7 ff53b01
Merge branch 'main' of https://github.com/traPtitech/traPortfolio int…
0214sh7 686d30f
マージに伴う変更
0214sh7 1037bb7
domain.NewUserを使用/nilを空スライスに変更
0214sh7 2ab1502
N+1解消(テスト落ちる)
0214sh7 5e42353
go mod tidyした
0214sh7 e056822
handlerの一部を変更
0214sh7 28f5ada
fix unittest
0214sh7 b3440f6
pass all unittest
0214sh7 7b63f24
Merge branch 'main' of https://github.com/traPtitech/traPortfolio int…
0214sh7 9870eb6
commit with merge
0214sh7 849ccce
revert some change
0214sh7 746e6e3
add members to contestteam
0214sh7 bee01d2
add members to contestteam 2
0214sh7 498a2e7
remove contestteam from new contest
0214sh7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,26 +123,33 @@ func makeContest(t *testing.T) (*domain.ContestDetail, *ContestDetail) { | |
Description: random.AlphaNumeric(), | ||
ContestTeams: []*domain.ContestTeam{ | ||
{ | ||
ID: getContestID[1], | ||
ContestID: getContestID[0], | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
ContestTeamWithoutMembers: domain.ContestTeamWithoutMembers{ | ||
ID: getContestID[1], | ||
ContestID: getContestID[0], | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
}, | ||
Members: make([]*domain.User, 0), | ||
}, | ||
{ | ||
ID: getContestID[2], | ||
ContestID: getContestID[0], | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
ContestTeamWithoutMembers: domain.ContestTeamWithoutMembers{ | ||
ID: getContestID[2], | ||
ContestID: getContestID[0], | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
}, | ||
Members: make([]*domain.User, 0), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ここも |
||
}, | ||
}, | ||
} | ||
|
||
teams := make([]ContestTeam, len(d.ContestTeams)) | ||
for i, v := range d.ContestTeams { | ||
teams[i] = ContestTeam{ | ||
Id: v.ID, | ||
Name: v.Name, | ||
Result: v.Result, | ||
Id: v.ID, | ||
Members: make([]User, 0), | ||
Name: v.Name, | ||
Result: v.Result, | ||
} | ||
} | ||
|
||
|
@@ -506,28 +513,36 @@ func TestContestHandler_GetContestTeams(t *testing.T) { | |
contestID := random.UUID() | ||
repoContestTeams := []*domain.ContestTeam{ | ||
{ | ||
ID: random.UUID(), | ||
ContestID: contestID, | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
ContestTeamWithoutMembers: domain.ContestTeamWithoutMembers{ | ||
ID: random.UUID(), | ||
ContestID: contestID, | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
}, | ||
Members: make([]*domain.User, 0), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ここらへんも |
||
}, | ||
{ | ||
ID: random.UUID(), | ||
ContestID: contestID, | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
ContestTeamWithoutMembers: domain.ContestTeamWithoutMembers{ | ||
ID: random.UUID(), | ||
ContestID: contestID, | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
}, | ||
Members: make([]*domain.User, 0), | ||
}, | ||
} | ||
hres = []*ContestTeam{ | ||
{ | ||
Id: repoContestTeams[0].ID, | ||
Name: repoContestTeams[0].Name, | ||
Result: repoContestTeams[0].Result, | ||
Id: repoContestTeams[0].ID, | ||
Members: make([]User, 0), | ||
Name: repoContestTeams[0].Name, | ||
Result: repoContestTeams[0].Result, | ||
}, | ||
{ | ||
Id: repoContestTeams[1].ID, | ||
Name: repoContestTeams[1].Name, | ||
Result: repoContestTeams[1].Result, | ||
Id: repoContestTeams[1].ID, | ||
Members: make([]User, 0), | ||
Name: repoContestTeams[1].Name, | ||
Result: repoContestTeams[1].Result, | ||
}, | ||
} | ||
s.EXPECT().GetContestTeams(anyCtx{}, contestID).Return(repoContestTeams, nil) | ||
|
@@ -575,17 +590,19 @@ func TestContestHandler_GetContestTeam(t *testing.T) { | |
contestID := random.UUID() | ||
repoContestTeamDetail := domain.ContestTeamDetail{ | ||
ContestTeam: domain.ContestTeam{ | ||
ID: teamID, | ||
ContestID: contestID, | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
ContestTeamWithoutMembers: domain.ContestTeamWithoutMembers{ | ||
ID: teamID, | ||
ContestID: contestID, | ||
Name: random.AlphaNumeric(), | ||
Result: random.AlphaNumeric(), | ||
}, | ||
Members: []*domain.User{ | ||
domain.NewUser(random.UUID(), random.AlphaNumeric(), random.AlphaNumeric(), random.Bool()), | ||
domain.NewUser(random.UUID(), random.AlphaNumeric(), random.AlphaNumeric(), random.Bool()), | ||
}, | ||
}, | ||
Link: random.AlphaNumeric(), | ||
Description: random.AlphaNumeric(), | ||
Members: []*domain.User{ | ||
domain.NewUser(random.UUID(), random.AlphaNumeric(), random.AlphaNumeric(), random.Bool()), | ||
domain.NewUser(random.UUID(), random.AlphaNumeric(), random.AlphaNumeric(), random.Bool()), | ||
}, | ||
} | ||
members := make([]User, 0, len(repoContestTeamDetail.Members)) | ||
for _, member := range repoContestTeamDetail.Members { | ||
|
@@ -679,19 +696,22 @@ func TestContestHandler_AddContestTeam(t *testing.T) { | |
} | ||
want := domain.ContestTeamDetail{ | ||
ContestTeam: domain.ContestTeam{ | ||
ID: teamID, | ||
ContestID: contestID, | ||
Name: args.Name, | ||
Result: args.Result.ValueOrZero(), | ||
ContestTeamWithoutMembers: domain.ContestTeamWithoutMembers{ | ||
ID: teamID, | ||
ContestID: contestID, | ||
Name: args.Name, | ||
Result: args.Result.ValueOrZero(), | ||
}, | ||
Members: make([]*domain.User, 0), | ||
}, | ||
Link: args.Link.ValueOrZero(), | ||
Description: args.Description, | ||
Members: nil, | ||
} | ||
expectedResBody := ContestTeam{ | ||
Id: teamID, | ||
Name: want.Name, | ||
Result: want.Result, | ||
Id: teamID, | ||
Members: make([]User, 0), | ||
Name: want.Name, | ||
Result: want.Result, | ||
} | ||
s.EXPECT().CreateContestTeam(anyCtx{}, contestID, &args).Return(&want, nil) | ||
return reqBody, expectedResBody, fmt.Sprintf("/api/v1/contests/%s/teams", contestID) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここメンバー1つでもいいので入れ他方がよさそう