Updated more UI. Enhanced login capabilities. Started work on querying data.
This commit is contained in:
parent
40a0e4046a
commit
052052d76b
29 changed files with 706 additions and 424 deletions
36
backend/src/main/java/achievements/data/APError.java
Normal file
36
backend/src/main/java/achievements/data/APError.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package achievements.data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class APError {
|
||||
|
||||
@JsonProperty("code")
|
||||
private int code;
|
||||
@JsonProperty("message")
|
||||
private String message;
|
||||
|
||||
public APError(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public APError(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
157
backend/src/main/java/achievements/data/Achievement.java
Normal file
157
backend/src/main/java/achievements/data/Achievement.java
Normal file
|
@ -0,0 +1,157 @@
|
|||
package achievements.data;
|
||||
|
||||
import achievements.data.query.NumericFilter;
|
||||
import achievements.data.query.StringFilter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Achievement {
|
||||
|
||||
public static class Query {
|
||||
|
||||
@JsonProperty("sessionKey")
|
||||
private String sessionKey;
|
||||
@JsonProperty("name")
|
||||
private StringFilter name;
|
||||
@JsonProperty("stages")
|
||||
private NumericFilter stages;
|
||||
@JsonProperty("completion")
|
||||
private NumericFilter completion;
|
||||
@JsonProperty("difficulty")
|
||||
private NumericFilter difficulty;
|
||||
@JsonProperty("quality")
|
||||
private NumericFilter quality;
|
||||
|
||||
public Query(String sessionKey, StringFilter name, NumericFilter stages, NumericFilter completion, NumericFilter difficulty, NumericFilter quality) {
|
||||
this.sessionKey = sessionKey;
|
||||
this.name = name;
|
||||
this.stages = stages;
|
||||
this.completion = completion;
|
||||
this.difficulty = difficulty;
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
public String getSessionKey() {
|
||||
return sessionKey;
|
||||
}
|
||||
|
||||
public void setSessionKey(String sessionKey) {
|
||||
this.sessionKey = sessionKey;
|
||||
}
|
||||
|
||||
public StringFilter getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(StringFilter name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public NumericFilter getStages() {
|
||||
return stages;
|
||||
}
|
||||
|
||||
public void setStages(NumericFilter stages) {
|
||||
this.stages = stages;
|
||||
}
|
||||
|
||||
public NumericFilter getCompletion() {
|
||||
return completion;
|
||||
}
|
||||
|
||||
public void setCompletion(NumericFilter completion) {
|
||||
this.completion = completion;
|
||||
}
|
||||
|
||||
public NumericFilter getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public void setDifficulty(NumericFilter difficulty) {
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
|
||||
public NumericFilter getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public void setQuality(NumericFilter quality) {
|
||||
this.quality = quality;
|
||||
}
|
||||
}
|
||||
|
||||
@JsonProperty("ID")
|
||||
private int id;
|
||||
@JsonProperty("game")
|
||||
private int gameId;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("description")
|
||||
private String description;
|
||||
@JsonProperty("stages")
|
||||
private int stages;
|
||||
@JsonProperty("completion")
|
||||
private float completion;
|
||||
@JsonProperty("difficulty")
|
||||
private float difficulty;
|
||||
@JsonProperty("quality")
|
||||
private float quality;
|
||||
|
||||
public Achievement(int id, int gameId, String name, String description, int stages, float completion, float difficulty, float quality) {
|
||||
this.id = id;
|
||||
this.gameId = gameId;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.stages = stages;
|
||||
this.completion = completion;
|
||||
this.difficulty = difficulty;
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
public int getId() { return id; }
|
||||
|
||||
public void setId(int id) { this.id = id; }
|
||||
|
||||
public int getGameId() {
|
||||
return gameId;
|
||||
}
|
||||
|
||||
public void setGameId(int gameId) {
|
||||
this.gameId = gameId;
|
||||
}
|
||||
|
||||
public String getName() { return name; }
|
||||
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
public String getDescription() { return description; }
|
||||
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
|
||||
public int getStages() { return stages; }
|
||||
|
||||
public void setStages(int stages) { this.stages = stages; }
|
||||
|
||||
public float getCompletion() {
|
||||
return completion;
|
||||
}
|
||||
|
||||
public void setCompletion(float completion) {
|
||||
this.completion = completion;
|
||||
}
|
||||
|
||||
public float getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public void setDifficulty(float difficulty) {
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
|
||||
public float getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public void setQuality(float quality) {
|
||||
this.quality = quality;
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package achievements.data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Achievements {
|
||||
|
||||
public static class Achievement {
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("description")
|
||||
private String description;
|
||||
@JsonProperty("stages")
|
||||
private int stages;
|
||||
|
||||
public Achievement(String name, String description, int stages) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.stages = stages;
|
||||
}
|
||||
|
||||
// Start Getters/Setters
|
||||
public String getName() { return name; }
|
||||
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
public String getDescription() { return description; }
|
||||
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
|
||||
public int getStages() { return stages; }
|
||||
|
||||
public void setStages(int stages) { this.stages = stages; }
|
||||
// End Getters/Setters
|
||||
}
|
||||
|
||||
@JsonProperty("gameID")
|
||||
private int gameID;
|
||||
@JsonProperty("gameName")
|
||||
private String gameName;
|
||||
@JsonProperty("achievements")
|
||||
private List<Achievement> achievements;
|
||||
|
||||
public Achievements() { achievements = new ArrayList<Achievement>(); }
|
||||
|
||||
// Start Getters/Setters
|
||||
public int getGameID() { return gameID; }
|
||||
|
||||
public void setGameID(int gameID) { this.gameID = gameID; }
|
||||
|
||||
public String getGameName() { return gameName; }
|
||||
|
||||
public void setGameName(String gameName) { this.gameName = gameName; }
|
||||
|
||||
public List<Achievement> getAchievements() { return achievements; }
|
||||
|
||||
public void setAchievements(List<Achievement> achievements) { this.achievements = achievements; }
|
||||
// End Getters/Setters
|
||||
|
||||
public void addAchievement(Achievement achievement) { this.achievements.add(achievement); };
|
||||
}
|
47
backend/src/main/java/achievements/data/Game.java
Normal file
47
backend/src/main/java/achievements/data/Game.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package achievements.data;
|
||||
|
||||
import achievements.data.query.StringFilter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Game {
|
||||
|
||||
public static class Query {
|
||||
@JsonProperty("name")
|
||||
private StringFilter name;
|
||||
@JsonProperty("platforms")
|
||||
private StringFilter platforms;
|
||||
}
|
||||
|
||||
@JsonProperty("ID")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("platforms")
|
||||
private List<String> platforms;
|
||||
@JsonProperty("achievementCount")
|
||||
private int achievementCount;
|
||||
|
||||
public Game(int id, String name, String platform) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.platforms = new ArrayList<>();
|
||||
this.platforms.add(platform);
|
||||
}
|
||||
|
||||
public int getId() { return id; }
|
||||
|
||||
public void setId(int id) { this.id = id; }
|
||||
|
||||
public String getName() { return name; }
|
||||
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
public List<String> getPlatforms() { return platforms; }
|
||||
|
||||
public void setPlatforms(List<String> platforms) { this.platforms = platforms; }
|
||||
|
||||
public void addToPlatforms(String platform) { this.platforms.add(platform); }
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package achievements.data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Games {
|
||||
|
||||
public static class Game {
|
||||
|
||||
@JsonProperty("ID")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("platforms")
|
||||
private List<String> platforms;
|
||||
|
||||
public Game(int id, String name, String platform) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.platforms = new ArrayList<>();
|
||||
this.platforms.add(platform);
|
||||
}
|
||||
|
||||
// Start Getters/Setters
|
||||
public int getId() { return id; }
|
||||
|
||||
public void setId(int id) { this.id = id; }
|
||||
|
||||
public String getName() { return name; }
|
||||
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
public List<String> getPlatforms() { return platforms; }
|
||||
|
||||
public void setPlatforms(List<String> platforms) { this.platforms = platforms; }
|
||||
|
||||
public void addToPlatforms(String platform) { this.platforms.add(platform); }
|
||||
// End Getters/Setters
|
||||
|
||||
}
|
||||
|
||||
@JsonProperty("games")
|
||||
private List<Game> games;
|
||||
|
||||
public Games() { games = new ArrayList<Game>(); }
|
||||
|
||||
// Start Getters/Setters
|
||||
public List<Game> getGames() { return games; }
|
||||
|
||||
public void setGames(List<Game> games) { this.games = games; }
|
||||
// End Getters/Setters
|
||||
|
||||
public void addGame(Game game) { this.games.add(game); }
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package achievements.data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class InternalError {
|
||||
|
||||
@JsonProperty
|
||||
private String message;
|
||||
|
||||
public InternalError(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
73
backend/src/main/java/achievements/data/Profile.java
Normal file
73
backend/src/main/java/achievements/data/Profile.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
package achievements.data;
|
||||
|
||||
import achievements.data.query.StringFilter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Profile {
|
||||
|
||||
public static class Query {
|
||||
@JsonProperty("username")
|
||||
private StringFilter string;
|
||||
}
|
||||
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("username")
|
||||
private String username;
|
||||
@JsonProperty("plaforms")
|
||||
private List<String> platforms;
|
||||
@JsonProperty("games")
|
||||
private List<Game> games;
|
||||
@JsonProperty("achievements")
|
||||
private List<Achievement> achievements;
|
||||
|
||||
public Profile(int id, String username, List<String> platforms, List<Game> games, List<Achievement> achievements) {
|
||||
this.id = id;
|
||||
this.username = username;
|
||||
this.platforms = platforms;
|
||||
this.games = games;
|
||||
this.achievements = achievements;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public List<String> getPlatforms() {
|
||||
return platforms;
|
||||
}
|
||||
|
||||
public void setPlatforms(List<String> platforms) {
|
||||
this.platforms = platforms;
|
||||
}
|
||||
|
||||
public List<Game> getGames() {
|
||||
return games;
|
||||
}
|
||||
|
||||
public void setGames(List<Game> games) {
|
||||
this.games = games;
|
||||
}
|
||||
|
||||
public List<Achievement> getAchievements() {
|
||||
return achievements;
|
||||
}
|
||||
|
||||
public void setAchievements(List<Achievement> achievements) {
|
||||
this.achievements = achievements;
|
||||
}
|
||||
}
|
43
backend/src/main/java/achievements/data/Session.java
Normal file
43
backend/src/main/java/achievements/data/Session.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
package achievements.data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Session {
|
||||
|
||||
@JsonProperty("key")
|
||||
private String key;
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("hue")
|
||||
private int hue;
|
||||
|
||||
public Session(String key, int id, int hue) {
|
||||
this.key = key;
|
||||
this.id = id;
|
||||
this.hue = hue;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getHue() {
|
||||
return hue;
|
||||
}
|
||||
|
||||
public void setHue(int hue) {
|
||||
this.hue = hue;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package achievements.data.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class NumericFilter {
|
||||
|
||||
@JsonProperty("min")
|
||||
private Float min;
|
||||
@JsonProperty("max")
|
||||
private Float max;
|
||||
|
||||
public NumericFilter(Float min, Float max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public Float getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(Float min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public Float getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(Float max) {
|
||||
this.max = max;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package achievements.data.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class StringFilter {
|
||||
|
||||
@JsonProperty("query")
|
||||
private String query;
|
||||
|
||||
public StringFilter(String query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query) {
|
||||
this.query = query;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue