| Total Complexity | 3 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | package com.osomapps.pt.admin.goal; |
||
| 9 | @Service |
||
| 10 | class AdminGoalTypeService { |
||
| 11 | |||
| 12 | private final GoalTypeRepository goalTypeRepository; |
||
| 13 | |||
| 14 | AdminGoalTypeService(GoalTypeRepository goalTypeRepository) { |
||
| 15 | this.goalTypeRepository = goalTypeRepository; |
||
| 16 | } |
||
| 17 | |||
| 18 | List<GoalTypeResponseDTO> findAll() { |
||
| 19 | return goalTypeRepository.findAll().stream() |
||
| 20 | .map(AdminGoalTypeService::goalTypeToDto) |
||
| 21 | .collect(Collectors.toList()); |
||
| 22 | } |
||
| 23 | |||
| 24 | private static GoalTypeResponseDTO goalTypeToDto(GoalType type) { |
||
| 25 | return GoalTypeResponseDTO.builder().id(type.getId()).name(type.getName()).build(); |
||
| 26 | } |
||
| 28 |