Skip to content

Commit

Permalink
Add gameId column to LeagueScoreJournal
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackYps committed Aug 18, 2023
1 parent 0d570f5 commit a9c0630
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@Configuration
public class LeagueDbTestContainers {
private static final MariaDBContainer<?> leagueServiceDBContainer = new MariaDBContainer<>("mariadb:10.6");
private static final GenericContainer<?> leagueServiceContainer = new GenericContainer<>("faforever/faf-league-service:1.3.0");
private static final GenericContainer<?> leagueServiceContainer = new GenericContainer<>("faforever/faf-league-service:1.5.0");
private static final Network sharedNetwork = Network.newNetwork();

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import static com.faforever.api.data.JsonApiMediaType.JSON_API_MEDIA_TYPE;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
Expand Down Expand Up @@ -43,7 +44,15 @@ void anyOneCanReadSpecificLeagueScoreJournal() throws Exception {
mockMvc.perform(
get("/data/leagueScoreJournal/1")
)
.andExpect(status().isOk());
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.attributes.gameId", is(2)))
.andExpect(jsonPath("$.data.attributes.loginId", is(1)))
.andExpect(jsonPath("$.data.attributes.leagueSeasonId", is(1)))
.andExpect(jsonPath("$.data.attributes.subdivisionIdBefore", is(1)))
.andExpect(jsonPath("$.data.attributes.subdivisionIdAfter", is(2)))
.andExpect(jsonPath("$.data.attributes.scoreBefore", is(10)))
.andExpect(jsonPath("$.data.attributes.scoreAfter", is(2)))
.andExpect(jsonPath("$.data.attributes.gameCount", is(22)));
}

@Test
Expand All @@ -57,6 +66,7 @@ void noOneCanCreateLeagueScoreJournal() throws Exception {
"data": {
"type": "leagueScoreJournal",
"attributes": {
"gameId": 10,
"gameCount": 10,
"loginId": 10,
"scoreBefore": 10,
Expand Down
10 changes: 5 additions & 5 deletions src/inttest/resources/sql/league/prepLeagueData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ VALUES (1, 1, 1, 1, 10, 10, FALSE),
(7, 1, 2, 7, 22, 20, FALSE),
(8, 1, 2, 8, 23, 20, FALSE);

INSERT INTO league_score_journal (id, login_id, league_season_id, subdivision_id_before, subdivision_id_after,
INSERT INTO league_score_journal (id, game_id, login_id, league_season_id, subdivision_id_before, subdivision_id_after,
score_before, score_after, game_count)
VALUES (1, 1, 1, 1, 2, 10, 2, 22),
(2, 1, 1, 2, 2, 2, 3, 23),
(3, 5, 1, 3, 3, 7, 6, 11),
(4, 5, 1, 3, 3, 6, 5, 12);
VALUES (1, 2, 1, 1, 1, 2, 10, 2, 22),
(2, 2, 1, 1, 2, 2, 2, 3, 23),
(3, 2, 5, 1, 3, 3, 7, 6, 11),
(4, 2, 5, 1, 3, 3, 6, 5, 12);
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class LeagueScoreJournal {
public static final String TYPE_NAME = "leagueScoreJournal";

private Integer id;
private Integer gameId;
private Integer loginId;
private LeagueSeason leagueSeason;
private LeagueSeasonDivisionSubdivision leagueSeasonDivisionSubdivisionBefore;
Expand All @@ -35,6 +36,11 @@ public Integer getId() {
return id;
}

@Column(name = "game_id")
public Integer getGameId() {
return gameId;
}

@Column(name = "login_id")
public Integer getLoginId() {
return loginId;
Expand Down

0 comments on commit a9c0630

Please sign in to comment.