Merge pull request 'docs: Fix stuff' (#61) from 3002833/Backend:main into restfull
Reviewed-on: Maradona/Backend#61pull/1/head
commit
3c4e5ff6b8
|
@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import com.maradona.backend.dto.SkillPrototype;
|
||||
import com.maradona.backend.entities.Employee;
|
||||
import com.maradona.backend.entities.SecondarySkill;
|
||||
import com.maradona.backend.services.EmployeeService;
|
||||
|
||||
/**
|
||||
|
@ -34,19 +33,17 @@ import com.maradona.backend.services.EmployeeService;
|
|||
@RestController
|
||||
@RequestMapping("/api/employee")
|
||||
public class EmployeeController {
|
||||
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
|
||||
/**
|
||||
* Hardcoded user ID for testing purposes.
|
||||
*/
|
||||
Long user = Long.valueOf(1);
|
||||
|
||||
/**
|
||||
* Returns a specific employee from the database.
|
||||
*
|
||||
* @param id The ID of the requested employee.
|
||||
* @param model The model with the requested data.
|
||||
* @param id The ID of the requested employee.
|
||||
* @return The employee with the requested ID.
|
||||
* @see com.maradona.backend.entities.Employee
|
||||
*/
|
||||
@GetMapping({ "/", "" })
|
||||
|
@ -59,7 +56,7 @@ public class EmployeeController {
|
|||
/**
|
||||
* Returns all employees from the database.
|
||||
*
|
||||
* @param model The model with the requested data.
|
||||
* @return list of employees
|
||||
* @see com.maradona.backend.entities.Employee
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
|
@ -86,9 +83,9 @@ public class EmployeeController {
|
|||
*
|
||||
* @param skillPrototype The skillPrototype object containing the secondary
|
||||
* skill ID and level
|
||||
* @return HTTP status indicating the outcome of the operation
|
||||
* @see com.maradona.backend.entities.Employee
|
||||
* @see com.maradona.backend.entities.SecondarySkill
|
||||
* @see com.maradona.backend.dto.SkillPrototype
|
||||
*/
|
||||
@PostMapping("/skill/protoype")
|
||||
public ResponseEntity<Void> postSkillProtoype(@RequestBody SkillPrototype skillPrototype) {
|
||||
|
@ -101,9 +98,10 @@ public class EmployeeController {
|
|||
*
|
||||
* @param skillId ID of the secondary skill
|
||||
* @param level Level of the secondary skill
|
||||
* @return HTTP status indicating the outcome of the operation
|
||||
* @see com.maradona.backend.entities.Employee
|
||||
* @see com.maradona.backend.entities.SecondarySkill
|
||||
* @see com.maradona.backend.entities.EmployeeSkill
|
||||
* @see com.maradona.backend.entities.EmployeeSecondarySkill
|
||||
*/
|
||||
@PutMapping("/skill/level")
|
||||
public ResponseEntity<Void> putSkillLevel(@RequestParam Long skillId, @RequestParam Integer level) {
|
||||
|
@ -112,10 +110,12 @@ public class EmployeeController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes secondary skill from user profile
|
||||
*
|
||||
* @param id ID of the secondary skill
|
||||
* @see SecondarySkill
|
||||
* Removes a secondary skill from the user profile.
|
||||
*
|
||||
* @param id The ID of the secondary skill to be removed
|
||||
* @return HTTP status indicating the outcome of the operation
|
||||
* @see com.maradona.backend.entities.Employee
|
||||
* @see com.maradona.backend.entities.SecondarySkill
|
||||
*/
|
||||
@DeleteMapping("/skill")
|
||||
public ResponseEntity<Void> delete(@RequestParam Long id) {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class PrimarySkillController {
|
|||
/**
|
||||
* Returns all primary skills from the database.
|
||||
*
|
||||
* @return A list of all primary skills.
|
||||
* @return list of primary skills
|
||||
* @see com.maradona.backend.entities.PrimarySkill
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
|
@ -67,8 +67,8 @@ public class PrimarySkillController {
|
|||
/**
|
||||
* Adds a new primary skill to the database.
|
||||
*
|
||||
* @param primarySkill The primary skill to be added.
|
||||
* @return The added primary skill.
|
||||
* @param primarySkill The primary skill to be added
|
||||
* @return The added primary skill
|
||||
* @see com.maradona.backend.entities.PrimarySkill
|
||||
*/
|
||||
@PostMapping({ "/", "" })
|
||||
|
@ -78,10 +78,10 @@ public class PrimarySkillController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates an existing primary skill in the database.
|
||||
* Modifies an existing primary skill in the database.
|
||||
*
|
||||
* @param primarySkill The primary skill to be updated.
|
||||
* @return The updated primary skill.
|
||||
* @param primarySkill The primary skill to be modified
|
||||
* @return The modified primary skill
|
||||
* @see com.maradona.backend.entities.PrimarySkill
|
||||
*/
|
||||
@PutMapping({ "/", "" })
|
||||
|
@ -90,6 +90,13 @@ public class PrimarySkillController {
|
|||
return ResponseEntity.ok(updatedPrimarySkill);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a primary skill from the database.
|
||||
*
|
||||
* @param id The ID of the primary skill to be deleted
|
||||
* @return HTTP status indicating the outcome of the operation
|
||||
* @see com.maradona.backend.entities.PrimarySkill
|
||||
*/
|
||||
@DeleteMapping({ "/", "" })
|
||||
public ResponseEntity<Void> delete(@RequestParam Long id) {
|
||||
var primarySkill = primarySkillService.getPrimarySkillById(id);
|
||||
|
|
|
@ -30,27 +30,20 @@ import com.maradona.backend.services.ProjectService;
|
|||
*
|
||||
* @warning The ProjectService is not accounting for the user yet.
|
||||
* @see com.maradona.backend.entities.Project
|
||||
* @see com.maradona.backend.services.ProjectService
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/project")
|
||||
public class ProjectController {
|
||||
|
||||
/**
|
||||
* Service for handling project data.
|
||||
*/
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
|
||||
/**
|
||||
* Hardcoded user ID for testing purposes
|
||||
*/
|
||||
Long user = Long.valueOf(1);
|
||||
|
||||
/**
|
||||
* Returns a specific project from the database.
|
||||
*
|
||||
* @param id The ID of the requested project.
|
||||
* @param model The model with the requested data.
|
||||
* @param id The ID of the requested project.
|
||||
* @return The project with the requested ID.
|
||||
* @see com.maradona.backend.entities.Project
|
||||
*/
|
||||
@GetMapping({ "/", "" })
|
||||
|
@ -62,7 +55,7 @@ public class ProjectController {
|
|||
/**
|
||||
* Returns all projects from the database.
|
||||
*
|
||||
* @param model The model with the requested data.
|
||||
* @return list of projects
|
||||
* @see com.maradona.backend.entities.Project
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
|
@ -71,22 +64,22 @@ public class ProjectController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns all projects from the database that are associated with a specific
|
||||
* user.
|
||||
* Returns a list of projects for a given user.
|
||||
*
|
||||
* @param project
|
||||
* @param model
|
||||
* @param userId ID of the user
|
||||
* @return list of projects
|
||||
* @see com.maradona.backend.entities.Project
|
||||
*/
|
||||
@GetMapping("/from-user")
|
||||
public ResponseEntity<Iterable<Project>> getFromUser(@RequestParam Long userId) {
|
||||
return ResponseEntity.ok(projectService.getProjectsByUser(userId));
|
||||
return ResponseEntity.ok(projectService.getProjectsByUserId(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new project in the database.
|
||||
* Adds a new project to the database.
|
||||
*
|
||||
* @param project The project to be created.
|
||||
* @param project The project to be added
|
||||
* @return The added project
|
||||
* @see com.maradona.backend.entities.Project
|
||||
*/
|
||||
@PostMapping({ "/", "" })
|
||||
|
@ -96,9 +89,10 @@ public class ProjectController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates an existing project in the database.
|
||||
* Modifies an existing project in the database.
|
||||
*
|
||||
* @param project The project to be updated.
|
||||
* @param project The project to be modified
|
||||
* @return The modified project
|
||||
* @see com.maradona.backend.entities.Project
|
||||
*/
|
||||
@PutMapping({ "/", "" })
|
||||
|
@ -110,7 +104,8 @@ public class ProjectController {
|
|||
/**
|
||||
* Deletes a project from the database.
|
||||
*
|
||||
* @param id The ID of the project to be deleted.
|
||||
* @param id The ID of the project to be deleted
|
||||
* @return HTTP status indicating the outcome of the operation
|
||||
* @see com.maradona.backend.entities.Project
|
||||
*/
|
||||
@DeleteMapping({ "/", "" })
|
||||
|
|
|
@ -34,22 +34,14 @@ import com.maradona.backend.services.SecondarySkillService;
|
|||
@RequestMapping("/api/secondary-skill")
|
||||
public class SecondarySkillController {
|
||||
|
||||
/**
|
||||
* Service for handling secondary skill data.
|
||||
*/
|
||||
@Autowired
|
||||
private SecondarySkillService secondarySkillService;
|
||||
|
||||
/**
|
||||
* Hardcoded user ID for testing purposes.
|
||||
*/
|
||||
Long user = Long.valueOf(1);
|
||||
|
||||
/**
|
||||
* Returns a specific secondary skill from the database.
|
||||
*
|
||||
* @param id The ID of the requested secondary skill.
|
||||
* @param model The model with the requested data.
|
||||
* @param id The ID of the requested secondary skill.
|
||||
* @return The secondary skill with the requested ID.
|
||||
* @see com.maradona.backend.entities.SecondarySkill
|
||||
*/
|
||||
@GetMapping({ "/", "" })
|
||||
|
@ -61,7 +53,7 @@ public class SecondarySkillController {
|
|||
/**
|
||||
* Returns all secondary skills from the database.
|
||||
*
|
||||
* @param model The model with the requested data.
|
||||
* @return list of secondary skills
|
||||
* @see com.maradona.backend.entities.SecondarySkill
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
|
@ -70,7 +62,7 @@ public class SecondarySkillController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a list of secondary skills for a given primary skill
|
||||
* Returns a list of secondary skills for a given primary skill.
|
||||
*
|
||||
* @param primarySkillId ID of the primary skill
|
||||
* @return list of secondary skills
|
||||
|
@ -83,12 +75,11 @@ public class SecondarySkillController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Saves a new secondary skill to the database.
|
||||
* If the associated primary skill does not exist, it will be created.
|
||||
* Adds a new secondary skill to the database.
|
||||
*
|
||||
* @param secondarySkill The secondary skill to be saved
|
||||
* @param secondarySkill The secondary skill to be added
|
||||
* @return The added secondary skill
|
||||
* @see com.maradona.backend.entities.SecondarySkill
|
||||
* @see com.maradona.backend.entities.PrimarySkill
|
||||
*/
|
||||
@PostMapping({ "/", "" })
|
||||
public ResponseEntity<SecondarySkill> post(@RequestBody SecondarySkill secondarySkill) {
|
||||
|
@ -100,6 +91,7 @@ public class SecondarySkillController {
|
|||
* Modifies an existing secondary skill in the database.
|
||||
*
|
||||
* @param secondarySkill The secondary skill to be modified
|
||||
* @return The modified secondary skill
|
||||
* @see com.maradona.backend.entities.SecondarySkill
|
||||
*/
|
||||
@PutMapping({ "/", "" })
|
||||
|
@ -109,9 +101,10 @@ public class SecondarySkillController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Deletes a specific secondary skill from the database.
|
||||
* Deletes a secondary skill from the database.
|
||||
*
|
||||
* @param id The ID of the secondary skill to be deleted
|
||||
* @return HTTP status indicating the outcome of the operation
|
||||
* @see com.maradona.backend.entities.SecondarySkill
|
||||
*/
|
||||
@DeleteMapping({ "/", "" })
|
||||
|
@ -119,4 +112,4 @@ public class SecondarySkillController {
|
|||
secondarySkillService.deleteSecondarySkill(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ public class ProjectService {
|
|||
return projectRepository.findAll();
|
||||
}
|
||||
|
||||
public Iterable<Project> getProjectsByUser(Long userId) {
|
||||
public Iterable<Project> getProjectsByUserId(Long userId) {
|
||||
// TODO: Actually filter by user
|
||||
return projectRepository.findAll();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue