|
|
|
@ -13,6 +13,7 @@ import com.example.todoapp.dto.ToBuysDTO; |
|
|
|
|
import com.example.todoapp.model.ToBuys; |
|
|
|
|
import com.example.todoapp.model.User; |
|
|
|
|
import com.example.todoapp.repository.UserRepository; |
|
|
|
|
import com.example.todoapp.repository.StuffsRepository; |
|
|
|
|
import com.example.todoapp.service.ToBuysService; |
|
|
|
|
import jakarta.validation.Valid; |
|
|
|
|
|
|
|
|
@ -44,6 +45,9 @@ public class ToBuysController { |
|
|
|
|
@Autowired |
|
|
|
|
private UserRepository userRepository; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private StuffsRepository stuffsRepository; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 新しい購入アイテムを追加する |
|
|
|
|
* |
|
|
|
@ -92,8 +96,8 @@ public class ToBuysController { |
|
|
|
|
.map(toBuy -> { |
|
|
|
|
ToBuyResponse resp = new ToBuyResponse(); |
|
|
|
|
resp.setTobuy_id(toBuy.getTobuy_id()); |
|
|
|
|
resp.setStuff_id(toBuy.getStuffs().getStuff_id()); |
|
|
|
|
resp.setStuff_name(toBuy.getStuffs().getStuff_name()); |
|
|
|
|
resp.setStuff_id(toBuy.getStuff_id()); |
|
|
|
|
resp.setStuff_name(stuffsRepository.findByStuff_id(toBuy.getStuff_id()).getStuff_name()); |
|
|
|
|
resp.setAmount(toBuy.getAmount()); |
|
|
|
|
resp.setShop(toBuy.getStore()); |
|
|
|
|
return resp; |
|
|
|
|