Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
withinJoel committed Aug 22, 2024
1 parent c3e8a20 commit f10d2f0
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 6 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,19 @@ public ResponseEntity<CollectionModel<ProjectResource>> getProjectsByEmployeeId(
//Experimental Features
@GetMapping("/departments/{department}")
public ResponseEntity<ProjectResource> getProjectByDepartment(@PathVariable String department) {
Project project = projectService.test(department);
System.out.println(project.getId());
Project project = projectService.findByDescription(department);
return ResponseEntity.ok(assembler.toModel(project));
}

@GetMapping ("/departments/skip/{department}")
public ResponseEntity<ProjectResource> getProjectByDepartmentSkip(@PathVariable String department) {
Project project = projectService.findBySkippedDescription(department);
return ResponseEntity.ok(assembler.toModel(project));
}

@GetMapping("/departments/skip/{department}/{name}")
public ResponseEntity<ProjectResource> findBySkippedDescriptionAndName(@PathVariable String department, @PathVariable String name) {
Project project = projectService.findBySkippedDescriptionAndName(department, name);
return ResponseEntity.ok(assembler.toModel(project));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public interface ProjectRepository extends JpaRepository<Project, Long> {

//Experimental Features
//(Not For production)(Logic might be choppy)
@Query ("select p from Project p where p.description = :department and p.id = :id")
Project findByDescriptionAndId(String department, Long id);

@Query ("select p from Project p where p.description = :department")
Project findByDescription(String department);

@Query ("select p from Project p where p.description != :department")
Project findBySkippedDescription(String department);

@Query ("select p from Project p where p.description != :department and p.name != :name")
Project findBySkippedDescriptionAndName(String name, String department);
}
14 changes: 12 additions & 2 deletions src/main/java/com/example/teamsync/service/ProjectService.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,18 @@ public void deleteProject(Long id) {
}

//Experimental Features
public Project test (String department) {
Project project = projectRepository.findByDescriptionAndId(department, 1L);
public Project findByDescription (String department) {
Project project = projectRepository.findByDescription(department);
return project;
}

public Project findBySkippedDescription (String department){
Project project = projectRepository.findBySkippedDescription(department);
return project;
}

public Project findBySkippedDescriptionAndName (String department, String name) {
Project project = projectRepository.findBySkippedDescriptionAndName(department, name);
return project;
}
}

0 comments on commit f10d2f0

Please sign in to comment.