Skip to content

Commit

Permalink
refactor: swagger 설명 추가
Browse files Browse the repository at this point in the history
related to : #2
  • Loading branch information
jieunjin committed Oct 16, 2024
1 parent c30cdda commit d3149b2
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import buddyguard.mybuddyguard.hospital.controller.request.HospitalRecordCreateRequest;
import buddyguard.mybuddyguard.hospital.controller.request.HospitalRecordUpdateRequest;
import buddyguard.mybuddyguard.hospital.service.HospitalRecordService;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -20,6 +21,7 @@ public class HospitalRecordController {

private final HospitalRecordService hospitalRecordService;

@Operation(summary = "병원 전체 기록 조회", description = "petId 별 모든 병원 기록 조회")
@GetMapping
public ResponseEntity<List<HospitalRecordResponse>> getAllHospitalRecords(
@PathVariable("petId") Long petId) {
Expand All @@ -28,6 +30,7 @@ public ResponseEntity<List<HospitalRecordResponse>> getAllHospitalRecords(
return ResponseEntity.ok(records);
}

@Operation(summary = "병원 기록 상세 조회", description = "petId 별 특정 병원 기록 조회")
@GetMapping("/detail/{id}")
public ResponseEntity<HospitalRecordResponse> getHospitalRecord(
@PathVariable("petId") Long petId,
Expand All @@ -36,13 +39,15 @@ public ResponseEntity<HospitalRecordResponse> getHospitalRecord(
return ResponseEntity.ok(record);
}

@Operation(summary = "병원 기록 생성", description = "petId 별 병원 기록 생성")
@PostMapping
public ResponseEntity<Void> createHospitalRecord(
@Valid @RequestBody HospitalRecordCreateRequest request) {
hospitalRecordService.createHospitalRecord(request);
return new ResponseEntity<>(HttpStatus.CREATED);
}

@Operation(summary = "병원 기록 수정", description = "petId 별 특정 병원 기록 수정")
@PutMapping("/detail/{id}")
public ResponseEntity<Void> updateHospitalRecord(
@PathVariable Long petId,
Expand All @@ -54,6 +59,7 @@ public ResponseEntity<Void> updateHospitalRecord(
return new ResponseEntity<>(HttpStatus.OK);
}

@Operation(summary = "병원 기록 삭제", description = "petId 별 특정 병원 기록 삭제")
@DeleteMapping("/detail/{id}")
public ResponseEntity<Void> deleteHospitalRecord(
@PathVariable Long petId,
Expand Down

0 comments on commit d3149b2

Please sign in to comment.