From f4fc2ba6d78b6641a376b1a780d7bf8f84beeeb8 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Wed, 11 Mar 2026 15:48:29 +0100 Subject: [PATCH] Fix/Feat: Charity class looks very similar to APICharityData, will keep APICharityData though. --- .../sytemutvikling/team6/models/Charity.java | 86 +++++++++++-------- 1 file changed, 52 insertions(+), 34 deletions(-) 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 2c2cb3f..103fe81 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java @@ -8,11 +8,10 @@ import java.util.ArrayList; import java.util.List; -import java.util.UUID; public class Charity { /* UUID for uniquely identifying each charity */ - private UUID id; + private String org_number; /* Name of the charity */ private String name; @@ -20,11 +19,10 @@ public class Charity { /* Description of the charity's mission and activities */ private String description; - /* Total Donations received */ - private int totalDonations; - /* Is the charity verified? */ - private boolean isVerified; + private String status; + + private boolean is_pre_approved; /* Category for the charity */ private String category; @@ -33,26 +31,61 @@ public class Charity { private List feedbacks; /** - * Konstructor for creating a new charity. The ID is generated automatically using UUID. Total - * donations are initialized to 0. The charity is unverified by default. + * Contructor for creating a new charity. The charity is unverified by default. * - * @param name - * @param description - * @param category + * @param org_number matches from innsamlingkontrollen + * @param name matches from innsamlingkontrollen + * @param is_pre_approved name matches from innsamlingkontrollen + * @param status name matches from innsamlingkontrollen + * @param description no coreleation to innsamlingskontrollen + * @param category no coreleation to innsamlingskontrollen + * + */ - public Charity(String name, String description, String category) { - this.id = UUID.randomUUID(); + public Charity(String org_number, String name, String description, String category, boolean is_pre_approved, String status) { + this.org_number = org_number.replaceAll("\\s", ""); this.name = name; this.description = description; - this.totalDonations = 0; - this.isVerified = false; + this.is_pre_approved = is_pre_approved; + this.status = status; this.feedbacks = new ArrayList<>(); this.category = category; } + /** + * Contructor for creating a new charity. Taylored to match data given from Api. + * Other attributes will just be initialized as empty + * + * @param org_number matches from innsamlingkontrollen + * @param name matches from innsamlingkontrollen + * @param is_pre_approved name matches from innsamlingkontrollen + * @param status name matches from innsamlingkontrollen + * + + */ + public Charity(String org_number, String name, String category, boolean is_pre_approved, String status) { + this.org_number = org_number.replaceAll("\\s", ""); + this.name = name; + this.description = ""; + this.is_pre_approved = is_pre_approved; + this.status = status; + this.feedbacks = new ArrayList<>(); + this.category = ""; + } + /** Getters for the charity's attributes. */ - public UUID getId() { - return id; + public String getOrg_number() { + return org_number; + } + + public String getStatus() { + return status; + } + + public boolean getPreApproved(){return is_pre_approved;} + + public List getFeedbacks() { + return feedbacks; } public String getCategory() { @@ -67,29 +100,14 @@ public String getDescription() { return description; } - public int getTotalDonations() { - return totalDonations; - } - - public boolean isVerified() { - return isVerified; - } - /** Setter for verification status. This one sets the charity as verified. */ public void setVerified() { - this.isVerified = true; + this.status = "Approved"; } /** Setter for verification status. This one sets the charity as unverified. */ public void setUnverified() { - this.isVerified = false; + this.status = "Veto"; } - /** - * Setter for total donations. This method is used to update the total donations when a new - * donation is made. - */ - public void setTotalDonations(int amount) { - this.totalDonations += amount; - } }