From b80389058bb14d2c1c38318d1756418792b82d5f Mon Sep 17 00:00:00 2001 From: sowgro Date: Sun, 9 Nov 2025 17:36:15 -0500 Subject: add invites to golfer --- src/main/java/design/model/Golfer.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 rounds; private final List clubs; // Keep track of golfer's clubs private int nextClubId; + private final List invites; @JsonCreator private Golfer(String username, int passwordHash, String fullName, List courses, List rounds, - List clubs) { + List clubs, List 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); + } } -- cgit v1.2.3