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/#15 get user detail #16

Merged
merged 3 commits into from
Nov 25, 2023
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 lombok.RequiredArgsConstructor;
import org.sopt.sopkerton.common.response.ApiResponse;
import org.sopt.sopkerton.user.domain.exception.UserSuccess;
import org.sopt.sopkerton.user.dto.response.DetailView;
import org.sopt.sopkerton.user.dto.response.MainView;
import org.sopt.sopkerton.user.service.UserService;
import org.springframework.http.ResponseEntity;
Expand All @@ -29,4 +30,16 @@ public ResponseEntity<ApiResponse<MainView>> orderMainView(
ApiResponse.success(UserSuccess.USER_MAIN_VIEW_SUCCESS, mainViewInfo)
);
}

@GetMapping("/info/detail/{userId}")
public ResponseEntity<ApiResponse<DetailView>> orderDetailView(
@PathVariable("userId") Long userId
) {
DetailView detailInfo = userService.getDetailInfo(userId);
return ResponseEntity
.status(UserSuccess.USER_DETAIL_VIEW_SUCCESS.getHttpStatus())
.body(
ApiResponse.success(UserSuccess.USER_DETAIL_VIEW_SUCCESS, detailInfo)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

@AllArgsConstructor
public enum UserSuccess implements SuccessBase {
USER_MAIN_VIEW_SUCCESS(HttpStatus.OK, "Get User Main View Data Successful.")
USER_MAIN_VIEW_SUCCESS(HttpStatus.OK, "Get User Main View Data Successful."),
USER_DETAIL_VIEW_SUCCESS(HttpStatus.OK, "Get User Detail View Data Successful.") ,
;

private final HttpStatus status;
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/org/sopt/sopkerton/user/dto/response/DetailView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.sopt.sopkerton.user.dto.response;

import java.util.List;

public record DetailView(
List<String> volunteers,
List<String> programs,
List<String> certifications
) {
}
37 changes: 37 additions & 0 deletions src/main/java/org/sopt/sopkerton/user/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import org.sopt.sopkerton.user.domain.enums.Gender;
import org.sopt.sopkerton.user.domain.exception.UserError;
import org.sopt.sopkerton.user.domain.exception.UserException;
import org.sopt.sopkerton.user.dto.response.DetailView;
import org.sopt.sopkerton.user.dto.response.MainView;
import org.sopt.sopkerton.user.infrastructure.UserRepository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class UserService {
Expand Down Expand Up @@ -47,4 +50,38 @@ public MainView getMainViewInfo(Long userId) {
RING_RATE
);
}

public DetailView getDetailInfo(Long userId) {
return new DetailView(
makeVolunteers(),
makeCompletedPrograms(),
makeCertifications()
);
}


private List<String> makeVolunteers() {
return List.of(
"์–ด๋ฅด์‹  ์ƒํ™œํŽธ์˜ ๋ณด์กฐ ๋„์›€",
"๋ฐฑํ•ฉ์š”์–‘์› ์–ด๋ฅธ์‹ ๋“ค ์ด๋ฏธ์šฉ๋ด‰์‚ฌ",
"๋‘˜๋ ˆ๊ธธ ํ™˜๊ฒฝ์ •ํ™” ํ”Œ๋กœ๊น… ํ™œ๋™",
"์šฉ์ง„์ ์‹ค๋กœ์•”๋ณ‘์› ๋ด‰์‚ฌํ™œ๋™"
);
}
private List<String> makeCompletedPrograms() {
return List.of(
"์‚ฌํšŒ์„ฑํ–ฅ์ƒ ํ”„๋กœ๊ทธ๋žจ",
"์ง์—…ํ›ˆ๋ จ ํ”„๋กœ๊ทธ๋žจ",
"๋ฉด์ ‘์ง€๋„ ํ”„๋กœ๊ทธ๋žจ",
"์‹ฌ๋ฆฌ์น˜๋ฃŒ ํ”„๋กœ๊ทธ๋žจ"
);
}
private List<String> makeCertifications() {
return List.of(
"์ง€๊ฒŒ์ฐจ์šด์ „๊ธฐ๋Šฅ์‚ฌ",
"๋†๊ธฐ๊ณ„์šด์ „๊ธฐ๋Šฅ์‚ฌ",
"๊ฑด์„ค๊ธฐ๊ณ„์„ค๋น„๊ธฐ์‚ฌ",
"์‚ฐ์—…์•ˆ์ „์‚ฐ์—…๊ธฐ์‚ฌ"
);
}
}