Skip to content

Commit 008135f

Browse files
committed
Closes #899 Add avatar description field
1 parent cfab40d commit 008135f

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ services:
1616
- "3306:3306"
1717

1818
faf-db-migrations:
19-
image: faforever/faf-db-migrations:v136
19+
image: faforever/faf-db-migrations:v137
2020
command: migrate
2121
environment:
2222
FLYWAY_URL: jdbc:mysql://faf-db/faf?useSSL=false

src/inttest/java/com/faforever/api/config/MainDbTestContainers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
@ConditionalOnProperty(value = "spring.datasource.url", havingValue = "jdbc:mariadb://testcontainers/faf?useSSL=false")
2121
@Configuration
2222
public class MainDbTestContainers {
23-
private static final MariaDBContainer<?> fafDBContainer = new MariaDBContainer<>("mariadb:10.6");
24-
private static final GenericContainer<?> flywayMigrationsContainer = new GenericContainer<>("faforever/faf-db-migrations:v136");
23+
private static final MariaDBContainer<?> fafDBContainer = new MariaDBContainer<>("mariadb:11.7");
24+
private static final GenericContainer<?> flywayMigrationsContainer = new GenericContainer<>("faforever/faf-db-migrations:v137");
2525
private static final Network sharedNetwork = Network.newNetwork();
2626

2727
@Bean

src/inttest/java/com/faforever/api/data/AvatarAssignmentElideTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void getUnusedAvatar() throws Exception {
3737
.andExpect(jsonPath("$.data.type", is("avatar")))
3838
.andExpect(jsonPath("$.data.attributes.tooltip", is("Donator Avatar")))
3939
.andExpect(jsonPath("$.data.attributes.url", is("http://localhost/faf/avatars/donator.png")))
40+
.andExpect(jsonPath("$.data.attributes.description", is("Only for donators")))
4041
.andExpect(jsonPath("$.data.relationships.assignments.data", hasSize(0)));
4142
}
4243

src/inttest/resources/sql/prepAvatarData.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
INSERT INTO avatars_list (id, filename, tooltip)
2-
VALUES (1, 'avatar1.png', 'Avatar No. 1'),
3-
(2, 'avatar2.png', 'Avatar No. 2'),
4-
(3, 'donator.png', 'Donator Avatar'),
5-
(4, 'avatar space.png', 'Space Avatar');
1+
INSERT INTO avatars_list (id, filename, tooltip, avatar_text_description)
2+
VALUES (1, 'avatar1.png', 'Avatar No. 1', null),
3+
(2, 'avatar2.png', 'Avatar No. 2', null),
4+
(3, 'donator.png', 'Donator Avatar', 'Only for donators'),
5+
(4, 'avatar space.png', 'Space Avatar', null);
66

77
INSERT INTO avatars (id, idUser, idAvatar, selected)
88
VALUES (1, 5, 1, 1),

src/main/java/com/faforever/api/data/domain/Avatar.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class Avatar extends AbstractEntity<Avatar> {
3232
private String url;
3333
private String tooltip;
3434
private String filename;
35+
private String description;
3536
private List<AvatarAssignment> assignments;
3637

3738
@Transient
@@ -50,6 +51,12 @@ public String getTooltip() {
5051
return tooltip;
5152
}
5253

54+
@Column(name = "avatar_text_description")
55+
@UpdatePermission(expression = WriteAvatarCheck.EXPRESSION)
56+
public String getDescription() {
57+
return description;
58+
}
59+
5360
// Cascading is needed for Create & Delete
5461
@OneToMany(mappedBy = "avatar", cascade = CascadeType.ALL, orphanRemoval = true)
5562
// Permission is managed by AvatarAssignment class

src/main/resources/config/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ faf-api:
1616
hmac-secret: ${CLOUDFLARE_HMAC_SECRET}
1717
hmac-param: ${CLOUDFLARE_HMAC_PARAM:verify}
1818
database:
19-
schema-version: ${DATABASE_SCHEMA_VERSION:136}
19+
schema-version: ${DATABASE_SCHEMA_VERSION:137}
2020
deployment:
2121
forged-alliance-exe-path: ${FORGED_ALLIANCE_EXE_PATH:/content/legacy-featured-mod-files/updates_faf_files/ForgedAlliance.exe}
2222
repositories-directory: ${REPOSITORIES_DIRECTORY:/repositories}

0 commit comments

Comments
 (0)