PMT-32: Create Project Model and Repository
This commit is contained in:
parent
f70b84a7a5
commit
02d4fede5b
2 changed files with 53 additions and 0 deletions
47
src/main/java/de/hmmh/pmt/db/Project.java
Normal file
47
src/main/java/de/hmmh/pmt/db/Project.java
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
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 class Project {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Size(min = 3, max = 64)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Size(min = 10)
|
||||||
|
private String goal;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Long administratorId; // Is an Employee
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private LocalDateTime start;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private LocalDateTime plannedEnd;
|
||||||
|
|
||||||
|
private LocalDateTime realEnd; // Cant be named just "end" because it's and SQL Keyword
|
||||||
|
}
|
||||||
|
|
6
src/main/java/de/hmmh/pmt/db/ProjectRepository.java
Normal file
6
src/main/java/de/hmmh/pmt/db/ProjectRepository.java
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
package de.hmmh.pmt.db;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface ProjectRepository extends JpaRepository<Project, Long> {
|
||||||
|
}
|
Loading…
Reference in a new issue