From fecf7e6e739b5b201ca628c63656fc1dde05c69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Wed, 25 Sep 2024 11:16:52 +0200 Subject: [PATCH] PMT-32: Create Project Database Entity and Repository --- src/main/java/de/hmmh/pmt/db/Project.java | 37 +++++++++++++++++++ .../de/hmmh/pmt/db/ProjectRepository.java | 6 +++ 2 files changed, 43 insertions(+) create mode 100644 src/main/java/de/hmmh/pmt/db/Project.java create mode 100644 src/main/java/de/hmmh/pmt/db/ProjectRepository.java diff --git a/src/main/java/de/hmmh/pmt/db/Project.java b/src/main/java/de/hmmh/pmt/db/Project.java new file mode 100644 index 0000000..fefdc7c --- /dev/null +++ b/src/main/java/de/hmmh/pmt/db/Project.java @@ -0,0 +1,37 @@ +package de.hmmh.pmt.db; + +import jakarta.persistence.*; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDateTime; + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@Entity +@Table(name = "project") +public final class Project { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotBlank + @Size(min = 3, max = 64) + private String name; + + @NotNull + private LocalDateTime start; + + @NotNull + private LocalDateTime plannedEnd; + + private LocalDateTime end; +} + diff --git a/src/main/java/de/hmmh/pmt/db/ProjectRepository.java b/src/main/java/de/hmmh/pmt/db/ProjectRepository.java new file mode 100644 index 0000000..ef501dc --- /dev/null +++ b/src/main/java/de/hmmh/pmt/db/ProjectRepository.java @@ -0,0 +1,6 @@ +package de.hmmh.pmt.db; + +import org.springframework.data.jpa.repository.JpaRepository; + +public interface ProjectRepository extends JpaRepository { +}