Skip to content

Commit b1e7fca

Browse files
authored
Add gameId column to LeagueScoreJournal (FAForever#772)
1 parent c89eb5b commit b1e7fca

5 files changed

Lines changed: 24 additions & 8 deletions

File tree

‎src/inttest/java/com/faforever/api/config/LeagueDbTestContainers.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@Configuration
2121
public class LeagueDbTestContainers {
2222
private static final MariaDBContainer<?> leagueServiceDBContainer = new MariaDBContainer<>("mariadb:10.6");
23-
private static final GenericContainer<?> leagueServiceContainer = new GenericContainer<>("faforever/faf-league-service:1.3.0");
23+
private static final GenericContainer<?> leagueServiceContainer = new GenericContainer<>("faforever/faf-league-service:1.5.0");
2424
private static final Network sharedNetwork = Network.newNetwork();
2525

2626
@Bean

‎src/inttest/java/com/faforever/api/league/LeaderboardElideTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void anyOneCanReadAllLeaderboard() throws Exception {
2929
.with(getOAuthTokenWithActiveUser(NO_SCOPE, NO_AUTHORITIES))
3030
)
3131
.andExpect(status().isOk())
32-
.andExpect(jsonPath("$.data[*]", hasSize(5)));
32+
.andExpect(jsonPath("$.data[*]", hasSize(6)));
3333
}
3434

3535
@Test

‎src/inttest/java/com/faforever/api/league/LeagueScoreJournalElideTest.java‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import static com.faforever.api.data.JsonApiMediaType.JSON_API_MEDIA_TYPE;
1111
import static org.hamcrest.Matchers.hasSize;
12+
import static org.hamcrest.Matchers.is;
1213
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
1314
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
1415
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
@@ -46,7 +47,15 @@ void anyOneCanReadSpecificLeagueScoreJournal() throws Exception {
4647
get("/data/leagueScoreJournal/1")
4748
.with(getOAuthTokenWithActiveUser(NO_SCOPE, NO_AUTHORITIES))
4849
)
49-
.andExpect(status().isOk());
50+
.andExpect(status().isOk())
51+
.andExpect(jsonPath("$.data.attributes.gameId", is(2)))
52+
.andExpect(jsonPath("$.data.attributes.loginId", is(1)))
53+
.andExpect(jsonPath("$.data.relationships.leagueSeason.data.id", is("1")))
54+
.andExpect(jsonPath("$.data.relationships.leagueSeasonDivisionSubdivisionBefore.data.id", is("1")))
55+
.andExpect(jsonPath("$.data.relationships.leagueSeasonDivisionSubdivisionAfter.data.id", is("2")))
56+
.andExpect(jsonPath("$.data.attributes.scoreBefore", is(10)))
57+
.andExpect(jsonPath("$.data.attributes.scoreAfter", is(2)))
58+
.andExpect(jsonPath("$.data.attributes.gameCount", is(22)));
5059
}
5160

5261
@Test
@@ -60,6 +69,7 @@ void noOneCanCreateLeagueScoreJournal() throws Exception {
6069
"data": {
6170
"type": "leagueScoreJournal",
6271
"attributes": {
72+
"gameId": 10,
6373
"gameCount": 10,
6474
"loginId": 10,
6575
"scoreBefore": 10,

‎src/inttest/resources/sql/league/prepLeagueData.sql‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ VALUES (1, 1, 1, 1, 10, 10, FALSE),
3434
(7, 1, 2, 7, 22, 20, FALSE),
3535
(8, 1, 2, 8, 23, 20, FALSE);
3636

37-
INSERT INTO league_score_journal (id, login_id, league_season_id, subdivision_id_before, subdivision_id_after,
37+
INSERT INTO league_score_journal (id, game_id, login_id, league_season_id, subdivision_id_before, subdivision_id_after,
3838
score_before, score_after, game_count)
39-
VALUES (1, 1, 1, 1, 2, 10, 2, 22),
40-
(2, 1, 1, 2, 2, 2, 3, 23),
41-
(3, 5, 1, 3, 3, 7, 6, 11),
42-
(4, 5, 1, 3, 3, 6, 5, 12);
39+
VALUES (1, 2, 1, 1, 1, 2, 10, 2, 22),
40+
(2, 2, 1, 1, 2, 2, 2, 3, 23),
41+
(3, 2, 5, 1, 3, 3, 7, 6, 11),
42+
(4, 2, 5, 1, 3, 3, 6, 5, 12);

‎src/main/java/com/faforever/api/league/domain/LeagueScoreJournal.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class LeagueScoreJournal {
2020
public static final String TYPE_NAME = "leagueScoreJournal";
2121

2222
private Integer id;
23+
private Integer gameId;
2324
private Integer loginId;
2425
private LeagueSeason leagueSeason;
2526
private LeagueSeasonDivisionSubdivision leagueSeasonDivisionSubdivisionBefore;
@@ -35,6 +36,11 @@ public Integer getId() {
3536
return id;
3637
}
3738

39+
@Column(name = "game_id")
40+
public Integer getGameId() {
41+
return gameId;
42+
}
43+
3844
@Column(name = "login_id")
3945
public Integer getLoginId() {
4046
return loginId;

0 commit comments

Comments
 (0)