Skip to content

Commit

Permalink
[feat] 친구들이 등록한 선물 API swagger 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
hysong4u committed Jan 12, 2024
1 parent bec103d commit 564b95b
Showing 1 changed file with 43 additions and 4 deletions.
47 changes: 43 additions & 4 deletions src/main/java/org/sopt/sweet/domain/gift/controller/GiftApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
Expand All @@ -12,14 +13,13 @@
import org.sopt.sweet.domain.gift.dto.request.CreateGiftRequestDto;
import org.sopt.sweet.domain.gift.dto.request.MyGiftsRequestDto;
import org.sopt.sweet.domain.gift.dto.request.TournamentScoreRequestDto;
import org.sopt.sweet.domain.gift.dto.response.TournamentRankingResponseDto;
import org.sopt.sweet.global.common.SuccessResponse;
import org.sopt.sweet.global.config.auth.UserId;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Map;

@Tag(name = "선물", description = "선물 관련 API")
public interface GiftApi {
Expand Down Expand Up @@ -147,7 +147,7 @@ ResponseEntity<SuccessResponse<?>> evaluateTournamentScore(
example = "12345"
) @UserId Long userId,
@Valid @RequestBody TournamentScoreRequestDto tournamentScoreRequestDto
);
);


@Operation(
Expand Down Expand Up @@ -194,7 +194,7 @@ ResponseEntity<SuccessResponse<?>> getTournamentInfo(
description = "토너먼트 랭킹 조회 성공",
content = @Content(
mediaType = "application/json",
schema = @Schema(implementation = SuccessResponse.class)
array = @ArraySchema(schema = @Schema(implementation = SuccessResponse.class))
)
),
@ApiResponse(
Expand All @@ -219,4 +219,43 @@ ResponseEntity<SuccessResponse<?>> getRanking(
) @UserId Long userId,
@PathVariable Long roomId
);

@Operation(
summary = "친구들이 등록한 선물 조회 API",
responses = {
@ApiResponse(
responseCode = "200",
description = "친구들이 등록한 선물 조회 성공",
content = @Content(
mediaType = "application/json",
schema = @Schema(implementation = SuccessResponse.class)
)
),
@ApiResponse(
responseCode = "404",
description = "사용자 또는 방이 존재하지 않음",
content = @Content
),
@ApiResponse(
responseCode = "403",
description = "사용자가 방에 속해있지 않음",
content = @Content
)
},
security = @SecurityRequirement(name = "token")
)
@GetMapping("/friend/{roomId}")
ResponseEntity<SuccessResponse<?>> getFriendGift(
@Parameter(
description = "authorization token에서 얻은 userId, 임의입력하면 대체됩니다.",
required = true,
example = "12345"
) @UserId Long userId,
@Parameter(
description = "방 ID",
required = true,
example = "2"
) @PathVariable Long roomId
);

}

0 comments on commit 564b95b

Please sign in to comment.