Skip to content

Commit

Permalink
Merge pull request #16 from SOPT-33-iOS-Team-1/feat/#15-get-user-detail
Browse files Browse the repository at this point in the history
Feat/#15 get user detail
  • Loading branch information
yummygyudon authored Nov 25, 2023
2 parents 27ef4e3 + 4e16a4f commit 19fff23
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
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(
"지게차운전기능사",
"농기계운전기능사",
"건설기계설비기사",
"산업안전산업기사"
);
}
}

0 comments on commit 19fff23

Please sign in to comment.