Skip to content

Commit

Permalink
[merge] 재학생 대조 로직 수정 운영 배포 (#248)
Browse files Browse the repository at this point in the history
* [feat] : #183 캘린더 테이블 카테고리 enum 추가

* [feat] : #183 엔티티 설계

* [feat] : #183 일정 조회 구현

* [fix] : #183 일정추가 및 쿼리DSL 설정 확인

* [fix] : 로컬로 옮기기위한 커밋

* [fix]: #183-calendar 예외처리 불분명

* [fix] : exception 핸들러 하위 에러 처리 오류 해결

* [fix] : 레전드 import 문제 수정

* [fix] : ACL 적용 기능구현(미완성) 원격저장소를 위한 커밋

* [fix] : 권한 처리

* [fix] : 경고제거

* [fix] : 캘린더 조회 방법 수정

* [fix] #224 userId hidden

* [fix] : 스테이징

* [fix] : 오타수정

* [fix] #229 질의응답게시판 이메일 발송 임시

* [feat] : 정렬 일자별

* [fix] : 수정,삭제 api 구현

* [feat] : 일정 단건 조회

* [feat] : 페이지네이션 적용

* [fix] #234 질의응답게시판 자치기구 계정 댓글 삭제 권한 추가

* [feat] #232 디스코드 웹훅, 봇 사용자수 알림

* [fix] discord 스케줄 정지

* [fix] : /user-info API 수정 및 온보딩 예외처리

* [fix] : 학과/단과대 업데이트

* [fix] : 학과/단과대 업데이트

* [feat] : 재학생 대조 로직 일부 제거 및 /user-info 자치기구계정 방어처리

* [feat] : 재학생 대조 로직 수정

* [feat] : 재학생 대조 로직 수정

* [feat] : 재학생 대조 로직 수정

---------

Co-authored-by: jinseok <[email protected]>
Co-authored-by: beakgugong <[email protected]>
  • Loading branch information
3 people authored Mar 4, 2025
1 parent 9a3bd51 commit 184e55f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
import ussum.homepage.domain.csv_user.StudentCsv;
import ussum.homepage.domain.member.Member;
import ussum.homepage.domain.user.User;
import ussum.homepage.global.error.exception.InvalidValueException;
import ussum.homepage.infra.jpa.member.entity.MajorCode;
import ussum.homepage.infra.jpa.member.entity.MemberCode;

import static ussum.homepage.global.error.status.ErrorStatus.INVALID_MAJORCODE;

@Builder
public record UserInfoResponse(
String name,
String studentId,
String major,
boolean isCouncil
) {
public static UserInfoResponse of(StudentCsv studentCsv, Member member){
public static UserInfoResponse of(StudentCsv studentCsv, Member member) {
return UserInfoResponse.builder()
.name(studentCsv.getStudentName())
.studentId(String.valueOf(studentCsv.getStudentId()))
Expand All @@ -23,11 +26,22 @@ public static UserInfoResponse of(StudentCsv studentCsv, Member member){
.build();
}

public static UserInfoResponse of(User user, Member member){
public static UserInfoResponse of(User user, Member member) {

String target = "null";
// 자치기구 계정의 경우 MajorCode가 null이라 MemberCode로 내려가게 함
try {
target = MajorCode.getEnumMajorCodeFromStringMajorCode(member.getMajorCode()).getStringMajorCode();
} catch (Exception e) {
if (e instanceof InvalidValueException && ((InvalidValueException) e).getBaseErrorCode() == INVALID_MAJORCODE) {
target = MemberCode.getEnumMemberCodeFromStringMemberCode(member.getMemberCode()).getStringMemberCode();
}
}

return UserInfoResponse.builder()
.name(user.getName())
.studentId(user.getStudentId() == null ? "null" : String.valueOf(user.getStudentId()))
.major(MajorCode.getEnumMajorCodeFromStringMajorCode(member.getMajorCode()).getStringMajorCode())
.major(target)
.isCouncil(member.getIsAdmin())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import java.util.Optional;

import static ussum.homepage.global.error.status.ErrorStatus.ONBOARDING_ONLY_COLLECT_NAME_STUDENT_ID_ERROR;

@Service
@RequiredArgsConstructor
public class StudentCsvReader {
Expand All @@ -21,7 +23,15 @@ public class StudentCsvReader {
public Optional<StudentCsv> getStudentWithStudentId(Long studentId, OnBoardingRequest request) {
return studentCsvRepository.findByStudentId(studentId)
.map(studentCsv -> {
checkStudentRight(request, studentCsv);
try {
checkStudentRight(request, studentCsv);
} catch (Exception e) {
if (e instanceof GeneralException && ((GeneralException) e).getBaseErrorCode() == ONBOARDING_ONLY_COLLECT_NAME_STUDENT_ID_ERROR) {
return null;
} else {
throw e;
}
}
return studentCsv;
});
}
Expand Down Expand Up @@ -58,8 +68,15 @@ private void checkStudentRight(OnBoardingRequest request, StudentCsv studentCsv)
}
}

if(!(name && studentId && groupName && major)){
/// PASSU 개강행사(2025.03) 진행하면서 이름과 학번만 대조하도록 수정. 코드는 남겨둠. 유저 학과와 단과대 데이터의 신뢰성이 많이 떨어짐.
// if(!(name && studentId && groupName && major)){
if(!(name && studentId)){
throw new GeneralException(ErrorStatus.INVALID_ONBOARDING_REQUEST);
} else {
// 이름 학번 단과대 전공이 모두 같으면 isVerified true로 세팅하기 위함.
if (!(groupName && major)) {
throw new GeneralException(ONBOARDING_ONLY_COLLECT_NAME_STUDENT_ID_ERROR);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public enum ErrorStatus implements BaseErrorCode {
//온보딩에러
INVALID_ONBOARDING_REQUEST(HttpStatus.BAD_REQUEST,"ONBOARDING_001","온보딩 정보가 올바르지 않습니다."),
ONBOARDING_FAIL_MAIL_ERROR(HttpStatus.BAD_REQUEST, "ONBOARDING_002","메일이 정상적으로 보내지지 않았습니다."),
ONBOARDING_ONLY_COLLECT_NAME_STUDENT_ID_ERROR(HttpStatus.BAD_REQUEST, "ONBOARDING_003","온보딩 정보가 올바르지 않습니다."),

//S3에러
S3_ERROR(HttpStatus.INTERNAL_SERVER_ERROR,"S3_001","S3에 파일 저장이 실패했습니다."),
Expand Down

0 comments on commit 184e55f

Please sign in to comment.