Skip to content

Commit

Permalink
Merge pull request #27 from Drink-Easy/feature/tastingNote2
Browse files Browse the repository at this point in the history
#1 Refactor : tasting note 저장시 member 저장 안되는 것 및 노트조회 수정, SecurityConfig 인가 추가
  • Loading branch information
jeongyeon0208 authored Aug 11, 2024
2 parents ad38641 + bc9aa52 commit 0225ed6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/com/drinkeg/drinkeg/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,20 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
//.requestMatchers("/my").authenticated()
.requestMatchers("/", "/join", "/login").permitAll()

// tasting note 인가
.requestMatchers("tasting-note/**").hasRole("USER")

// wine note 인가
.requestMatchers(HttpMethod.GET, "wine-note/**").permitAll()
.requestMatchers(HttpMethod.POST, "wine-note/**").hasRole("USER")
.requestMatchers(HttpMethod.PATCH, "wine-note/**").hasRole("USER")

// wine class 인가
.requestMatchers(HttpMethod.POST, "wine-class/**").hasRole("ADMIN")
.requestMatchers(HttpMethod.PUT, "wine-class/**").hasRole("ADMIN")
.requestMatchers(HttpMethod.DELETE, "wine-class/**").hasRole("ADMIN")

.requestMatchers("/", "/join", "/login","/reissue").permitAll()
.requestMatchers("/", "/join", "/login", "/reissue").permitAll()
.requestMatchers("/api-docs/**", "/swagger-ui/**", "/swagger-ui.html/**", "/v3/api-docs/**", "/swagger-ui/index.html#/**").permitAll()
.anyRequest().authenticated());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class TastingNoteConverter {
// NotNull은 null이 아님을 보장하는 어노테이션
public static TastingNote toTastingNoteEntity(NoteRequestDTO noteRequestDTO, @NotNull Member member, @NotNull Wine wine) {
return TastingNote.builder()
.member(member)

.wine(wine)
.color(noteRequestDTO.getColor())

Expand Down Expand Up @@ -60,6 +62,7 @@ public static NoteResponseDTO toTastingNoteResponseDTO(TastingNote tastingNote)
// TastingNote Entity를 NotePriviewResponseDTO로 변환
public static NotePriviewResponseDTO toTastingNotePreviewDTO(TastingNote tastingNote) {
return NotePriviewResponseDTO.builder()
.noteId(tastingNote.getId())
.name(tastingNote.getWine().getName())
.picture(tastingNote.getWine().getPicture())
.build();
Expand Down

0 comments on commit 0225ed6

Please sign in to comment.