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

πŸ“ [DOCUMENT] swaggger 반영 #155

Merged
merged 1 commit into from
Dec 5, 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
@@ -1,15 +1,89 @@
package com.carely.backend.controller.docs;

import com.carely.backend.dto.certificate.volunteerDTO;
import com.carely.backend.dto.response.ErrorResponseDTO;
import com.carely.backend.dto.response.ResponseDTO;
import com.carely.backend.dto.user.CustomUserDetails;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

public interface CertificateAPI {

@Operation(summary = "자격증 λ°œκΈ‰ν•˜κΈ°", description = "블둝체인에 80μ‹œκ°„ 봉사 μ‹œκ°„μ΄ μ—†μœΌλ©΄ λ°œκΈ‰λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "μžκ²©μ¦μ„ μ„±κ³΅μ μœΌλ‘œ λ°œκΈ‰ν–ˆμ„ 경우",
content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ResponseDTO.class))),

@ApiResponse(responseCode = "401", description = "잘λͺ»λœ ν† ν°μœΌλ‘œ μš”μ²­ν•  경우",
content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorResponseDTO.class),
examples = {
@ExampleObject(name = "INVALID_ACCESS_TOKEN", value = """
{
"status": 401,
"code": "INVALID_ACCESS_TOKEN",
"message": "μœ νš¨ν•˜μ§€ μ•Šμ€ ν† ν°μž…λ‹ˆλ‹€.",
"data": null
}
"""),
@ExampleObject(name = "TOKEN_EXPIRED", value = """
{
"status": 401,
"code": "TOKEN_EXPIRED",
"message": "토큰이 λ§Œλ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€.",
"data": null
}
"""),
@ExampleObject(name = "TOKEN_MISSING", value = """
{
"status": 401,
"code": "TOKEN_MISSING",
"message": "μš”μ²­ 헀더에 토큰이 μ—†μŠ΅λ‹ˆλ‹€.",
"data": null
}
""")
})),

@ApiResponse(responseCode = "406", description = "이미 자격증이 μ‘΄μž¬ν•˜λŠ” 경우",
content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorResponseDTO.class),
examples = {
@ExampleObject(value = """
{
"status": 406,
"error": "NOT_ACCEPTABLE",
"code": "ALREADY_HAS_CERTIFICATE",
"message": "이미 자격증이 μ‘΄μž¬ν•˜μ—¬ λ°œκΈ‰ν•  수 μ—†μŠ΅λ‹ˆλ‹€."
}
""")
})),
@ApiResponse(responseCode = "406", description = "μ‹€μŠ΅ μ‹œκ°„μ΄ λΆ€μ‘±ν•œ 경우",
content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorResponseDTO.class),
examples = {
@ExampleObject(value = """
{
"status": 406,
"error": "NOT_ACCEPTABLE",
"code": "TOTAL_TIME_NOT_ENOUGH",
"message": "μ‹€μŠ΅ μ‹œκ°„μ΄ μΆ©λΆ„ν•˜μ§€ μ•Šμ•„ μžκ²©μ¦μ„ λ°œκΈ‰ν•  수 μ—†μŠ΅λ‹ˆλ‹€."
}
""")
})),
})

public ResponseEntity<ResponseDTO<?>> issueCertificate(@AuthenticationPrincipal CustomUserDetails user) throws Exception;

@Operation(summary = "봉사 μ„Έμ…˜ μΆ”κ°€ν•˜κΈ°", description = "μ±„νŒ…μ—μ„œ λ΄‰μ‚¬ν•˜κ³  봉사 승인되면 μ•Œμ•„μ„œ λ“€μ–΄κ°‘λ‹ˆλ‹€. ν˜Ήμ‹œλ‚˜ ν•˜κ³  λ‘” κ±°")

public ResponseEntity<String> createVolunteerSession(@RequestBody volunteerDTO volunteer);
Expand All @@ -20,8 +94,7 @@ public interface CertificateAPI {
@Operation(summary = "봉사 μ„Έμ…˜ 뢈러였기(μš”μ–‘λ³΄ν˜Έ/μžμ›λ΄‰μ‚¬)", description = "volunteerType에 volunteer/care_worker 각각의 νƒ€μž…μ— ν•΄λ‹Ήν•˜λŠ” λ¦¬μŠ€νŠΈκ°€ λ°˜ν™˜λ©λ‹ˆλ‹€.")
public ResponseEntity<ResponseDTO<?>> getSessionsByUserAndTypeId(@PathVariable String volunteerType, @PathVariable String userId);

@Operation(summary = "자격증 λ°œκΈ‰ν•˜κΈ°", description = "블둝체인에 80μ‹œκ°„ 봉사 μ‹œκ°„μ΄ μ—†μœΌλ©΄ λ°œκΈ‰λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.")
public ResponseEntity<ResponseDTO<?>> issueCertificate(@PathVariable String userId) throws Exception;



@Operation(summary = "λ°œκΈ‰λœ 자격증 뢈러였기(certificateId)", description = "자격증 번호λ₯Ό 톡해 ν•΄λ‹Ή 자격증이 μ‘΄μž¬ν•˜λŠ”μ§€ 검증할 수 μžˆμŠ΅λ‹ˆλ‹€.")
Expand Down
Loading