-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into mvp/career
- Loading branch information
Showing
67 changed files
with
2,244 additions
and
34 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
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 |
---|---|---|
|
@@ -35,5 +35,4 @@ out/ | |
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
.DS_Store |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM openjdk:17-alpine | ||
ARG JAR_FILE=build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
ENTRYPOINT ["java", "-jar", "/app.jar", "--spring.profiles.active=prod "] | ||
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "/app.jar"] |
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
27 changes: 27 additions & 0 deletions
27
src/main/java/umc/kkijuk/server/common/controller/ExceptionControllerAdvice.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,27 @@ | ||
package umc.kkijuk.server.common.controller; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
import umc.kkijuk.server.common.domian.exception.ResourceNotFoundException; | ||
import umc.kkijuk.server.common.domian.exception.ReviewRecruitNotMatchException; | ||
import umc.kkijuk.server.common.domian.response.ErrorResponse; | ||
|
||
@RestControllerAdvice | ||
@RequiredArgsConstructor | ||
public class ExceptionControllerAdvice { | ||
|
||
@ResponseStatus(HttpStatus.NOT_FOUND) | ||
@ExceptionHandler(ResourceNotFoundException.class) | ||
public ErrorResponse resourceNotFoundException(ResourceNotFoundException exception) { | ||
return new ErrorResponse(exception.getMessage()); | ||
} | ||
|
||
@ResponseStatus(HttpStatus.FORBIDDEN) | ||
@ExceptionHandler(ReviewRecruitNotMatchException.class) | ||
public ErrorResponse ReviewRecruitMatchException(ReviewRecruitNotMatchException exception) { | ||
return new ErrorResponse(exception.getMessage()); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/umc/kkijuk/server/common/domian/exception/ResourceNotFoundException.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,7 @@ | ||
package umc.kkijuk.server.common.domian.exception; | ||
|
||
public class ResourceNotFoundException extends RuntimeException{ | ||
public ResourceNotFoundException(String dataSource, long id) { | ||
super(dataSource + "에서 ID " + id + "를 찾을 수 없습니다."); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/umc/kkijuk/server/common/domian/exception/ReviewRecruitNotMatchException.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,7 @@ | ||
package umc.kkijuk.server.common.domian.exception; | ||
|
||
public class ReviewRecruitNotMatchException extends RuntimeException{ | ||
public ReviewRecruitNotMatchException(long recruitId, long reviewId) { | ||
super("Recruit "+ recruitId + "에서 Review " + reviewId + "를 찾을수 없습니다."); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/umc/kkijuk/server/common/domian/response/ErrorResponse.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,12 @@ | ||
package umc.kkijuk.server.common.domian.response; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ErrorResponse { | ||
private final String message; | ||
|
||
public ErrorResponse(String message) { | ||
this.message = message; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/umc/kkijuk/server/introduce/common/BaseResponse.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 umc.kkijuk.server.introduce.common; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class BaseResponse<T> { | ||
|
||
private final int status; | ||
private String message; | ||
private T data; | ||
|
||
// Response constructor that includes status, message, and data | ||
public BaseResponse(int status, String message, T data) { | ||
this.status = status; | ||
this.message = message; | ||
this.data = data; | ||
} | ||
|
||
// Response constructor that includes status and message only | ||
public BaseResponse(int status, String message) { | ||
this.status = status; | ||
this.message = message; | ||
} | ||
|
||
// Response constructor that includes status and data only | ||
public BaseResponse(int status, T data) { | ||
this.status = status; | ||
this.data = data; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/umc/kkijuk/server/introduce/controller/IntroduceController.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,4 @@ | ||
package umc.kkijuk.server.introduce.controller; | ||
|
||
public class IntroduceController { | ||
} |
79 changes: 79 additions & 0 deletions
79
src/main/java/umc/kkijuk/server/introduce/controller/MasterIntroduceController.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,79 @@ | ||
package umc.kkijuk.server.introduce.controller; | ||
|
||
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 umc.kkijuk.server.introduce.common.BaseResponse; | ||
import umc.kkijuk.server.introduce.domain.MasterIntroduce; | ||
import umc.kkijuk.server.introduce.dto.MasterIntroduceReqDto; | ||
import umc.kkijuk.server.introduce.dto.MasterIntroduceResDto; | ||
import umc.kkijuk.server.introduce.error.BaseErrorResponse; | ||
import umc.kkijuk.server.introduce.error.BaseException; | ||
import umc.kkijuk.server.introduce.service.MasterIntroduceService; | ||
|
||
import java.util.List; | ||
|
||
@Tag(name = "master", description = "마스터 자기소개서 API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/history/intro/master") | ||
public class MasterIntroduceController { | ||
private final MasterIntroduceService masterIntroduceService; | ||
|
||
@PostMapping | ||
public ResponseEntity<Object> save(@RequestBody MasterIntroduceReqDto masterIntroduceReqDto){ | ||
try { | ||
MasterIntroduceResDto masterIntroduceResDto = masterIntroduceService.saveMasterIntro(masterIntroduceReqDto); | ||
return ResponseEntity | ||
.status(HttpStatus.OK) | ||
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 생성 완료", masterIntroduceResDto)); | ||
} catch (BaseException e) { | ||
return ResponseEntity | ||
.status(e.getCode()) | ||
.body(new BaseErrorResponse(e.getCode(), e.getMessage())); | ||
} catch (Exception e) { | ||
return ResponseEntity | ||
.status(HttpStatus.INTERNAL_SERVER_ERROR) | ||
.body(new BaseErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Server error")); | ||
} | ||
} | ||
|
||
@GetMapping | ||
public ResponseEntity<Object> get(){ | ||
try { | ||
List<MasterIntroduce> masterIntroduce = masterIntroduceService.getMasterIntro(); | ||
return ResponseEntity | ||
.status(HttpStatus.OK) | ||
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 조회 완료", masterIntroduce)); | ||
} catch (BaseException e) { | ||
return ResponseEntity | ||
.status(e.getCode()) | ||
.body(new BaseErrorResponse(e.getCode(), e.getMessage())); | ||
} catch (Exception e) { | ||
return ResponseEntity | ||
.status(HttpStatus.INTERNAL_SERVER_ERROR) | ||
.body(new BaseErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Server error")); | ||
} | ||
} | ||
|
||
@PatchMapping | ||
public ResponseEntity<Object> update(Long id, @RequestBody MasterIntroduceReqDto masterIntroduceReqDto){ | ||
try { | ||
MasterIntroduceResDto masterIntroduceResDto = masterIntroduceService.updateMasterIntro(id, masterIntroduceReqDto); | ||
return ResponseEntity | ||
.status(HttpStatus.OK) | ||
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 수정 완료", masterIntroduceResDto)); | ||
} catch (BaseException e) { | ||
return ResponseEntity | ||
.status(e.getCode()) | ||
.body(new BaseErrorResponse(e.getCode(), e.getMessage())); | ||
} catch (Exception e) { | ||
return ResponseEntity | ||
.status(HttpStatus.INTERNAL_SERVER_ERROR) | ||
.body(new BaseErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Server error")); | ||
} | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/umc/kkijuk/server/introduce/domain/Introduce.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,15 @@ | ||
package umc.kkijuk.server.introduce.domain; | ||
|
||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Getter; | ||
|
||
@Entity | ||
@Table(name="introduce") | ||
@Getter | ||
public class Introduce { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/umc/kkijuk/server/introduce/domain/IntroduceRepository.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,6 @@ | ||
package umc.kkijuk.server.introduce.domain; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface IntroduceRepository extends JpaRepository<Introduce, Long> { | ||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/umc/kkijuk/server/introduce/domain/MasterIntroduce.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,57 @@ | ||
package umc.kkijuk.server.introduce.domain; | ||
|
||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.CreationTimestamp; | ||
import org.hibernate.annotations.UpdateTimestamp; | ||
import org.springframework.data.annotation.CreatedDate; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Date; | ||
|
||
@Entity | ||
@Table(name = "master_introduce") | ||
@Getter | ||
@NoArgsConstructor | ||
public class MasterIntroduce { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Size(max = 24) | ||
private String oneLiner; | ||
|
||
private String subTitle; | ||
private String content; | ||
|
||
@CreationTimestamp | ||
private LocalDateTime created_at; | ||
|
||
@UpdateTimestamp | ||
private LocalDateTime updated_at; | ||
|
||
@Builder | ||
public MasterIntroduce(String oneLiner, String subTitle, String content) { | ||
this.oneLiner = oneLiner; | ||
this.subTitle = subTitle; | ||
this.content = content; | ||
} | ||
|
||
public String getUpdated_at() { | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); | ||
return updated_at != null ? updated_at.format(formatter) : null; | ||
} | ||
|
||
public void update(String oneLiner, String subTitle, String content) { | ||
this.oneLiner = oneLiner; | ||
this.subTitle = subTitle; | ||
this.content = content; | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/umc/kkijuk/server/introduce/domain/MasterIntroduceRepository.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,6 @@ | ||
package umc.kkijuk.server.introduce.domain; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface MasterIntroduceRepository extends JpaRepository<MasterIntroduce, Long> { | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/umc/kkijuk/server/introduce/dto/MasterIntroduceReqDto.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,14 @@ | ||
package umc.kkijuk.server.introduce.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
@Getter | ||
public class MasterIntroduceReqDto { | ||
private String oneLiner; | ||
private String subTitle; | ||
private String content; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/umc/kkijuk/server/introduce/dto/MasterIntroduceResDto.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,24 @@ | ||
package umc.kkijuk.server.introduce.dto; | ||
|
||
import lombok.*; | ||
import umc.kkijuk.server.introduce.domain.MasterIntroduce; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Setter | ||
public class MasterIntroduceResDto { | ||
private String oneLiner; | ||
private String subTitle; | ||
private String content; | ||
private String updatedAt; | ||
|
||
@Builder | ||
public MasterIntroduceResDto(MasterIntroduce masterIntroduce) { | ||
this.oneLiner = masterIntroduce.getOneLiner(); | ||
this.subTitle = masterIntroduce.getSubTitle(); | ||
this.content = masterIntroduce.getContent(); | ||
this.updatedAt = masterIntroduce.getUpdated_at(); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/umc/kkijuk/server/introduce/error/BaseErrorResponse.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,18 @@ | ||
package umc.kkijuk.server.introduce.error; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class BaseErrorResponse { | ||
private final int status; | ||
private final String message; | ||
|
||
public BaseErrorResponse(int status, String message) { | ||
this.status = status; | ||
this.message = message; | ||
} | ||
|
||
public BaseErrorResponse(BaseException baseException) { | ||
this.status = baseException.getCode(); | ||
this.message = baseException.getMessage(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/umc/kkijuk/server/introduce/error/BaseException.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,16 @@ | ||
package umc.kkijuk.server.introduce.error; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class BaseException extends RuntimeException{ | ||
private final int code; | ||
private final String message; | ||
|
||
public BaseException(int code, String message) { | ||
this.code = code; | ||
this.message = message; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/umc/kkijuk/server/introduce/error/GlobalExceptionHandler.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,21 @@ | ||
package umc.kkijuk.server.introduce.error; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ControllerAdvice; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; // 여기에 추가 | ||
|
||
@ControllerAdvice | ||
public class GlobalExceptionHandler { | ||
|
||
@ExceptionHandler(Exception.class) | ||
public ResponseEntity<BaseErrorResponse> handleException(Exception e) { | ||
BaseException exception = new BaseException(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage()); | ||
return ResponseEntity.status(exception.getCode()).body(new BaseErrorResponse(exception)); | ||
} | ||
|
||
@ExceptionHandler(BaseException.class) | ||
public ResponseEntity<BaseErrorResponse> handleBaseException(BaseException e) { | ||
return ResponseEntity.status(e.getCode()).body(new BaseErrorResponse(e)); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/umc/kkijuk/server/introduce/service/IntroduceService.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,4 @@ | ||
package umc.kkijuk.server.introduce.service; | ||
|
||
public class IntroduceService { | ||
} |
Oops, something went wrong.