api: Add missing entities

pull/1/head
Lunix-420 2024-10-28 12:02:51 +01:00
parent a4dfcba99a
commit 3ac4042b2a
7 changed files with 140 additions and 11 deletions

View File

@ -58,6 +58,13 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>

View File

@ -0,0 +1,32 @@
package com.maradona.backend;
import jakarta.persistence.*;
import lombok.Data;
import java.time.LocalTime;
@Entity
@Data
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private Integer employeeNr;
@Column(length = 100)
private String firstName;
@Column(length = 100)
private String lastName;
@ManyToOne
@JoinColumn(name = "AID")
private FormOfAddress formOfAddress;
@Column(length = 150)
private String mail;
private LocalTime dStart;
private LocalTime dEnd;
}

View File

@ -0,0 +1,16 @@
package com.maradona.backend;
import jakarta.persistence.*;
import lombok.Data;
@Entity
@Data
public class FormOfAddress {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, length = 50)
private String description;
}

View File

@ -0,0 +1,25 @@
package com.maradona.backend;
import jakarta.persistence.*;
import lombok.Data;
import java.time.LocalDate;
@Entity
@Data
public class Project {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, length = 255)
private String name;
private LocalDate startDate;
private LocalDate endDate;
private Integer workload;
@Column(columnDefinition = "TEXT")
private String description;
}

View File

@ -0,0 +1,21 @@
package com.maradona.backend;
import jakarta.persistence.*;
import lombok.Data;
@Entity
@Data
public class ProjectAssignment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "PID", nullable = false)
private Project project;
@ManyToOne
@JoinColumn(name = "EID", nullable = false)
private Employee employee;
}

View File

@ -0,0 +1,28 @@
package com.maradona.backend;
import jakarta.persistence.*;
import lombok.Data;
@Entity
@Data
public class SkillAssignment {
public enum SkillLevel {
ONE, TWO, THREE, FOUR, FIVE;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "EID", nullable = false)
private Employee employee;
@ManyToOne
@JoinColumn(name = "SSID", nullable = false)
private SecondarySkill secondarySkill;
@Column(nullable = false)
@Enumerated(EnumType.ORDINAL)
private SkillLevel level;
}

View File

@ -1,16 +1,16 @@
package com.maradona.backend;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import jakarta.persistence.*;
import lombok.Data;
@Entity
@Data
public class FormOfAddress {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@RestController
@RequestMapping("/api/skills")
public class SkillController {
@Column(nullable = false, length = 50)
private String description;
}