Merge pull request 'api: Refactor and update settings' (#4) from 3002833/Backend:main into main

Reviewed-on: Maradona/Backend#4
pull/1/head
David Hess 2024-10-28 12:34:31 +01:00
commit e4fdd6a39e
13 changed files with 90 additions and 58 deletions

View File

@ -1,28 +0,0 @@
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 +0,0 @@
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,14 @@
package com.maradona.backend.controllers;
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;
@RestController
@RequestMapping("/api/skills")
public class SkillController {
}

View File

@ -1,4 +1,4 @@
package com.maradona.backend;
package com.maradona.backend.entities;
import jakarta.persistence.*;
import lombok.Data;
@ -7,23 +7,23 @@ 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;

View File

@ -1,4 +1,4 @@
package com.maradona.backend;
package com.maradona.backend.entities;
import jakarta.persistence.*;
import lombok.Data;
@ -6,7 +6,7 @@ import lombok.Data;
@Entity
@Data
public class FormOfAddress {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

View File

@ -1,11 +1,11 @@
package com.maradona.backend;
package com.maradona.backend.entities;
import jakarta.persistence.*;
import java.util.List;
@Entity
public class PrimarySkill {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long psid;

View File

@ -1,4 +1,4 @@
package com.maradona.backend;
package com.maradona.backend.entities;
import jakarta.persistence.*;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.maradona.backend;
package com.maradona.backend.entities;
import jakarta.persistence.*;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.maradona.backend;
package com.maradona.backend.entities;
import jakarta.persistence.*;

View File

@ -0,0 +1,28 @@
package com.maradona.backend.entities;
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 +0,0 @@
spring.application.name=backend

View File

@ -0,0 +1,21 @@
spring:
profiles:
active: dev # Set 'dev' profile as the active profile for development
datasource:
url: jdbc:h2:mem:testdb
driver-class-name: org.h2.Driver
username: sa
password: password
h2:
console:
enabled: true # Enable H2 console for testing at http://localhost:8080/h2-console
jpa:
hibernate:
ddl-auto: update # Automatically create/update schema
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect

View File

@ -0,0 +1,14 @@
spring:
datasource:
url: jdbc:postgresql://<YOUR_PROD_DB_URL>:5432/<YOUR_DB_NAME>
driver-class-name: org.postgresql.Driver
username: <YOUR_DB_USERNAME>
password: <YOUR_DB_PASSWORD>
jpa:
hibernate:
ddl-auto: update
show-sql: false
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect