LM
Size: a a a
LM
S🕶
S🕶
UK
S🕶
@PatchMapping endpoint, чтоб вернуть только то что ты изменил,S🕶
@PatchMapping("/{customerId}/deposit/{amount}")
public CustomerDto depositMoneyToCustomerAccount(@PathVariable("customerId") Long customerId, @PathVariable("amount") Float amount) {
return customerToCustomerDto.convert(
customerService.depositMoney(customerId, amount)
);
}S🕶
@Transactional
public Customer depositMoney(Long customerId, Float amount) {
Customer customer = customerRepository.findById(customerId)
.orElseThrow(ResourceNotFoundException::new);
customer.depositBalance(amount);
return customerRepository.save(customer);
}
S🕶
{ balance: 100}, например - тот field который я обновил.Д
Д
S🕶
S🕶
Д
S🕶
S🕶
S🕶
S🕶
S🕶
Д