Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#142 jandi rate #181

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;

import io.oeid.mogakgo.core.properties.swagger.error.SwaggerUserErrorExamples;
import io.oeid.mogakgo.domain.user.application.dto.res.UserJandiRateRes;
import io.oeid.mogakgo.domain.user.presentation.dto.req.UserSignUpApiReq;
import io.oeid.mogakgo.domain.user.presentation.dto.req.UserUpdateApiReq;
import io.oeid.mogakgo.domain.user.presentation.dto.res.UserDevelopLanguageApiRes;
Expand All @@ -13,6 +14,7 @@
import io.oeid.mogakgo.exception.dto.ErrorResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.media.Schema;
Expand Down Expand Up @@ -109,5 +111,18 @@ ResponseEntity<List<UserDevelopLanguageApiRes>> userDevelopLanguageApi(
})
ResponseEntity<UserUpdateApiRes> userUpdateApi(@Parameter(hidden = true) Long userId,
UserUpdateApiReq request);


@Operation(summary = "νšŒμ› μž”λ”” 점수 쑰회", description = "νšŒμ›μ˜ μž”λ”” 점수λ₯Ό μ‘°νšŒν•  λ•Œ μ‚¬μš©ν•˜λŠ” API")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "νšŒμ› μž”λ”” 점수 쑰회 성곡",
content = @Content(schema = @Schema(implementation = UserJandiRateRes.class))),
@ApiResponse(responseCode = "404", description = "ν•΄λ‹Ή μœ μ €κ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠμŒ",
content = @Content(
mediaType = APPLICATION_JSON_VALUE,
schema = @Schema(implementation = ErrorResponse.class),
examples = @ExampleObject(name = "E020301", value = SwaggerUserErrorExamples.USER_NOT_FOUND))),
})
ResponseEntity<UserJandiRateRes> userJandiRateApi(@Parameter(in = ParameterIn.PATH) Long userId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.oeid.mogakgo.domain.user.application.dto.req.UserSignUpRequest;
import io.oeid.mogakgo.domain.user.application.dto.req.UserUpdateReq;
import io.oeid.mogakgo.domain.user.application.dto.res.UserDevelopLanguageRes;
import io.oeid.mogakgo.domain.user.application.dto.res.UserJandiRateRes;
import io.oeid.mogakgo.domain.user.application.dto.res.UserProfileResponse;
import io.oeid.mogakgo.domain.user.application.dto.res.UserSignUpResponse;
import io.oeid.mogakgo.domain.user.application.dto.res.UserUpdateRes;
Expand Down Expand Up @@ -105,6 +106,11 @@ public void deleteUser(Long userId) {
user.delete();
}

public UserJandiRateRes getUserJandiRate(Long userId) {
User user = userCommonService.getUserById(userId);
return UserJandiRateRes.of(user.getId(), user.getJandiRate());
}

private void validateWantedJobDuplicate(List<WantedJob> wantedJobs) {
Set<WantedJob> wantedJobSet = new HashSet<>(wantedJobs);
if (wantedJobSet.size() != wantedJobs.size()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.oeid.mogakgo.domain.user.application.dto.res;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Schema(description = "μœ μ €μ˜ μž”λ”” 점수")
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class UserJandiRateRes {

@Schema(description = "μœ μ € 아이디")
private Long userId;
@Schema(description = "μœ μ €μ˜ μž”λ”” 점수")
private Double jandiRate;

public static UserJandiRateRes of(Long userId, Double jandiRate) {
return new UserJandiRateRes(userId, jandiRate);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.oeid.mogakgo.domain.matching.application.UserMatchingService;
import io.oeid.mogakgo.domain.user.application.UserService;
import io.oeid.mogakgo.domain.user.application.dto.req.UserUpdateReq;
import io.oeid.mogakgo.domain.user.application.dto.res.UserJandiRateRes;
import io.oeid.mogakgo.domain.user.presentation.dto.req.UserSignUpApiReq;
import io.oeid.mogakgo.domain.user.presentation.dto.req.UserUpdateApiReq;
import io.oeid.mogakgo.domain.user.presentation.dto.res.UserDevelopLanguageApiRes;
Expand All @@ -19,6 +20,7 @@
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -44,6 +46,12 @@ public ResponseEntity<List<UserDevelopLanguageApiRes>> userDevelopLanguageApi(
return ResponseEntity.ok(response.stream().map(UserDevelopLanguageApiRes::from).toList());
}

@GetMapping("/jandi-rating/{userId}")
public ResponseEntity<UserJandiRateRes> userJandiRateApi(@PathVariable Long userId) {
var result = userService.getUserJandiRate(userId);
return ResponseEntity.ok(result);
}

@PatchMapping
public ResponseEntity<UserUpdateApiRes> userUpdateApi(@UserId Long userId,
@RequestBody @Valid UserUpdateApiReq request) {
Expand Down
Loading