diff --git a/src/main/kotlin/com/yapp/web2/domain/bookmark/BookmarkDto.kt b/src/main/kotlin/com/yapp/web2/domain/bookmark/BookmarkDto.kt index 73c6278f..1d8f0202 100644 --- a/src/main/kotlin/com/yapp/web2/domain/bookmark/BookmarkDto.kt +++ b/src/main/kotlin/com/yapp/web2/domain/bookmark/BookmarkDto.kt @@ -75,7 +75,7 @@ class BookmarkDto { @ApiModel(description = "북마크 생성 리스트 DTO") data class AddBookmarkListDto( @ApiModelProperty(value = "북마크 객체 리스트", required = true) - val addBookmarkList: ImmutableList + val addBookmarkList: MutableList ) @ApiModel(description = "북마크 이동 API(폴더별 이동)") diff --git a/src/main/kotlin/com/yapp/web2/domain/bookmark/controller/BookmarkInterfaceController.kt b/src/main/kotlin/com/yapp/web2/domain/bookmark/controller/BookmarkInterfaceController.kt new file mode 100644 index 00000000..08024f56 --- /dev/null +++ b/src/main/kotlin/com/yapp/web2/domain/bookmark/controller/BookmarkInterfaceController.kt @@ -0,0 +1,34 @@ +package com.yapp.web2.domain.bookmark.controller + +import com.yapp.web2.domain.bookmark.BookmarkDto +import com.yapp.web2.domain.bookmark.service.PersonalBookmarkService +import com.yapp.web2.util.ControllerUtil +import com.yapp.web2.util.Message +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import org.springframework.http.HttpStatus +import org.springframework.http.ResponseEntity +import org.springframework.web.bind.annotation.* +import javax.servlet.http.HttpServletRequest + +@RestController +@RequestMapping("/api/v1/bookmarkInterface") +class BookmarkInterfaceController( + private val personalBookmarkService: PersonalBookmarkService +) { + + + // TODO: 2022/06/26 로직 안에서 personal shared 나눠서 저장하기 + @ApiOperation(value = "여러개의 북마크 생성 API") + @PostMapping + fun createBookmarkList( + request: HttpServletRequest, + @RequestParam(required = false) @ApiParam(value = "북마크가 저장될 폴더 ID", example = "12") folderId: Long?, + @ApiParam(value = "북마크 생성 리스트 정보") @RequestBody dto: BookmarkDto.AddBookmarkListDto + ): ResponseEntity { + println(folderId) + val token = ControllerUtil.extractAccessToken(request) + personalBookmarkService.addBookmarkList(token, folderId, dto) + return ResponseEntity.status(HttpStatus.OK).body(Message.SAVED) + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/yapp/web2/domain/bookmark/controller/PersonalBookmarkController.kt b/src/main/kotlin/com/yapp/web2/domain/bookmark/controller/PersonalBookmarkController.kt index 61dea56f..8b55cf88 100644 --- a/src/main/kotlin/com/yapp/web2/domain/bookmark/controller/PersonalBookmarkController.kt +++ b/src/main/kotlin/com/yapp/web2/domain/bookmark/controller/PersonalBookmarkController.kt @@ -4,7 +4,6 @@ import com.yapp.web2.domain.bookmark.BookmarkDto import com.yapp.web2.domain.bookmark.service.PersonalBookmarkService import com.yapp.web2.util.ControllerUtil import com.yapp.web2.util.Message -import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam import org.springframework.http.HttpStatus @@ -18,42 +17,6 @@ import javax.validation.Valid class PersonalBookmarkController( private val personalBookmarkService: PersonalBookmarkService ) { - - @ApiOperation(value = "북마크 생성 API") - @PostMapping("/{folderId}") - fun createBookmark( - request: HttpServletRequest, - @PathVariable @ApiParam(value = "북마크를 지정할 폴더 ID", example = "12", required = true) folderId: Long?, - @RequestBody @ApiParam(value = "북마크 생성 정보", required = true) bookmark: BookmarkDto.AddBookmarkDto - ): ResponseEntity { - val token = ControllerUtil.extractAccessToken(request) - personalBookmarkService.addBookmark(token, folderId, bookmark) - return ResponseEntity.status(HttpStatus.OK).body(Message.SAVED) - } - - @ApiOperation(value = "폴더에 속하지 않는 북마크 생성 API") - @PostMapping - fun createBookmarkNoFolder( - request: HttpServletRequest, - @RequestBody @ApiParam(value = "북마크 생성 정보", required = true) bookmark: BookmarkDto.AddBookmarkDto - ): ResponseEntity { - val token = ControllerUtil.extractAccessToken(request) - personalBookmarkService.addBookmark(token, null, bookmark) - return ResponseEntity.status(HttpStatus.OK).body(Message.SAVED) - } - - @ApiOperation(value = "여러개의 북마크 생성 API") - @PostMapping("/list/{folderId}") - fun createBookmarkList( - request: HttpServletRequest, - @PathVariable @ApiParam(value = "북마크가 저장될 폴더 ID", example = "12") folderId: Long?, - @RequestBody @ApiParam(value = "북마크 생성 리스트 정보", required = true) dto: BookmarkDto.AddBookmarkListDto - ): ResponseEntity { - val token = ControllerUtil.extractAccessToken(request) - personalBookmarkService.addBookmarkList(token, folderId, dto) - return ResponseEntity.status(HttpStatus.OK).body(Message.SAVED) - } - @ApiOperation(value = "북마크 삭제 API") @PostMapping("/delete") fun deleteBookmark(@RequestBody bookmarkList: BookmarkDto.BookmarkIdList): ResponseEntity {