Skip to content

Commit

Permalink
feat: 수정 요청 값을 받아 service 계층으로 보내는 기능 구현 #8
Browse files Browse the repository at this point in the history
  • Loading branch information
shimbaa committed Sep 5, 2024
1 parent e12ed85 commit aa82bff
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import buddyguard.mybuddyguard.weight.dto.WeightCreateRequest;
import buddyguard.mybuddyguard.weight.dto.WeightResponse;
import buddyguard.mybuddyguard.weight.dto.WeightUpdateRequest;
import buddyguard.mybuddyguard.weight.service.WeightService;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand Down Expand Up @@ -42,4 +44,13 @@ public ResponseEntity<Void> createNewWeightRecord(@RequestBody WeightCreateReque
weightService.createNewWeightRecord(request);
return new ResponseEntity<>(HttpStatus.CREATED);
}

@PatchMapping("/{id}")
public ResponseEntity<Void> updateWeightRecord(@PathVariable("id") Long id, @RequestBody WeightUpdateRequest request) {

weightService.updateWeightRecord(id, request);

return new ResponseEntity<>(HttpStatus.OK);
}

}

0 comments on commit aa82bff

Please sign in to comment.