PMT-4: Add Database Model for Allocations

This commit is contained in:
Dominik Säume 2024-10-21 13:04:25 +02:00
parent 77440fd636
commit 17e20ee830
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C
3 changed files with 56 additions and 0 deletions

View file

@ -0,0 +1,34 @@
package de.hmmh.pmt.db;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.*;
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Entity
@IdClass(AllocationId.class)
@Table(name = "allocation")
public class Allocation {
@Id
@Setter(AccessLevel.NONE)
private Long projectId;
@ManyToOne
@JoinColumn(name = "allocation_project", referencedColumnName = "id", insertable = false, updatable = false)
private Project project;
@Id
private Long employeeId;
@NotNull
private Long role; // This is a QualificationId
public void setProject(Project project) {
this.project = project;
this.projectId = project.getId();
}
}

View file

@ -0,0 +1,18 @@
package de.hmmh.pmt.db;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class AllocationId implements Serializable {
private static final long serialVersionUID = 1L;
private Long projectId;
private Long employeeId;
}

View file

@ -4,6 +4,10 @@
<Class name="de.hmmh.pmt.employee.ApiClientFactory"/> <Class name="de.hmmh.pmt.employee.ApiClientFactory"/>
<Bug code="M,V,EI"/> <Bug code="M,V,EI"/>
</Match> </Match>
<Match>
<Class name="de.hmmh.pmt.db.Allocation"/>
<Bug code="M,V,EI,EI2"/>
</Match>
<Match> <Match>
<!--Ignore Auto Generated Code --> <!--Ignore Auto Generated Code -->
<Source name="~.*build/.*"/> <Source name="~.*build/.*"/>