Skip to content

Commit

Permalink
🐛[fix]: 사용자 취향 테이블을 수정하는 api이기때문에 userPrefId 를 pathVariable로 받는 것이 타당함.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyesooo committed Nov 5, 2023
1 parent 1c3dbdb commit 618a9e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.pingpong.quoteBakery.app.service.QuoteService;
import com.pingpong.quoteBakery.app.service.UserPrefService;
import com.pingpong.quoteBakery.com.api.response.ApiRes;
import com.pingpong.quoteBakery.sys.resource.CommCdTpResource;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
Expand Down Expand Up @@ -77,13 +76,14 @@ public ApiRes<UserPrefResource> getUserPref(@PathVariable("userId") Long userId)
/**
* 사용자 취향 수정
*/
@PutMapping("/user-pref/{userId}")
@PutMapping("/user-pref/{userPrefId}")
@Operation(summary = "사용자 취향 수정", description = "사용자의 취향정보를 수정 한다.",
responses = {@ApiResponse(responseCode = "200", description = "수정 성공", content = @Content(schema = @Schema(type = "number", description = "사용자취향ID")))}
)
@Parameter(name = "userId", description = "사용자ID", in = ParameterIn.PATH)
public ApiRes<Long> saveUserPref(@PathVariable("userId") Long userId,
@Parameter(name = "userPrefId", description = "사용자취향ID", in = ParameterIn.PATH)
public ApiRes<Long> saveUserPref(@PathVariable("userPrefId") Long userPrefId,
@RequestBody @io.swagger.v3.oas.annotations.parameters.RequestBody UserPrefUpdateResource updateResource){
updateResource.setUserPrefId(userPrefId);
return ApiRes.createSuccess(userPrefService.updateUserPref(quoteConverter.convertToGeneric(updateResource, UserPrefDto.class)));
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.pingpong.quoteBakery.app.resource;

import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import lombok.Getter;
import lombok.Setter;

Expand All @@ -11,7 +11,8 @@
@Getter
@Setter
public class UserPrefUpdateResource {
@Schema(description = "사용자취향ID", requiredMode= RequiredMode.REQUIRED)
@Hidden
@Schema(description = "사용자취향ID")
private Long userPrefId;

@Schema(description = "맛 리스트")
Expand Down

0 comments on commit 618a9e9

Please sign in to comment.