-
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 #1 from potenday-project/develop
develop -> master merge
- Loading branch information
Showing
25 changed files
with
632 additions
and
9 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
63 changes: 63 additions & 0 deletions
63
src/main/generated/com/chwipoClova/resume/entity/QResume.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,63 @@ | ||
package com.chwipoClova.resume.entity; | ||
|
||
import static com.querydsl.core.types.PathMetadataFactory.*; | ||
|
||
import com.querydsl.core.types.dsl.*; | ||
|
||
import com.querydsl.core.types.PathMetadata; | ||
import javax.annotation.processing.Generated; | ||
import com.querydsl.core.types.Path; | ||
import com.querydsl.core.types.dsl.PathInits; | ||
|
||
|
||
/** | ||
* QResume is a Querydsl query type for Resume | ||
*/ | ||
@Generated("com.querydsl.codegen.DefaultEntitySerializer") | ||
public class QResume extends EntityPathBase<Resume> { | ||
|
||
private static final long serialVersionUID = -1144291881L; | ||
|
||
private static final PathInits INITS = PathInits.DIRECT2; | ||
|
||
public static final QResume resume = new QResume("resume"); | ||
|
||
public final StringPath fileName = createString("fileName"); | ||
|
||
public final StringPath filePath = createString("filePath"); | ||
|
||
public final NumberPath<Long> fileSize = createNumber("fileSize", Long.class); | ||
|
||
public final StringPath orginalFileName = createString("orginalFileName"); | ||
|
||
public final DateTimePath<java.util.Date> regDate = createDateTime("regDate", java.util.Date.class); | ||
|
||
public final NumberPath<Long> resumeId = createNumber("resumeId", Long.class); | ||
|
||
public final StringPath summary = createString("summary"); | ||
|
||
public final com.chwipoClova.user.entity.QUser user; | ||
|
||
public QResume(String variable) { | ||
this(Resume.class, forVariable(variable), INITS); | ||
} | ||
|
||
public QResume(Path<? extends Resume> path) { | ||
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); | ||
} | ||
|
||
public QResume(PathMetadata metadata) { | ||
this(metadata, PathInits.getFor(metadata, INITS)); | ||
} | ||
|
||
public QResume(PathMetadata metadata, PathInits inits) { | ||
this(Resume.class, metadata, inits); | ||
} | ||
|
||
public QResume(Class<? extends Resume> type, PathMetadata metadata, PathInits inits) { | ||
super(type, metadata, inits); | ||
this.user = inits.isInitialized("user") ? new com.chwipoClova.user.entity.QUser(forProperty("user")) : null; | ||
} | ||
|
||
} | ||
|
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
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 |
---|---|---|
|
@@ -12,4 +12,5 @@ public RestTemplate restTemplate() { | |
return new RestTemplate(); | ||
} | ||
|
||
|
||
} |
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
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
70 changes: 70 additions & 0 deletions
70
src/main/java/com/chwipoClova/resume/controller/ResumeController.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 |
---|---|---|
@@ -1,4 +1,74 @@ | ||
package com.chwipoClova.resume.controller; | ||
|
||
import com.chwipoClova.common.response.CommonResponse; | ||
import com.chwipoClova.resume.request.ResumeDeleteOldReq; | ||
import com.chwipoClova.resume.request.ResumeDeleteReq; | ||
import com.chwipoClova.resume.response.ResumeListRes; | ||
import com.chwipoClova.resume.response.ResumeUploadRes; | ||
import com.chwipoClova.resume.service.ResumeService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
import org.springframework.web.service.annotation.DeleteExchange; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequiredArgsConstructor | ||
@Tag(name = "Resume", description = "이력서 API") | ||
@RequestMapping("resume") | ||
public class ResumeController { | ||
|
||
private final ResumeService resumeService; | ||
|
||
@Operation(summary = "이력서 업로드", description = "이력서 업로드") | ||
@PostMapping(path = "/resumeUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "OK") | ||
} | ||
) | ||
public ResumeUploadRes resumeUpload( | ||
@Schema(description = "userId", example = "1", name = "userId") | ||
@RequestParam(value = "userId") Long userId, | ||
@RequestPart(value = "file") MultipartFile file | ||
) throws Exception { | ||
return resumeService.resumeUpload(userId, file); | ||
} | ||
|
||
@Operation(summary = "이력서 조회", description = "이력서 조회") | ||
@GetMapping(path = "/getResumeList") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "OK") | ||
} | ||
) | ||
public List<ResumeListRes> getResumeList(@Schema(description = "userId", example = "1", name = "userId") @RequestParam(name = "userId") Long userId) { | ||
return resumeService.selectResumeList(userId); | ||
} | ||
|
||
@Operation(summary = "이력서 삭제", description = "이력서 삭제") | ||
@DeleteMapping(path = "/deleteResume") | ||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class)))} | ||
) | ||
public CommonResponse deleteResume(@RequestBody ResumeDeleteReq resumeDeleteReq) { | ||
return resumeService.deleteResume(resumeDeleteReq); | ||
} | ||
|
||
|
||
@Operation(summary = "오래된 이력서 삭제", description = "오래된 이력서 삭제") | ||
@DeleteMapping(path = "/deleteOldResume") | ||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class)))} | ||
) | ||
public CommonResponse deleteOldResume(@RequestBody ResumeDeleteOldReq resumeDeleteOldReq) { | ||
return resumeService.deleteOldResume(resumeDeleteOldReq); | ||
} | ||
|
||
} |
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,65 @@ | ||
package com.chwipoClova.resume.entity; | ||
|
||
import com.chwipoClova.user.entity.User; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.hibernate.annotations.DynamicInsert; | ||
|
||
import java.util.Date; | ||
|
||
@Entity(name = "Resume") | ||
@Table(name = "Resume") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonIgnoreProperties() | ||
@DynamicInsert | ||
@Builder | ||
@Getter | ||
@ToString | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Schema(description = "이력서 정보 VO") | ||
public class Resume { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "resumeId") | ||
@Schema(description = "이력서ID") | ||
private Long resumeId; | ||
|
||
@Column(name = "fileName") | ||
@Schema(description = "파일이름") | ||
private String fileName; | ||
|
||
@Column(name = "filePath") | ||
@Schema(description = "파일경로") | ||
private String filePath; | ||
|
||
@Column(name = "fileSize") | ||
@Schema(description = "파일크기") | ||
private Long fileSize; | ||
|
||
@Column(name = "orginalFileName") | ||
@Schema(description = "원본파일이름") | ||
private String orginalFileName; | ||
|
||
@Column(name = "summary") | ||
@Schema(description = "요약") | ||
private String summary; | ||
|
||
@Column(name = "regDate") | ||
@Schema(description = "등록일") | ||
private Date regDate; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "userId") | ||
private User user; | ||
|
||
// @PrePersist 메서드 정의 (최초 등록시 호출) | ||
@PrePersist | ||
public void prePersist() { | ||
this.regDate = new Date(); // 현재 날짜와 시간으로 등록일 설정 | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/chwipoClova/resume/repository/ResumeRepository.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 com.chwipoClova.resume.repository; | ||
|
||
import com.chwipoClova.resume.entity.Resume; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface ResumeRepository extends JpaRepository<Resume, Long> { | ||
|
||
List<Resume> findByUserUserIdOrderByRegDate(Long userId); | ||
|
||
Optional<Resume> findByUserUserIdAndResumeId(Long userId, Long resumeId); | ||
|
||
Optional<Resume> findTop1ByUserUserIdOrderByRegDate(Long userId); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/chwipoClova/resume/request/ResumeDeleteOldReq.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,11 @@ | ||
package com.chwipoClova.resume.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class ResumeDeleteOldReq { | ||
|
||
@Schema(description = "유저 ID", example = "1", name = "userId") | ||
private Long userId; | ||
} |
Oops, something went wrong.