diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java index 7390917..3106d09 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java @@ -5,7 +5,9 @@ */ package ntnu.sytemutvikling.team6.models; +import java.util.List; import java.util.UUID; +import java.util.ArrayList; abstract class Charity { /* UUID for uniquely identifying each charity */ @@ -26,6 +28,9 @@ abstract class Charity { /* Category for the charity */ private String category; + /* List that contains the charity's Feedbacks */ + private List feedbacks; + /** * Konstructor for creating a new charity. * The ID is generated automatically using UUID. @@ -42,6 +47,7 @@ public Charity(String name, String description, String category) { this.description = description; this.totalDonations = 0; this.isVerified = false; + this.feedbacks = new ArrayList<>(); this.category = category; } diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java index 1cea4ca..891dce1 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java @@ -1,4 +1,65 @@ package ntnu.sytemutvikling.team6.models; +import java.time.LocalDateTime; +import java.util.UUID; + public class Feedback { + /* Feedback id */ + private UUID feedbackId; + + /** + * The author of the feedback + * If annonymous the presentation of the user will be "Anonymous". + */ + private User user; + + /* The details of the feedback*/ + private String comment; + + /* The date and time when the feedback was given */ + private LocalDateTime date; + + /* Is the feedback given anonymously? */ + private boolean isAnonymous; + + /** + * Constructor for creating a new feedback. + * + * @param user The user who gives the feedback. + * @param comment The content of the feedback. + */ + public Feedback(User user, String comment) { + this.feedbackId = UUID.randomUUID(); + this.user = user; + this.comment = comment; + this.date = LocalDateTime.now(); + + // ASSUMES that this is the way to get the anonymous setting from the user's settings. + if (user.getSettings().getAnonymous() == false) { + this.isAnonymous = true; + } else { + this.isAnonymous = false; + } + } + + /** + * Getters for the feedback's attributes. + * + * @return The feedback's attributes. + */ + public UUID getFeedbackId() { + return feedbackId; + } + public String getComment() { + return comment; + } + public LocalDateTime getDate() { + return date; + } + public User getUser() { + return user; + } + public boolean isAnonymous() { + return isAnonymous; + } } diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class index 506a404..b2e6c9c 100644 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class and b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class differ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class index 5dfb005..1f4b3ad 100644 Binary files a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class and b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class differ