Skip to content

Commit

Permalink
Feedback class, added an attribute to charity that contain a list of …
Browse files Browse the repository at this point in the history
…feedbacks
  • Loading branch information
AdrianBalunan committed Feb 19, 2026
1 parent 95563c2 commit 35a6362
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -26,6 +28,9 @@ abstract class Charity {
/* Category for the charity */
private String category;

/* List that contains the charity's Feedbacks */
private List<Feedback> feedbacks;

/**
* Konstructor for creating a new charity.
* The ID is generated automatically using UUID.
Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Binary file not shown.
Binary file not shown.

0 comments on commit 35a6362

Please sign in to comment.