Skip to content

Commit

Permalink
correcion en projects
Browse files Browse the repository at this point in the history
  • Loading branch information
n1colasf committed Feb 19, 2024
1 parent 4ff5e6a commit 431599a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ public List<Project> getAllProjects(@Parameter(in = ParameterIn.HEADER, descript
return projectService.findAllProjects();
}

// GET ALL PROJECTS BY USERNAME -----------------------------------------------------
@Operation(summary = "Get all the projects by username")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Ok",
content = {@Content(mediaType = "application/json",
schema = @Schema(implementation = Project.class))}),
})
@GetMapping("/projects/user/{username}")
public List<Project> getAllProjectsByUsername(@Parameter(in = ParameterIn.HEADER, description = "Login token", required = true, schema = @Schema(type = "string"))
@RequestHeader(value = "token") String token, @Parameter(description = "The User's username") @PathVariable String username) {
return projectService.findAllProjectsByUsername(username);
}

// CREATE PROJECT -----------------------------------------------------
@Operation(summary = "Create a new project")
@ApiResponses(value = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ public interface ProjectRepository extends JpaRepository<Project, Long> {

public void deleteById(Long id);

public List<Project> findAllByUser(String username);
public List<Project> findAllByUsername(String username);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public List<Project> findAllProjects() {
}

public List<Project> findAllProjectsByUser(String username) {
return projectRepository.findAllByUser(username);
return projectRepository.findAllByUsername(username);
}

public Project createProject(Project project) {
Expand All @@ -42,6 +42,6 @@ public void deleteProjectById(Long id) {


public List<Project> findAllProjectsByUsername(String username) {
return projectRepository.findAllByUser(username);
return projectRepository.findAllByUsername(username);
}
}

0 comments on commit 431599a

Please sign in to comment.