diff --git a/src/main/java/com/maradona/backend/controllers/api/EmployeeController.java b/src/main/java/com/maradona/backend/controllers/api/EmployeeController.java index 1d1855c..be1ba78 100644 --- a/src/main/java/com/maradona/backend/controllers/api/EmployeeController.java +++ b/src/main/java/com/maradona/backend/controllers/api/EmployeeController.java @@ -26,7 +26,7 @@ import com.maradona.backend.services.details.EmployeeDetails; * - GET /api/employee/all * - GET /api/employee/from-skill * - GET /api/employee/skill/all - * - POST /api/employee/skill/protoype + * - POST /api/employee/skill/prototype * - PUT /api/employee/skill/level * - DELETE /api/employee/skill * @@ -107,8 +107,8 @@ public class EmployeeController { * @see com.maradona.backend.entities.Employee * @see com.maradona.backend.entities.SecondarySkill */ - @PostMapping("/skill/protoype") - public ResponseEntity postSkillProtoype(@RequestBody SkillPrototype skillPrototype) { + @PostMapping("/skill/prototype") + public ResponseEntity postSkillPrototype(@RequestBody SkillPrototype skillPrototype) { employeeActions.addSecondarySkillToEmployee(user, skillPrototype); return ResponseEntity.status(HttpStatus.CREATED).build(); } diff --git a/src/main/java/com/maradona/backend/controllers/page/SkillsPage.java b/src/main/java/com/maradona/backend/controllers/page/SkillsPage.java index 207c98b..d5164c4 100644 --- a/src/main/java/com/maradona/backend/controllers/page/SkillsPage.java +++ b/src/main/java/com/maradona/backend/controllers/page/SkillsPage.java @@ -82,11 +82,11 @@ public class SkillsPage { * * Attributes that can be used by the frontend are a PrimarySkill object * "primarySkill", a SecondarySkill object "secondarySkill" and a - * SkillProtoype object "skillProtoype". + * SkillPrototype object "skillPrototype". * - * The skillProtoype object contains the data needed to add a skill to the user + * The skillPrototype object contains the data needed to add a skill to the user * profile. - * To add it to a user profile, POST to /api/employee/skill/protoype. + * To add it to a user profile, POST to /api/employee/skill/prototype. * * @param model The model with the data to be displayed * @return The add skill page template @@ -98,7 +98,7 @@ public class SkillsPage { public String addSkill(Model model) { // TODO: Make sure it returns the correct initail data for secondary skills model.addAttribute("primarySkills", primarySkillDetails.getAllPrimarySkills()); - model.addAttribute("skillProtoype", new SkillPrototype()); + model.addAttribute("skillPrototype", new SkillPrototype()); return "/pages/skills/add"; } diff --git a/src/main/java/com/maradona/backend/dto/SkillList.java b/src/main/java/com/maradona/backend/dto/SkillList.java index 74f721a..6ef8630 100644 --- a/src/main/java/com/maradona/backend/dto/SkillList.java +++ b/src/main/java/com/maradona/backend/dto/SkillList.java @@ -5,27 +5,64 @@ import com.maradona.backend.entities.SecondarySkill; import org.springframework.data.util.Pair; import java.util.List; +/** + * This classs provides an easier way to send a list of skills with levels to + * the frontend. + */ public class SkillList { + /** + * The primary skill. + */ private PrimarySkill primarySkill; + + /** + * The list of secondary skills with their levels. + */ private List> secondarySkills; + /** + * Creates a new SkillList object. + * + * @param primarySkill The primary skill. + * @param secondarySkills The list of secondary skills with their levels. + */ public SkillList(PrimarySkill primarySkill, List> secondarySkills) { this.primarySkill = primarySkill; this.secondarySkills = secondarySkills; } + /** + * Returns the primary skill. + * + * @return The primary skill. + */ public PrimarySkill getPrimarySkill() { return primarySkill; } + /** + * Sets the primary skill. + * + * @param primarySkill The primary skill. + */ public void setPrimarySkill(PrimarySkill primarySkill) { this.primarySkill = primarySkill; } + /** + * Returns the list of secondary skills with their levels. + * + * @return The list of secondary skills with their levels. + */ public List> getSecondarySkills() { return secondarySkills; } + /** + * Sets the list of secondary skills with their levels. + * + * @param secondarySkills The list of secondary skills with their levels. + */ public void setSecondarySkills(List> secondarySkills) { this.secondarySkills = secondarySkills; } diff --git a/src/main/java/com/maradona/backend/dto/SkillPrototype.java b/src/main/java/com/maradona/backend/dto/SkillPrototype.java index 0feb9de..8295023 100644 --- a/src/main/java/com/maradona/backend/dto/SkillPrototype.java +++ b/src/main/java/com/maradona/backend/dto/SkillPrototype.java @@ -1,30 +1,73 @@ package com.maradona.backend.dto; +/** + * This class provides an easy way to receive raw data that can be usd to build + * a skill from the frontend. + */ public class SkillPrototype { + /** + * The primary skill ID. + */ private Long psid; + + /** + * The secondary skill ID. + */ private Long ssid; + + /** + * The level of the skill. + */ private Integer level; + /** + * Returns the primary skill ID. + */ public Long getPsid() { return psid; } + /** + * Sets the primary skill ID. + * + * @param psid The primary skill ID to set. + */ public void setPsid(Long psid) { this.psid = psid; } + /** + * Returns the secondary skill ID. + * + * @return The secondary skill ID. + */ public Long getSsid() { return ssid; } + /** + * Sets the secondary skill ID. + * + * @param ssid The secondary skill ID to set. + */ public void setSsid(Long ssid) { this.ssid = ssid; } + /** + * Returns the level of the skill. + * + * @return The level of the skill. + */ public Integer getLevel() { return level; } + /** + * Sets the level of the skill. + * + * @param level The level of the skill to set. + */ public void setLevel(Integer level) { this.level = level; }