diff --git a/src/main/java/com/maradona/backend/PrimarySkill.java b/src/main/java/com/maradona/backend/PrimarySkill.java new file mode 100644 index 0000000..2933af7 --- /dev/null +++ b/src/main/java/com/maradona/backend/PrimarySkill.java @@ -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 secondarySkills; + + // TODO: Getters and Setters +} \ No newline at end of file diff --git a/src/main/java/com/maradona/backend/SecondarySkill.java b/src/main/java/com/maradona/backend/SecondarySkill.java new file mode 100644 index 0000000..ad2418e --- /dev/null +++ b/src/main/java/com/maradona/backend/SecondarySkill.java @@ -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 +} \ No newline at end of file diff --git a/src/main/java/com/maradona/backend/Skill.java b/src/main/java/com/maradona/backend/Skill.java deleted file mode 100644 index 2910e22..0000000 --- a/src/main/java/com/maradona/backend/Skill.java +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/src/main/java/com/maradona/backend/SkillController.java b/src/main/java/com/maradona/backend/SkillController.java index bfadb15..efdd66d 100644 --- a/src/main/java/com/maradona/backend/SkillController.java +++ b/src/main/java/com/maradona/backend/SkillController.java @@ -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 createSkill(@RequestBody Skill skill) { - return ResponseEntity.ok(skill); - } - + }