PMT-4: Fix Relation and Functions of Allocations
All checks were successful
Quality Check / Validate OAS (push) Successful in 51s
Quality Check / Validate OAS (pull_request) Successful in 1m4s
Quality Check / Linting (push) Successful in 2m3s
Quality Check / Linting (pull_request) Successful in 2m11s
Quality Check / Testing (push) Successful in 2m18s
Quality Check / Testing (pull_request) Successful in 2m15s
Quality Check / Static Analysis (push) Successful in 2m26s
Quality Check / Static Analysis (pull_request) Successful in 2m21s
All checks were successful
Quality Check / Validate OAS (push) Successful in 51s
Quality Check / Validate OAS (pull_request) Successful in 1m4s
Quality Check / Linting (push) Successful in 2m3s
Quality Check / Linting (pull_request) Successful in 2m11s
Quality Check / Testing (push) Successful in 2m18s
Quality Check / Testing (pull_request) Successful in 2m15s
Quality Check / Static Analysis (push) Successful in 2m26s
Quality Check / Static Analysis (pull_request) Successful in 2m21s
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
parent
f5717076a8
commit
3a4c3fc21c
2 changed files with 15 additions and 10 deletions
|
@ -137,7 +137,7 @@ public class ApiController implements DefaultApi {
|
||||||
Allocation allocation = new Allocation();
|
Allocation allocation = new Allocation();
|
||||||
allocation.setEmployeeId(employee.getId());
|
allocation.setEmployeeId(employee.getId());
|
||||||
allocation.setRole(body.getQualificationId());
|
allocation.setRole(body.getQualificationId());
|
||||||
allocation.setProjectId(project.getId());
|
allocation.setProject(project);
|
||||||
allocationRepository.save(allocation);
|
allocationRepository.save(allocation);
|
||||||
|
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
|
|
@ -2,10 +2,7 @@ package de.hmmh.pmt.db;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.*;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -15,15 +12,23 @@ import lombok.Setter;
|
||||||
@IdClass(AllocationId.class)
|
@IdClass(AllocationId.class)
|
||||||
@Table(name = "allocation")
|
@Table(name = "allocation")
|
||||||
public class Allocation {
|
public class Allocation {
|
||||||
@Id
|
|
||||||
private Long projectId;
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "projectId", insertable = false, updatable = false)
|
|
||||||
private Project project;
|
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Setter(AccessLevel.NONE)
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "allocation_project", referencedColumnName = "id", insertable = false, updatable = false)
|
||||||
|
private Project project;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private Long employeeId;
|
private Long employeeId;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private Long role; // This is a QualificationId
|
private Long role; // This is a QualificationId
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
this.projectId = project.getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue