-
Notifications
You must be signed in to change notification settings - Fork 0
[WIP]Feat/local database #168
base: feat/API_client
Are you sure you want to change the base?
Conversation
d65ea3f
to
ad5860b
Compare
afa53e7
to
65dedc7
Compare
import ch.epfl.sweng.erpa.database.converter.*; | ||
import ch.epfl.sweng.erpa.model.*; | ||
|
||
@Database(entities = {Game.class, PlayerJoinGameRequest.class, UserAuth.class, Username.class, UserProfile.class, UserSessionToken.class}, version = 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please restructure into -140 character lines?
} | ||
|
||
|
||
private static final BiMap<Integer, PlayerJoinGameRequest.RequestStatus> requestStatusConversionMap = genRequestStatusConversionMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use @Getter(lazy=true)
|
||
/** | ||
* Builds a conversion map for the RequestStatus enum | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superfluous comments, this is simple enough to be understood from the reference name.
result.put(10, Game.Difficulty.NOOB); | ||
result.put(20, Game.Difficulty.CHILL); | ||
result.put(30, Game.Difficulty.HARD); | ||
assert conversionMapHasAll(result, Game.Difficulty.values()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@Data | ||
@Builder(toBuilder = true) | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Game implements UuidObject { | ||
@NonNull private String uuid; | ||
@android.support.annotation.NonNull @PrimaryKey @NonNull private String uuid = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the ""
default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need it?
@ColumnInfo @NonNull private Difficulty difficulty; | ||
@ColumnInfo @NonNull private String universe; | ||
@ColumnInfo @NonNull private Boolean isCampaign; | ||
@ColumnInfo @NonNull private Optional<Integer> numberOfSessions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you forget to specify the column name? or the name attribute in lines 30 and 31 is superfluos?
public class PlayerJoinGameRequest { | ||
@NonNull private String joinRequestId; | ||
@android.support.annotation.NonNull @PrimaryKey @NonNull private String joinRequestId = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the default value
@NonNull private String userUuid; | ||
@NonNull private String username; | ||
@ColumnInfo | ||
@android.support.annotation.NonNull @PrimaryKey @NonNull private String username = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the default value
@NonNull private String userUuid; | ||
@NonNull private String sessionToken; | ||
@PrimaryKey @android.support.annotation.NonNull @NonNull private String sessionToken = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the default value
No description provided.