Skip to content

Structure #14

Merged
merged 6 commits into from
Mar 3, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
60 changes: 45 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>edu.ntnu.idatt1005.gruppe26</groupId>
<artifactId>GiveHope-prosjektoppgave</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<maven.compiler.release>25</maven.compiler.release>
<javafx.version>25.0.2</javafx.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

<!-- JavaFX -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.0</version>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.13.4</version>
<scope>test</scope>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>

<!-- JUnit -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>6.0.2</version>
<version>6.0.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.46.1.3</version>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.0</version>
</dependency>

</dependencies>

<build>
<plugins>

<!-- JavaFX Plugin -->
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>ui.GiveHopeGIU</mainClass>
</configuration>
</plugin>

<!-- Surefire for JUnit -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.4</version>
</plugin>

</plugins>
</build>
</project>
4 changes: 1 addition & 3 deletions src/main/java/app/Main.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package app;

import static db.Database.URL;

import db.Database;
import persistence.db.Database;

public class Main {
public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package model;
package domain.donation;

public enum Cause { HEALTH, EMERGENCY_RELIEF, CHILDREN, ENVIRONMENT, CONFLICTS; }
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package model;
package domain.donation;

import domain.organization.Organization;
import domain.user.User;

import java.math.BigDecimal;
import java.time.LocalDateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package model;
package domain.organization;

import domain.donation.Cause;

import java.util.Objects;

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/domain/user/Role.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package domain.user;

public enum Role {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package model;

import password.PasswordHash;
package domain.user;

public class User {
private String userName;
Expand All @@ -9,10 +7,6 @@ public class User {
private String password;

public User(String userName, String phoneNumber, String password, String eMail) {
this.userName = userName;
this.phoneNumber = phoneNumber;
this.eMail = eMail;
this.password = password;

if (userName == null || userName.isBlank()) {
throw new IllegalArgumentException("Username has to be filled in");
Expand All @@ -32,7 +26,7 @@ public User(String userName, String phoneNumber, String password, String eMail)

this.userName = userName;
this.phoneNumber = phoneNumber;
this.eMail = eMail;
this.eMail = eMail.trim();
this.password = password;
}

Expand Down
4 changes: 0 additions & 4 deletions src/main/java/gui/GiveHopeGUI.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package service;
package integration;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import model.Organization;
import domain.organization.Organization;

public class InnsamlingskontrollenClient {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dao;
package persistence;

public class CauseDao {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dao;
package persistence;

public class DonationDao {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dao;
package persistence;

public class OrganizationDao {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dao;
package persistence;

import db.Database;
import persistence.db.Database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package db;
package persistence.db;

import java.sql.Connection;
import java.sql.DriverManager;
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/register/DonationRegister.java

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/java/register/OrganizationRegister.java

This file was deleted.

38 changes: 0 additions & 38 deletions src/main/java/register/UserRegister.java

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/java/service/DonationService.java

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/java/service/InputHelper.java

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/java/service/OrganizationService.java

This file was deleted.

23 changes: 0 additions & 23 deletions src/main/java/service/UserService.java

This file was deleted.

23 changes: 23 additions & 0 deletions src/main/java/ui/GiveHopeGIU.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package ui;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class GiveHopeGIU extends Application {

@Override
public void start(Stage stage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/ui/home.fxml"));
Scene scene = new Scene(loader.load(), 600, 400);

stage.setTitle("GiveHope");
stage.setScene(scene);
stage.show();
}

public static void main(String[] args) {
launch();
}
}
24 changes: 24 additions & 0 deletions src/main/java/ui/controller/HomeController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package ui.controller;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.control.Button;

import java.io.IOException;

public class HomeController {

public Button signInButton;

@FXML
private void goToSignIn() throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("/ui/signIn.fxml"));
signInButton.getScene().setRoot(root);
}

@FXML
private void handleBrowse() {
System.out.println("Browse button pressed");
}
}
36 changes: 36 additions & 0 deletions src/main/java/ui/controller/SignInController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package ui.controller;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;

public class SignInController {

@FXML private TextField emailField;
@FXML private PasswordField passwordField;
@FXML private Label errorLabel;

@FXML
private void handleSignIn() {
String email = emailField.getText();
String password = passwordField.getText();

// Mini-sjekk for å se at wiring funker
if (email == null || email.isBlank() || password == null || password.isBlank()) {
errorLabel.setText("Please enter email and password.");
return;
}

errorLabel.setText(""); // nullstill
System.out.println("Trying to sign in with: " + email);

// Her skal du senere kalle service/DB (ikke her inne direkte!)
}

@FXML
private void goToRegister() {
System.out.println("Go to Register clicked");
// Neste steg: bytte scene/view
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package service;
package util;

import model.User;
import password.PasswordHash;
import domain.user.User;

public class AuthService {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package password;
package util;

import java.security.MessageDigest;

Expand Down
Loading