This commit is contained in:
maciejrusek
2026-04-18 12:24:03 +02:00
commit cb7ec452eb
10 changed files with 196 additions and 0 deletions

View File

@@ -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);
}
}

View File

@@ -0,0 +1,7 @@
package models;
public record User(
String username,
String email
) {
}

View File

@@ -0,0 +1,15 @@
package repository;
import models.Task;
import java.util.List;
import java.util.Optional;
public interface TaskRepository {
List<Task> getUserTasks(int userId);
List<Task> findUserTasksByTitle(int userId, String title);
Optional<Task> getUserTask(int userId, int taskId);
void save(Task task);
void update(int taskId, Task task);
void delete(int taskId);
}