-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from GDG-on-Campus-KNU/dev
* JPA N+1 수정, 페이징 조회 최적화 (#146) * Feat: 더미데이터 삽입 편의 기능 - member * Feat: 더미데이터 삽입 편의 기능 - application, team * Feat: 더미데이터 삽입 편의 기능 - post * Refac: jdbc insert 클래스 디렉토리 구분 * Feat: 더미데이터 nullable 필드 포함 * Feat: 팀 색성시 트랙별 멤버 조회 쿼리 - DB 필터링 이용 * Fix: 사용자 조회 N+1 수정 (fetch join) * Test: 직렬, 권한별 사용자 조회 테스트 작성 * Feat: count 쿼리 필요 없는 페이징 수정 - Comment * Feat: 페이징시 불필요한 count 쿼리 제거 - Post * Feat: 지원서 상세 조회 답변 fetch join * Feat: 게시글, 작성자 fetch join * Feat: 중간 테이블 이용시 불필요한 join 제거 (native query 이용) * Fix: Transactional 누락 추가 * Refac: team으로 member 정보를 찾는 동일한 쿼리 병합 * Docs: 주석 추가 * Test: 변경(통합)된 쿼리 테스트코드 수정 * 지원서 메모 동시성 제어 (#149) * Feat: 낙관적 락을 위한 version 필드 추가 * Fix: version을 추가하여 api spec 수정 + 합격 활성 날짜 변경 * Feat: 버전체크 로직 작성 * Fix: ObjectOptimisticLockingFailureException 핸들링, 버전체크 도메인 로직으로 수정 * Test: 지원서 메모 동시성 테스트 작성 * Fix: 에러코드 수정(PN->AN) * !HOTFIX: answer 없는 지원서도 조회되도록 쿼리 수정 * 기수 테이블 추가 / 지원서 기수별 구분 기능 추가 (#150) * Fix: 다른 기수 중복 지원을 위해 unique 제약 조건 제거 * Feat: 기수 저장을 위한 엔티티 생성 * Feat: 기수와 지원서 간 연관관계 작성 * Feat: 기수 레포지토리 작성 * Feat: 기수 DTO 작성 * Feat: 기수 서비스 작성 * Feat: 기수 컨트롤러 작성 * Feat: 기수 ErrorCode 작성 * Fix: 중복 제출 오류 코드를 좀더 명확하게 수정 * Feat: 지원서 403 에러코드 추가 * Feat: ClassYear 업데이트 편의 메서드 추가 * Refac: 에러코드를 명확하게 변경 * Feat: 지원서 작성 시 기수 정보도 요청 * Fix: 누락된 갱신 로직 적용 * Feat: 기수 정보를 포함해 지원서를 조회 * Fix: 기수 정보 단건 조회 방식 수정 * Fix: 잘못된 응답코드 수정 * Feat: 기수 - 지원서 간 연관관계 설정 * Feat: 조건별 서류 조회(필터링)에 기수 id 추가 * Fix: LocalDateTime 통신 형태 지정 * Fix: 잘못된 초기 지원 중복 체크 로직 수정 * Fix: 지원서 auto auditing 제거 * Fix: 지원서 - 프레젠테이션 계층 간 의존성 제거 * Feat: 예외 상황 추가 및 에러메시지 자세하게 수정 * Feat: 기수 예외처리 추가 * Test: 지원서 테스트에 기수 관련 로직 추가 및 수정 * Docs: 조건별 지원 서류 조회 스웨거 설명 추가 * Rename: ApplicationRequestDTO -> ApplicationModel * Fix: 고유 code로 수정 * Refac: 기수 관련 코드 분리 * Fix: 일관된 ErrorCode 사용 * Fix: 의미 없는 save 제거 * Fix: 객체 생성 방식 통일 * Fix: 테스트용 출력, 주석 삭제 * Docs: 분리한 기수 컨트롤러 스웨거 태그 추가 --------- Co-authored-by: kwonssshyeon <[email protected]> Co-authored-by: kwonssshyeon <[email protected]>
- Loading branch information
Showing
52 changed files
with
1,191 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,5 @@ out/ | |
|
||
src/main/resources/static/index.html | ||
src/main/resources/images/** | ||
.env | ||
.env | ||
gradle.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/com/gdsc_knu/official_homepage/controller/admin/AdminClassYearController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.gdsc_knu.official_homepage.controller.admin; | ||
|
||
import com.gdsc_knu.official_homepage.dto.admin.application.AdminApplicationRequest; | ||
import com.gdsc_knu.official_homepage.dto.admin.application.AdminApplicationResponse; | ||
import com.gdsc_knu.official_homepage.service.admin.AdminClassYearService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@Tag(name = "Admin ClassYear", description = "기수 관리 관련 API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("api/admin/class-year") | ||
public class AdminClassYearController { | ||
private final AdminClassYearService classYearService; | ||
|
||
@GetMapping() | ||
@Operation(summary="기수 목록 조회 API", description = "기수 목록을 조회합니다.") | ||
public ResponseEntity<List<AdminApplicationResponse.ClassYearResponse>> getClassYearList() { | ||
return ResponseEntity.ok(classYearService.getClassYearList()); | ||
} | ||
|
||
@GetMapping("/{id}") | ||
@Operation(summary="기수 단건 조회 API", description = "기수를 단건 조회합니다.") | ||
public ResponseEntity<AdminApplicationResponse.ClassYearResponse> getClassYear(@PathVariable("id") Long id) { | ||
return ResponseEntity.ok(classYearService.getClassYear(id)); | ||
} | ||
|
||
@PostMapping() | ||
@Operation(summary="기수 추가 API", description = "기수를 추가합니다.") | ||
public ResponseEntity<Void> addClassYear(@RequestBody AdminApplicationRequest.ClassYearRequest classYearRequest) { | ||
classYearService.addClassYear(classYearRequest); | ||
return new ResponseEntity<>(HttpStatus.CREATED); | ||
} | ||
|
||
@PutMapping() | ||
@Operation(summary="기수 수정 API", description = "기수의 정보를 수정합니다.") | ||
public ResponseEntity<Void> updateClassYear(@RequestParam("id") Long id, | ||
@RequestBody AdminApplicationRequest.ClassYearRequest classYearRequest) { | ||
classYearService.updateClassYear(id, classYearRequest); | ||
return new ResponseEntity<>(HttpStatus.OK); | ||
} | ||
|
||
@DeleteMapping() | ||
@Operation(summary="기수 삭제 API", description = "기수를 삭제 합니다.") | ||
public ResponseEntity<Void> deleteClassYear(@RequestParam("id") Long id) { | ||
classYearService.deleteClassYear(id); | ||
return new ResponseEntity<>(HttpStatus.OK); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...in/java/com/gdsc_knu/official_homepage/dto/admin/application/AdminApplicationRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.gdsc_knu.official_homepage.dto.admin.application; | ||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; | ||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; | ||
import com.gdsc_knu.official_homepage.entity.ClassYear; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public class AdminApplicationRequest { | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public static class Append { | ||
private String note; | ||
private Integer version; | ||
} | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public static class ClassYearRequest { | ||
private String name; | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") | ||
@JsonSerialize(using = LocalDateTimeSerializer.class) | ||
@JsonDeserialize(using = LocalDateTimeDeserializer.class) | ||
private LocalDateTime applyStartDateTime; | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") | ||
@JsonSerialize(using = LocalDateTimeSerializer.class) | ||
@JsonDeserialize(using = LocalDateTimeDeserializer.class) | ||
private LocalDateTime applyEndDateTime; | ||
|
||
public ClassYear toEntity() { | ||
return ClassYear.builder() | ||
.name(name) | ||
.applicationStartDateTime(applyStartDateTime) | ||
.applicationEndDateTime(applyEndDateTime) | ||
.build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/com/gdsc_knu/official_homepage/dto/application/ApplicationModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.gdsc_knu.official_homepage.dto.application; | ||
|
||
import com.gdsc_knu.official_homepage.entity.enumeration.ApplicationStatus; | ||
import com.gdsc_knu.official_homepage.entity.enumeration.Track; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@Builder | ||
@NoArgsConstructor | ||
public class ApplicationModel { | ||
private String techStack; | ||
private String links; | ||
private ApplicationStatus applicationStatus; | ||
private Track track; | ||
private List<ApplicationAnswerDTO> answers; | ||
|
||
public ApplicationModel(ApplicationRequest applicationRequest) { | ||
this.techStack = applicationRequest.getTechStack(); | ||
this.links = applicationRequest.getLinks(); | ||
this.applicationStatus = applicationRequest.getApplicationStatus(); | ||
this.track = applicationRequest.getTrack(); | ||
this.answers = applicationRequest.getAnswers(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/com/gdsc_knu/official_homepage/entity/ClassYear.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.gdsc_knu.official_homepage.entity; | ||
|
||
import com.gdsc_knu.official_homepage.entity.application.Application; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class ClassYear { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, unique = true) | ||
private String name; | ||
|
||
@Column(nullable = false) | ||
private LocalDateTime applicationStartDateTime; | ||
|
||
@Column(nullable = false) | ||
private LocalDateTime applicationEndDateTime; | ||
|
||
public void update(String name, LocalDateTime applicationStartDateTime, LocalDateTime applicationEndDateTime) { | ||
this.name = name; | ||
this.applicationStartDateTime = applicationStartDateTime; | ||
this.applicationEndDateTime = applicationEndDateTime; | ||
} | ||
} |
Oops, something went wrong.