Skip to content

Feature/58 final delivery updated database #62

Merged
merged 34 commits into from
Apr 12, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
76bf669
Fix: DatabaseConnection should actually be a little private
Apr 2, 2026
a19c6a3
Feat: First draft of database (ER-diagram)
Apr 5, 2026
134c25e
Feat: First draft of database (ER-diagram)
Apr 5, 2026
46e2efa
Feat: Added trigger. So when a user is added, an settings row is auto…
Apr 5, 2026
f69f2d8
Fix: Trigger is not premittable (i dont have privilege) and added bac…
Apr 5, 2026
d9585fd
Fix: Trigger is not premittable (i dont have privilege) and added bac…
Apr 5, 2026
38e7173
Feat: Sql scripts
Apr 7, 2026
5d2a158
Feat: Updated createTables function to new tables
Apr 7, 2026
96eec1d
Fix: Maven formatting and naming conventions
Apr 7, 2026
9457c26
Fix: Better coding convention
Apr 7, 2026
a13676d
Fix: Better coding convention
Apr 7, 2026
48b2235
On hold: Trying to implement feedback getter-method for database. Doe…
Apr 7, 2026
83f5f2d
Feat: UserRegistry added
Apr 7, 2026
b6369e9
Feat: User password field added (whoops)
Apr 7, 2026
d615a1a
Feat: User object has a another constructor taylored for getting data…
Apr 7, 2026
416f75c
Feat: Two new methods for DataManager: GetUser (return user) and getU…
Apr 7, 2026
8db6609
Feat: User set methods (for database)
Apr 7, 2026
dc3e7ea
Feat: user has settings when getting data from database (A method)
Apr 7, 2026
e17ae39
Fix and feat: Changed String from field to UUID for matching of chari…
Apr 7, 2026
a9aad5b
Feat: Users get inbox
Apr 7, 2026
abc92c0
Fix: User-registry return method have the same methods as in User ret…
Apr 7, 2026
cfeaa5d
Feat: New row for user and feedback can now be set when getting chari…
Apr 9, 2026
92ec053
Feat: Folder for sql
Apr 9, 2026
7503df6
Fix: Refined methods to prevent N+1 loops query for shorter prosessing
Apr 12, 2026
02fbe15
Fix: Futher refined methods to avoid n+1 threading and splitted it fo…
Apr 12, 2026
0b6f9d2
Fix: Moved ApiToDatabaseService thing to service folder as it fits, b…
Apr 12, 2026
2bc2a18
Fix: Updated previous tests
Apr 12, 2026
8d3c6f1
Feat: Added JavaDoc to CharitySelect and Test file
Apr 12, 2026
7d0960c
Maven: mvn clean
Apr 12, 2026
f6d44f7
Fix: Fixed DatabaseSetupTest
Apr 12, 2026
c1c1b7f
Feat: Added DonationSelect JavaDoc And Junit test
Apr 12, 2026
8d26537
Feat: Added UserSelect JavaDoc And Junit test
Apr 12, 2026
a9d8680
Fix: Maven clean and correct functions
Apr 12, 2026
09fcd3f
Merge branch 'develop' of git.ntnu.no:cathrkri/systemutviklingTeam6 i…
Apr 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed docs/ER-DiagramFile.mwb
Binary file not shown.
Binary file removed docs/ER-DiagramFile.mwb.bak
Binary file not shown.
File renamed without changes
File renamed without changes
Binary file added docs/SqlDatabase/ER-Diagram v3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/SqlDatabase/ER-Diagram v4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/SqlDatabase/ER-DiagramFile.mwb
Binary file not shown.
Binary file added docs/SqlDatabase/ER-DiagramFile.mwb.bak
Binary file not shown.
203 changes: 203 additions & 0 deletions docs/SqlDatabase/Sql_script_v1.1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
-- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

-- -----------------------------------------------------
-- Schema apbaluna
-- -----------------------------------------------------

-- -----------------------------------------------------
-- Schema apbaluna
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `apbaluna` DEFAULT CHARACTER SET utf8 ;
USE `apbaluna` ;

-- -----------------------------------------------------
-- Table `apbaluna`.`Charities`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `apbaluna`.`Charities` (
`UUID_charities` CHAR(36) NOT NULL,
`org_number` VARCHAR(255) NOT NULL,
`charity_name` VARCHAR(255) NOT NULL,
`charity_description` VARCHAR(255) NOT NULL,
`charity_link` VARCHAR(255) NOT NULL,
`pre_approved` TINYINT NOT NULL,
`status` VARCHAR(255) NOT NULL,
PRIMARY KEY (`UUID_charities`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `apbaluna`.`User`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `apbaluna`.`User` (
`UUID_User` CHAR(36) NOT NULL,
`user_name` VARCHAR(255) NOT NULL,
`user_email` VARCHAR(255) NOT NULL,
`role` VARCHAR(45) NOT NULL,
PRIMARY KEY (`UUID_User`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `apbaluna`.`Donations`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `apbaluna`.`Donations` (
`UUID_Donations` CHAR(36) NOT NULL,
`amount` DECIMAL NOT NULL,
`date` DATE NOT NULL,
`charity_id` CHAR(36) NOT NULL,
`user_id` CHAR(36) NOT NULL,
PRIMARY KEY (`UUID_Donations`),
INDEX `fk_Donations_Charities_idx` (`charity_id` ASC) VISIBLE,
INDEX `fk_Donations_User1_idx` (`user_id` ASC) VISIBLE,
CONSTRAINT `fk_Donations_Charities`
FOREIGN KEY (`charity_id`)
REFERENCES `apbaluna`.`Charities` (`UUID_charities`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Donations_User1`
FOREIGN KEY (`user_id`)
REFERENCES `apbaluna`.`User` (`UUID_User`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `apbaluna`.`Settings`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `apbaluna`.`Settings` (
`User_UUID_User` CHAR(36) NOT NULL,
`isAnonymous` TINYINT NOT NULL,
`language` VARCHAR(45) NOT NULL,
`lightmode` TINYINT NOT NULL,
PRIMARY KEY (`User_UUID_User`),
INDEX `fk_Settings_User1_idx` (`User_UUID_User` ASC) VISIBLE,
CONSTRAINT `fk_Settings_User1`
FOREIGN KEY (`User_UUID_User`)
REFERENCES `apbaluna`.`User` (`UUID_User`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `apbaluna`.`Messages`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `apbaluna`.`Messages` (
`UUID_message` CHAR(36) NOT NULL,
`message_title` VARCHAR(255) NOT NULL,
`message_content` VARCHAR(255) NOT NULL,
`message_date` DATE NOT NULL,
`sender_user_id` CHAR(36) NULL,
`sender_charity_id` CHAR(36) NULL,
`user_id` CHAR(36) NOT NULL,
PRIMARY KEY (`UUID_message`),
INDEX `fk_Messages_User1_idx` (`sender_user_id` ASC) VISIBLE,
INDEX `fk_Messages_Charities1_idx` (`sender_charity_id` ASC) VISIBLE,
INDEX `fk_Messages_User2_idx` (`user_id` ASC) VISIBLE,
CONSTRAINT `fk_Messages_User1`
FOREIGN KEY (`sender_user_id`)
REFERENCES `apbaluna`.`User` (`UUID_User`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Messages_Charities1`
FOREIGN KEY (`sender_charity_id`)
REFERENCES `apbaluna`.`Charities` (`UUID_charities`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Messages_User2`
FOREIGN KEY (`user_id`)
REFERENCES `apbaluna`.`User` (`UUID_User`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `apbaluna`.`Feedback`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `apbaluna`.`Feedback` (
`UUID_feedback` CHAR(36) NOT NULL,
`feedback_comment` VARCHAR(255) NOT NULL,
`feedback_date` DATE NOT NULL,
`isAnonymous` TINYINT NOT NULL,
`charity_id` CHAR(36) NOT NULL,
`user_id` CHAR(36) NOT NULL,
PRIMARY KEY (`UUID_feedback`),
INDEX `fk_Feedback_Charities1_idx` (`charity_id` ASC) VISIBLE,
INDEX `fk_Feedback_User1_idx` (`user_id` ASC) VISIBLE,
CONSTRAINT `fk_Feedback_Charities1`
FOREIGN KEY (`charity_id`)
REFERENCES `apbaluna`.`Charities` (`UUID_charities`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Feedback_User1`
FOREIGN KEY (`user_id`)
REFERENCES `apbaluna`.`User` (`UUID_User`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `apbaluna`.`Categories`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `apbaluna`.`Categories` (
`category_id` INT NOT NULL AUTO_INCREMENT,
`category` VARCHAR(255) NOT NULL,
PRIMARY KEY (`category_id`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `apbaluna`.`Charity_Categories`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `apbaluna`.`Charity_Categories` (
`Categories_category_id` INT NOT NULL,
`Charities_UUID_charities` CHAR(36) NOT NULL,
PRIMARY KEY (`Categories_category_id`, `Charities_UUID_charities`),
INDEX `fk_Categories_has_Charities_Charities1_idx` (`Charities_UUID_charities` ASC) VISIBLE,
INDEX `fk_Categories_has_Charities_Categories1_idx` (`Categories_category_id` ASC) VISIBLE,
CONSTRAINT `fk_Categories_has_Charities_Categories1`
FOREIGN KEY (`Categories_category_id`)
REFERENCES `apbaluna`.`Categories` (`category_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Categories_has_Charities_Charities1`
FOREIGN KEY (`Charities_UUID_charities`)
REFERENCES `apbaluna`.`Charities` (`UUID_charities`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `apbaluna`.`CharityUsers`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `apbaluna`.`CharityUsers` (
`Charities_UUID_charities` CHAR(36) NOT NULL,
`User_UUID_User` CHAR(36) NOT NULL,
PRIMARY KEY (`Charities_UUID_charities`, `User_UUID_User`),
INDEX `fk_Charities_has_User_User1_idx` (`User_UUID_User` ASC) VISIBLE,
INDEX `fk_Charities_has_User_Charities1_idx` (`Charities_UUID_charities` ASC) VISIBLE,
CONSTRAINT `fk_Charities_has_User_Charities1`
FOREIGN KEY (`Charities_UUID_charities`)
REFERENCES `apbaluna`.`Charities` (`UUID_charities`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Charities_has_User_User1`
FOREIGN KEY (`User_UUID_User`)
REFERENCES `apbaluna`.`User` (`UUID_User`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;

USE `apbaluna`;

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
Loading
Loading