api: Implement skill-related entities
parent
7ae9475386
commit
a4dfcba99a
|
@ -0,0 +1,20 @@
|
|||
package com.maradona.backend;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
public class PrimarySkill {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long psid;
|
||||
|
||||
@Column(nullable = false, length = 255)
|
||||
private String description;
|
||||
|
||||
@OneToMany(mappedBy = "primarySkill", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<SecondarySkill> secondarySkills;
|
||||
|
||||
// TODO: Getters and Setters
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.maradona.backend;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
public class SecondarySkill {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long ssid;
|
||||
|
||||
@Column(nullable = false, length = 255)
|
||||
private String description;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "psid", nullable = false)
|
||||
private PrimarySkill primarySkill;
|
||||
|
||||
// Getters and Setters
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.maradona.backend;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class Skill {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
private String primary;
|
||||
private String secondary;
|
||||
}
|
|
@ -4,15 +4,13 @@ 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")
|
||||
@RequestMapping("/api/skills")
|
||||
public class SkillController {
|
||||
|
||||
@PostMapping("skills")
|
||||
public ResponseEntity<Skill> createSkill(@RequestBody Skill skill) {
|
||||
return ResponseEntity.ok(skill);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue