commit cb7ec452eb26c6eb7c28950c26e2c99b84fc8e66 Author: maciejrusek Date: Sat Apr 18 12:24:03 2026 +0200 Init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..480bdf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ +.kotlin + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d61b968 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b69166d --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Simple Todo GUI App + +--- + +## Plany: +- Postgresql, Docker +- Testy - junit, mockito +- Testy na innej bazie danych +- GUI - JavaFX +- Hashowanie haseł +- Programowanie bardziej OOP, interface +- Fabryka dla połączeń bazy danych +- Connection Pool - HikariCP +- Migracje Flyway + + +## TODO: +- [ ] Fabryka połączenia do bazy danych +- [ ] Testy bazy \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c8e50cc --- /dev/null +++ b/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + pl.mrusek + TodoApp + 1.0-SNAPSHOT + + + 21 + 21 + UTF-8 + + + \ No newline at end of file diff --git a/src/main/java/models/Task.java b/src/main/java/models/Task.java new file mode 100644 index 0000000..9036a5f --- /dev/null +++ b/src/main/java/models/Task.java @@ -0,0 +1,62 @@ +package models; + +import java.util.Date; +import java.util.Objects; + +public class Task { + + private String title; + private String description; + private Date createdAt; + + public Task(String title, String description) { + this.title = title; + this.description = description; + this.createdAt = new Date(); + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + @Override + public String toString() { + return "Task{" + + "title='" + title + '\'' + + ", description='" + description + '\'' + + ", createdAt=" + createdAt + + '}'; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + Task task = (Task) o; + return Objects.equals(title, task.title) && Objects.equals(description, task.description) && Objects.equals(createdAt, task.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(title, description, createdAt); + } +} diff --git a/src/main/java/models/User.java b/src/main/java/models/User.java new file mode 100644 index 0000000..f5f8de4 --- /dev/null +++ b/src/main/java/models/User.java @@ -0,0 +1,7 @@ +package models; + +public record User( + String username, + String email +) { +} diff --git a/src/main/java/repository/TaskRepository.java b/src/main/java/repository/TaskRepository.java new file mode 100644 index 0000000..cd84adb --- /dev/null +++ b/src/main/java/repository/TaskRepository.java @@ -0,0 +1,15 @@ +package repository; + +import models.Task; + +import java.util.List; +import java.util.Optional; + +public interface TaskRepository { + List getUserTasks(int userId); + List findUserTasksByTitle(int userId, String title); + Optional getUserTask(int userId, int taskId); + void save(Task task); + void update(int taskId, Task task); + void delete(int taskId); +}