Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: swagger 설명 추가 #84

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import buddyguard.mybuddyguard.weight.contoller.response.WeightResponse;
import buddyguard.mybuddyguard.weight.contoller.request.WeightUpdateRequest;
import buddyguard.mybuddyguard.weight.service.WeightService;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import java.util.List;
import lombok.RequiredArgsConstructor;
Expand All @@ -25,6 +26,7 @@ public class WeightController {

private final WeightService weightService;

@Operation(summary = "해당 id pet의 모든 체중 기록 조회")
@GetMapping("/{petId}")
public ResponseEntity<List<WeightResponse>> getAllWeightRecords(
@PathVariable("petId") Long petId) {
Expand All @@ -33,6 +35,7 @@ public ResponseEntity<List<WeightResponse>> getAllWeightRecords(
return ResponseEntity.ok(responses);
}

@Operation(summary = "체중 단일 조회", description = "pet id는 체중이 해당 pet의 기록이 맞는지 검증 위해 쓰임.")
@GetMapping("/{petId}/detail/{id}")
public ResponseEntity<WeightResponse> getDetailWeightRecord(
@PathVariable("petId") Long petId,
Expand All @@ -42,13 +45,15 @@ public ResponseEntity<WeightResponse> getDetailWeightRecord(
return ResponseEntity.ok(response);
}

@Operation(summary = "체중 기록 생성")
@PostMapping
public ResponseEntity<Void> createNewWeightRecord(@RequestBody @Valid WeightCreateRequest request) {

weightService.createNewWeightRecord(request);
return new ResponseEntity<>(HttpStatus.CREATED);
}

@Operation(summary = "체중 기록 수정", description = "pet id는 체중이 해당 pet의 기록이 맞는지 검증 위해 쓰임.")
@PatchMapping("/{petId}/detail/{id}")
public ResponseEntity<Void> updateWeightRecord(
@PathVariable("petId") Long petId,
Expand All @@ -60,6 +65,7 @@ public ResponseEntity<Void> updateWeightRecord(
return new ResponseEntity<>(HttpStatus.OK);
}

@Operation(summary = "체중 기록 삭제", description = "pet id는 체중이 해당 pet의 기록이 맞는지 검증 위해 쓰임.")
@DeleteMapping("/{petId}/detail/{id}")
public ResponseEntity<Void> deleteWeightRecord(
@PathVariable("petId") Long petId,
Expand Down