-
Notifications
You must be signed in to change notification settings - Fork 1
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 #28 from olmangjolmang/OMJM-46-mynote
- Loading branch information
Showing
9 changed files
with
71 additions
and
46 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/com/ticle/server/mypage/controller/NoteController.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,37 @@ | ||
package com.ticle.server.mypage.controller; | ||
|
||
import com.ticle.server.global.dto.ResponseTemplate; | ||
import com.ticle.server.mypage.dto.MyNoteDto; | ||
import com.ticle.server.mypage.service.MyPageService; | ||
import com.ticle.server.user.service.CustomUserDetails; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@Tag(name="TicleNote",description = "티클노트 관련 API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/mypage") | ||
public class NoteController { | ||
|
||
private final MyPageService myPageService; | ||
|
||
@Operation(summary="티클노트",description = "userId에 해당하는 note들을 불러옴") | ||
@GetMapping("/my-note") | ||
public ResponseEntity<ResponseTemplate<Object>> getMyNotes(@AuthenticationPrincipal CustomUserDetails customUserDetails){ | ||
Long userId = customUserDetails.getUserId(); | ||
List<MyNoteDto> myNoteDtos = myPageService.getMyNotes(userId); | ||
return ResponseEntity | ||
.status(HttpStatus.OK) | ||
.body(ResponseTemplate.from(myNoteDtos)); | ||
} | ||
} |
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
12 changes: 0 additions & 12 deletions
12
src/main/java/com/ticle/server/mypage/repository/QuestionRepository.java
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
src/main/java/com/ticle/server/mypage/repository/ScrapRepository.java
This file was deleted.
Oops, something went wrong.
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
7 changes: 7 additions & 0 deletions
7
src/main/java/com/ticle/server/scrapped/repository/ScrappedRepository.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 |
---|---|---|
@@ -1,12 +1,19 @@ | ||
package com.ticle.server.scrapped.repository; | ||
|
||
import com.ticle.server.scrapped.domain.Scrapped; | ||
import com.ticle.server.user.domain.type.Category; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.Optional; | ||
|
||
|
||
public interface ScrappedRepository extends JpaRepository<Scrapped, Long> { | ||
Optional<Scrapped> findByUserIdAndPost_PostId(Long userId, Long postId); | ||
|
||
Page<Scrapped> findByUserId(Long userId, Pageable pageable); | ||
Page<Scrapped> findByUserIdAndPostCategory(@Param("userid") Long userId, @Param("category") Category category, Pageable pageable); | ||
|
||
} |
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