-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/ticket controller #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2b98709
6d6894f
c91e435
92b40f0
343ea3c
d27fb3f
6e8715d
3bac7a6
2a67db5
ce23190
f5c7e2d
6ece8e4
6977168
43862d9
f736df6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,86 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package org.example.alfs.controllers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.validation.Valid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.example.alfs.dto.ticket.TicketCreateDTO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.example.alfs.dto.ticket.TicketViewDTO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.example.alfs.entities.Ticket; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.example.alfs.services.TicketService; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.stereotype.Controller; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.ui.Model; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.validation.BindingResult; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.web.bind.annotation.*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //TODO: Decide final routes and redirects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Controller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @RequestMapping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public class TicketController { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TicketService ticketService; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public TicketController(TicketService ticketService) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.ticketService = ticketService; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //create ticket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @GetMapping("/create") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public String createNewTicketForm(Model model) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| model.addAttribute("ticket", new TicketCreateDTO()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "create"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //TODO REDIRECT, WHERE?? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @PostMapping("/create") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public String createNewTicket(@ModelAttribute("ticket") @Valid TicketCreateDTO ticketCreateDTO, BindingResult bindingResult) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (bindingResult.hasErrors()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "create"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ticketService.createNewTicket(ticketCreateDTO); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "redirect:/home"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //view ticket by token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @GetMapping("/view/token/{token}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public String viewTicketByToken(@PathVariable String token, Model model) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TicketViewDTO ticket = ticketService.getTicketByToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| model.addAttribute("ticket", ticket); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "view"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //view ticket by id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @GetMapping("/view/id/{id}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public String viewTicketById(@PathVariable Long id, Model model) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TicketViewDTO ticket = ticketService.getTicketById(id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| model.addAttribute("ticket", ticket); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "view"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Map service “not found” failures to HTTP 404 instead of server errors. On Line 53 and Line 63, service calls can throw 🐛 Proposed controller-level fix+import org.springframework.http.HttpStatus;
+import org.springframework.web.server.ResponseStatusException;
...
`@GetMapping`("/view/token/{token}")
public String viewTicketByToken(`@PathVariable` String token, Model model) {
-
- TicketViewDTO ticket = ticketService.getTicketByToken(token);
+ TicketViewDTO ticket;
+ try {
+ ticket = ticketService.getTicketByToken(token);
+ } catch (RuntimeException ex) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Ticket not found", ex);
+ }
model.addAttribute("ticket", ticket);
return "view";
}
...
`@GetMapping`("/view/id/{id}")
public String viewTicketById(`@PathVariable` Long id, Model model) {
-
- TicketViewDTO ticket = ticketService.getTicketById(id);
+ TicketViewDTO ticket;
+ try {
+ ticket = ticketService.getTicketById(id);
+ } catch (RuntimeException ex) {
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Ticket not found", ex);
+ }
model.addAttribute("ticket", ticket);
return "view";
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //assign ticket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TODO implement DTO + service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @PostMapping("/{id}/assign") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public String assignTicket(@PathVariable Long id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "redirect:/tickets/" + id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //update status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TODO implement DTO + service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @PostMapping("/{id}/status") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public String updateStatus(@PathVariable Long id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "redirect:/tickets/" + id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+71
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stub methods redirect to non-existent routes. Both 🐛 Fix redirect URLs to match existing routes `@PostMapping`("/{id}/assign")
public String assignTicket(`@PathVariable` Long id) {
- return "redirect:/tickets/" + id;
+ return "redirect:/view/id/" + id;
}
//update status
// TODO implement DTO + service
`@PostMapping`("/{id}/status")
public String updateStatus(`@PathVariable` Long id) {
- return "redirect:/tickets/" + id;
+ return "redirect:/view/id/" + id;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be fixed later since we don't really know yet where to redirect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🧠 Learnings used |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //create comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //View comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //upload attachment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package org.example.alfs.mapper; | ||
|
|
||
| import org.example.alfs.dto.ticket.TicketViewDTO; | ||
| import org.example.alfs.entities.Ticket; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| public class TicketMapper { | ||
|
|
||
| public TicketViewDTO entityToViewDTO(Ticket ticket){ | ||
|
|
||
| TicketViewDTO ticketViewDTO = new TicketViewDTO(); | ||
|
|
||
| ticketViewDTO.setId(ticket.getId()); | ||
| ticketViewDTO.setTitle(ticket.getTitle()); | ||
| ticketViewDTO.setDescription(ticket.getDescription()); | ||
| ticketViewDTO.setStatus(ticket.getStatus()); | ||
| ticketViewDTO.setCreatedAt(ticket.getCreatedAt()); | ||
|
|
||
| if (ticket.getInvestigator() != null) { | ||
| ticketViewDTO.setAssignedInvestigatorId(ticket.getInvestigator().getId()); | ||
| } | ||
|
|
||
| return ticketViewDTO; | ||
| } | ||
|
|
||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| package org.example.alfs.services; | ||
|
|
||
| import org.example.alfs.dto.ticket.TicketCreateDTO; | ||
| import org.example.alfs.dto.ticket.TicketViewDTO; | ||
| import org.example.alfs.entities.Ticket; | ||
| import org.example.alfs.enums.TicketStatus; | ||
| import org.example.alfs.mapper.TicketMapper; | ||
| import org.example.alfs.repositories.TicketRepository; | ||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.web.server.ResponseStatusException; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| @Service | ||
| public class TicketService { | ||
|
|
||
|
|
||
| private final TicketRepository ticketRepository; | ||
| private final TicketMapper ticketMapper; | ||
|
|
||
| public TicketService(TicketRepository ticketRepository, TicketMapper ticketMapper) { | ||
| this.ticketRepository = ticketRepository; | ||
| this.ticketMapper = ticketMapper; | ||
| } | ||
|
|
||
| //createNewTicket | ||
| public TicketViewDTO createNewTicket(TicketCreateDTO ticketCreateDTO) { | ||
|
|
||
| Ticket ticket = new Ticket(); | ||
|
|
||
| ticket.setTitle(ticketCreateDTO.getTitle()); | ||
| ticket.setDescription(ticketCreateDTO.getDescription()); | ||
|
|
||
| Ticket save = ticketRepository.save(ticket); | ||
|
|
||
| return ticketMapper.entityToViewDTO(save); | ||
| } | ||
|
|
||
| // View by token | ||
| public TicketViewDTO getTicketByToken(String token) { | ||
|
|
||
| Ticket ticket = ticketRepository.findByReporterToken(token). | ||
| orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Ticket not found")); | ||
| return ticketMapper.entityToViewDTO(ticket); | ||
| } | ||
|
|
||
| //findById | ||
| public TicketViewDTO getTicketById(Long id) { | ||
|
|
||
| Ticket ticket = ticketRepository.findById(id). | ||
| orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Ticket not found")); | ||
| return ticketMapper.entityToViewDTO(ticket); | ||
|
Comment on lines
+50
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# 1) Locate controller(s) and inspect mappings + security annotations around getTicketById usage
fd -i "TicketController.java" src
rg -n -C3 'getTicketById|@GetMapping|@RequestMapping|/view|/ticket|@PreAuthorize|@Secured|@RolesAllowed' src/main/java/org/example/alfs/controllers
# 2) Inspect Spring Security configuration for route-level protections
fd -i "SecurityConfig.java" src
rg -n -C3 'SecurityFilterChain|authorizeHttpRequests|requestMatchers|permitAll|authenticated|hasRole|hasAnyRole' src/main/java
# Expected:
# - Endpoints calling getTicketById should require authenticated/authorized access
# (or enforce ownership checks before returning data).Repository: ithsjava25/project-backend-alfs Length of output: 5261 🏁 Script executed: cat -n src/main/java/org/example/alfs/controllers/TicketController.javaRepository: ithsjava25/project-backend-alfs Length of output: 2960 🏁 Script executed: # Search for Spring Security configuration
find src -name "*Security*" -o -name "*Config*.java" | head -20Repository: ithsjava25/project-backend-alfs Length of output: 132 🏁 Script executed: # Check if there are any authentication/authorization annotations used elsewhere in the project
rg -l '@PreAuthorize|@Secured|@RolesAllowed' src/main/javaRepository: ithsjava25/project-backend-alfs Length of output: 57 🏁 Script executed: find src -name "application*.properties" -o -name "application*.yml" -o -name "application*.yaml"Repository: ithsjava25/project-backend-alfs Length of output: 116 🏁 Script executed: # Look for main application class
find src -name "*Application.java"Repository: ithsjava25/project-backend-alfs Length of output: 126 🏁 Script executed: # Search for custom filters, interceptors, or authentication setup
rg -l 'FilterChain|Filter|Interceptor|SecurityFilterChain|HttpSecurity|Authentication' src/main/javaRepository: ithsjava25/project-backend-alfs Length of output: 57 🏁 Script executed: # Check pom.xml or build.gradle for Spring Security dependency
find . -maxdepth 2 \( -name "pom.xml" -o -name "build.gradle" \)Repository: ithsjava25/project-backend-alfs Length of output: 84 🏁 Script executed: cat -n src/main/resources/application.propertiesRepository: ithsjava25/project-backend-alfs Length of output: 146 🏁 Script executed: cat -n src/main/java/org/example/alfs/AlfsApplication.javaRepository: ithsjava25/project-backend-alfs Length of output: 482 🏁 Script executed: # Check for Spring Security in pom.xml
grep -A2 -B2 'spring-security' ./pom.xmlRepository: ithsjava25/project-backend-alfs Length of output: 57 🏁 Script executed: # Look for any SecurityConfig bean or configuration class
rg -n '@Configuration|@EnableWebSecurity|@Bean.*Security' src/main/javaRepository: ithsjava25/project-backend-alfs Length of output: 149 🏁 Script executed: cat -n src/main/java/org/example/alfs/config/PasswordConfig.javaRepository: ithsjava25/project-backend-alfs Length of output: 687 🏁 Script executed: # Check TicketService.getTicketById() for any access control logic
cat -n src/main/java/org/example/alfs/services/TicketService.java | grep -A10 "getTicketById"Repository: ithsjava25/project-backend-alfs Length of output: 581 🏁 Script executed: # Check if pom.xml has spring-security dependency at all
cat -n ./pom.xml | head -50Repository: ithsjava25/project-backend-alfs Length of output: 2144 Confirm IDOR exposure: endpoint allows unrestricted ticket access by numeric ID. The 🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be handled when authentication/authorization is implemented. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Would you like me to open a GitHub issue to track this so it doesn't get lost? It would serve as a reminder to add the IDOR protection once the auth layer is ready. ✏️ Learnings added
🧠 Learnings used |
||
|
|
||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| //findByReporterId | ||
| public List<TicketViewDTO> getTicketsByReporterId(Long reporterId) { | ||
| return ticketRepository.findByReporterId(reporterId) | ||
| .stream() | ||
| .map(ticketMapper::entityToViewDTO) | ||
| .toList(); | ||
| } | ||
|
|
||
| //findByInvestigatorId | ||
| public List<TicketViewDTO> getTicketsByInvestigatorId(Long investigatorId){ | ||
| return ticketRepository.findByInvestigatorId(investigatorId) | ||
| .stream() | ||
| .map(ticketMapper::entityToViewDTO) | ||
| .toList(); | ||
| } | ||
|
|
||
| //findByStatus | ||
| public List<TicketViewDTO> getTicketsByStatus(TicketStatus status) { | ||
| return ticketRepository.findByStatus(status) | ||
| .stream() | ||
| .map(ticketMapper::entityToViewDTO) | ||
| .toList(); | ||
| } | ||
|
|
||
| //findByStatusAndInvestigatorId | ||
| public List<TicketViewDTO> getTicketsByStatusAndInvestigator( | ||
| TicketStatus status, | ||
| Long investigatorId) { | ||
|
|
||
| return ticketRepository | ||
| .findByStatusAndInvestigatorId(status, investigatorId) | ||
| .stream() | ||
| .map(ticketMapper::entityToViewDTO) | ||
| .toList(); | ||
| } | ||
|
|
||
| //findAll (pageable) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.