summaryrefslogtreecommitdiff
path: root/src/main/java/design
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/design')
-rw-r--r--src/main/java/design/model/Golfer.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/design/model/Golfer.java b/src/main/java/design/model/Golfer.java
index 38a3ba9..77f411f 100644
--- a/src/main/java/design/model/Golfer.java
+++ b/src/main/java/design/model/Golfer.java
@@ -15,16 +15,18 @@ public class Golfer {
private final List<Round> rounds;
private final List<Club> clubs; // Keep track of golfer's clubs
private int nextClubId;
+ private final List<Invite> invites;
@JsonCreator
private Golfer(String username, int passwordHash, String fullName, List<Course> courses, List<Round> rounds,
- List<Club> clubs) {
+ List<Club> clubs, List<Invite> invites) {
this.username = username;
this.passwordHash = passwordHash;
this.fullName = fullName;
this.courses = courses;
this.rounds = rounds;
this.clubs = clubs;
+ this.invites = invites;
this.nextClubId = this.clubs.stream().mapToInt(Club::getId).max().orElse(0) + 1;
}
@@ -35,6 +37,7 @@ public class Golfer {
this.courses = new ArrayList<>();
this.rounds = new ArrayList<>();
this.clubs = new ArrayList<>();
+ this.invites = new ArrayList<>();
this.nextClubId = 1;
}
@@ -112,4 +115,16 @@ public class Golfer {
public void removeClub(Club c) {
clubs.remove(c);
}
+
+ public boolean addInvite(Invite invite) {
+ return invites.add(invite);
+ }
+
+ public boolean removeInvite(Invite o) {
+ return invites.remove(o);
+ }
+
+ public Invite[] getInvites() {
+ return invites.toArray(Invite[]::new);
+ }
}