Rename name to id in the stored badge information and expose id in the profile endpoint

This commit is contained in:
Ehren Kret
2021-09-15 16:49:20 -05:00
parent 34e21b9f7b
commit 8a8e6e7b49
4 changed files with 32 additions and 22 deletions

View File

@@ -11,20 +11,27 @@ import java.net.URL;
import java.util.Objects;
public class Badge {
private final String id;
private final URL imageUrl;
private final String name;
private final String description;
@JsonCreator
public Badge(
@JsonProperty("id") final String id,
@JsonProperty("imageUrl") final URL imageUrl,
@JsonProperty("name") final String name,
@JsonProperty("description") final String description) {
this.id = id;
this.imageUrl = imageUrl;
this.name = name;
this.description = description;
}
public String getId() {
return id;
}
public URL getImageUrl() {
return imageUrl;
}
@@ -46,12 +53,13 @@ public class Badge {
return false;
}
Badge badge = (Badge) o;
return Objects.equals(imageUrl, badge.imageUrl) && Objects.equals(name,
badge.name) && Objects.equals(description, badge.description);
return Objects.equals(id, badge.id) && Objects.equals(imageUrl,
badge.imageUrl) && Objects.equals(name, badge.name) && Objects.equals(
description, badge.description);
}
@Override
public int hashCode() {
return Objects.hash(imageUrl, name, description);
return Objects.hash(id, imageUrl, name, description);
}
}