ListDTO Mapper implementiert
This commit is contained in:
1 parent
966705ec90
commit
ea8ebf79b2
1 file changed
+18
@@ -1,4 +1,22 @@
|
||||
package de.timaldinger.einkaufsliste.Mapper;
|
||||
|
||||
import de.timaldinger.einkaufsliste.Dto.Get.ShoppingListsGetDTO;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingList;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ShoppingListMapper {
|
||||
|
||||
public List<ShoppingListsGetDTO> toListsGetDTOs(List<ShoppingList> list){
|
||||
return list.stream().map(this::toListsGetDTO).toList();
|
||||
}
|
||||
|
||||
public ShoppingListsGetDTO toListsGetDTO(ShoppingList list){
|
||||
return new ShoppingListsGetDTO(
|
||||
list.getListName(),
|
||||
list.getId()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user