Skip to content

Commit dac552c

Browse files
committed
feat(backend): Find agent by name.
1 parent e5bc8a9 commit dac552c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/com/helper/vavahelper/Repositories/AgentsRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
import com.helper.vavahelper.models.Agents.Agents;
66

77
public interface AgentsRepository extends JpaRepository<Agents, Long>{
8-
8+
Agents findByName(String name);
99
}

src/main/java/com/helper/vavahelper/controllers/AgentsController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public class AgentsController {
2222
@Autowired
2323
AgentsRepository agentsRepository;
2424

25-
@GetMapping("/{id}")
26-
public Optional<Agents> getAgentById(@PathVariable Long id) {
27-
return agentsRepository.findById(id);
25+
@GetMapping("/{name}")
26+
public Agents getAgentById(@PathVariable String name) {
27+
return agentsRepository.findByName(name);
2828
}
2929

3030
@GetMapping

0 commit comments

Comments
 (0)