api: Change level endpoint
parent
67084ebd3a
commit
31e822b96e
Binary file not shown.
|
@ -142,4 +142,23 @@ public class SkillsController {
|
|||
}
|
||||
return "redirect:/skills";
|
||||
}
|
||||
|
||||
// Update skill level
|
||||
@PostMapping("/update-level")
|
||||
public String updateLevel(@RequestParam Long skillId, @RequestParam Integer level) {
|
||||
var employee = employeeService.getEmployeeById(user).orElseThrow(() -> new RuntimeException("Employee not found"));
|
||||
var secondarySkill = secondarySkillService.getSecondarySkillById(skillId)
|
||||
.orElseThrow(() -> new RuntimeException("Secondary Skill not found"));
|
||||
|
||||
for (EmployeeSecondarySkill ess : employee.getSecondarySkills()) {
|
||||
if (ess.getSecondarySkill().getSsid().equals(skillId)) {
|
||||
ess.setLevel(level);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
employeeService.saveEmployee(employee);
|
||||
|
||||
return "redirect:/skills";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue