-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #675 from woowacourse-teams/feat/668-be-like
- Loading branch information
Showing
6 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
backend/src/main/java/codezap/like/controller/LikeController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package codezap.like.controller; | ||
|
||
import org.apache.commons.lang3.NotImplementedException; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
|
||
import codezap.member.dto.MemberDto; | ||
|
||
@Controller | ||
public class LikeController implements SpringDocsLikeController { | ||
|
||
@PostMapping("like/{templateId}") | ||
public ResponseEntity<Void> like(MemberDto memberDto, @PathVariable long templateId) { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
@DeleteMapping("like/{templateId}") | ||
public ResponseEntity<Void> cancelLike(MemberDto memberDto, @PathVariable long templateId) { | ||
throw new NotImplementedException(); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
backend/src/main/java/codezap/like/controller/SpringDocsLikeController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package codezap.like.controller; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
import codezap.global.swagger.error.ApiErrorResponse; | ||
import codezap.global.swagger.error.ErrorCase; | ||
import codezap.member.dto.MemberDto; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
@Tag(name = "좋아요 API", description = "좋아요 기능 관련 API") | ||
public interface SpringDocsLikeController { | ||
|
||
@SecurityRequirement(name = "쿠키 인증 토큰") | ||
@Operation(summary = "좋아요", description = "템플릿을 좋아요 합니다.") | ||
@ApiResponse(responseCode = "200", description = "좋아요 성공") | ||
@ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/like/1", errorCases = { | ||
@ErrorCase(description = "템플릿 Id 에 해당하는 템플릿이 존재하지 않는 경우", exampleMessage = "식별자 1에 해당하는 템플릿이 존재하지 않습니다.") | ||
}) | ||
@ApiErrorResponse(status = HttpStatus.UNAUTHORIZED, instance = "/like/1", errorCases = { | ||
@ErrorCase(description = "인증 정보에 해당하는 멤버가 없는 경우", exampleMessage = "인증 정보가 정확하지 않습니다.") | ||
}) | ||
ResponseEntity<Void> like(MemberDto memberDto, long templateId); | ||
|
||
@SecurityRequirement(name = "쿠키 인증 토큰") | ||
@Operation(summary = "좋아요 취소", description = "템플릿 좋아요를 취소합니다.") | ||
@ApiResponse(responseCode = "200", description = "좋아요 취소 성공") | ||
@ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/dislike/1", errorCases = { | ||
@ErrorCase(description = "템플릿 Id 에 해당하는 템플릿이 존재하지 않는 경우", exampleMessage = "식별자 1에 해당하는 템플릿이 존재하지 않습니다.") | ||
}) | ||
@ApiErrorResponse(status = HttpStatus.UNAUTHORIZED, instance = "/dislike/1", errorCases = { | ||
@ErrorCase(description = "인증 정보에 해당하는 멤버가 없는 경우", exampleMessage = "인증 정보가 정확하지 않습니다.") | ||
}) | ||
ResponseEntity<Void> cancelLike(MemberDto memberDto, long templateId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters