Skip to content

Commit

Permalink
Merge pull request #6 from potenday-project/develop
Browse files Browse the repository at this point in the history
면접 시작 관련 로직 추가
  • Loading branch information
HwangHoYoon authored Dec 11, 2023
2 parents 1890354 + fe284dd commit 05bba9a
Show file tree
Hide file tree
Showing 28 changed files with 980 additions and 23 deletions.
2 changes: 1 addition & 1 deletion server_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.chwipoClova.interview.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;


/**
* QInterview is a Querydsl query type for Interview
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QInterview extends EntityPathBase<Interview> {

private static final long serialVersionUID = 1729798915L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QInterview interview = new QInterview("interview");

public final NumberPath<Long> interviewId = createNumber("interviewId", Long.class);

public final DateTimePath<java.util.Date> modifyDate = createDateTime("modifyDate", java.util.Date.class);

public final StringPath recruitSummary = createString("recruitSummary");

public final DateTimePath<java.util.Date> regDate = createDateTime("regDate", java.util.Date.class);

public final StringPath resumeSummary = createString("resumeSummary");

public final StringPath title = createString("title");

public final com.chwipoClova.user.entity.QUser user;

public QInterview(String variable) {
this(Interview.class, forVariable(variable), INITS);
}

public QInterview(Path<? extends Interview> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}

public QInterview(PathMetadata metadata) {
this(metadata, PathInits.getFor(metadata, INITS));
}

public QInterview(PathMetadata metadata, PathInits inits) {
this(Interview.class, metadata, inits);
}

public QInterview(Class<? extends Interview> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.user = inits.isInitialized("user") ? new com.chwipoClova.user.entity.QUser(forProperty("user")) : null;
}

}

61 changes: 61 additions & 0 deletions src/main/generated/com/chwipoClova/qa/entity/QQa.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.chwipoClova.qa.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;


/**
* QQa is a Querydsl query type for Qa
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QQa extends EntityPathBase<Qa> {

private static final long serialVersionUID = 24461021L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QQa qa = new QQa("qa");

public final StringPath aiAnswer = createString("aiAnswer");

public final StringPath answer = createString("answer");

public final com.chwipoClova.interview.entity.QInterview interview;

public final DateTimePath<java.util.Date> modifyDate = createDateTime("modifyDate", java.util.Date.class);

public final NumberPath<Long> qaId = createNumber("qaId", Long.class);

public final StringPath question = createString("question");

public final DateTimePath<java.util.Date> regDate = createDateTime("regDate", java.util.Date.class);

public QQa(String variable) {
this(Qa.class, forVariable(variable), INITS);
}

public QQa(Path<? extends Qa> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}

public QQa(PathMetadata metadata) {
this(metadata, PathInits.getFor(metadata, INITS));
}

public QQa(PathMetadata metadata, PathInits inits) {
this(Qa.class, metadata, inits);
}

public QQa(Class<? extends Qa> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.interview = inits.isInitialized("interview") ? new com.chwipoClova.interview.entity.QInterview(forProperty("interview"), inits.get("interview")) : null;
}

}

67 changes: 67 additions & 0 deletions src/main/generated/com/chwipoClova/recruit/entity/QRecruit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.chwipoClova.recruit.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;


/**
* QRecruit is a Querydsl query type for Recruit
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QRecruit extends EntityPathBase<Recruit> {

private static final long serialVersionUID = 1252659683L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QRecruit recruit = new QRecruit("recruit");

public final StringPath content = createString("content");

public final StringPath fileName = createString("fileName");

public final StringPath filePath = createString("filePath");

public final NumberPath<Long> fileSize = createNumber("fileSize", Long.class);

public final StringPath originalFileName = createString("originalFileName");

public final NumberPath<Long> recruitId = createNumber("recruitId", Long.class);

public final DateTimePath<java.util.Date> regDate = createDateTime("regDate", java.util.Date.class);

public final StringPath summary = createString("summary");

public final StringPath title = createString("title");

public final com.chwipoClova.user.entity.QUser user;

public QRecruit(String variable) {
this(Recruit.class, forVariable(variable), INITS);
}

public QRecruit(Path<? extends Recruit> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}

public QRecruit(PathMetadata metadata) {
this(metadata, PathInits.getFor(metadata, INITS));
}

public QRecruit(PathMetadata metadata, PathInits inits) {
this(Recruit.class, metadata, inits);
}

public QRecruit(Class<? extends Recruit> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.user = inits.isInitialized("user") ? new com.chwipoClova.user.entity.QUser(forProperty("user")) : null;
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class QResume extends EntityPathBase<Resume> {

public final NumberPath<Long> fileSize = createNumber("fileSize", Long.class);

public final StringPath orginalFileName = createString("orginalFileName");
public final StringPath originalFileName = createString("originalFileName");

public final DateTimePath<java.util.Date> regDate = createDateTime("regDate", java.util.Date.class);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.chwipoClova.common.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;

import java.lang.reflect.Type;

@Component
public class MultipartJackson2HttpMessageConverter extends AbstractJackson2HttpMessageConverter {

/**
* Converter for support http request with header Content-Type: multipart/form-data
*/
public MultipartJackson2HttpMessageConverter(ObjectMapper objectMapper) {
super(objectMapper, MediaType.APPLICATION_OCTET_STREAM);
}

@Override
public boolean canWrite(Class<?> clazz, MediaType mediaType) {
return false;
}

@Override
public boolean canWrite(Type type, Class<?> clazz, MediaType mediaType) {
return false;
}

@Override
protected boolean canWrite(MediaType mediaType) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ public enum ExceptionCode {

USER_NULL("801", "유저 정보가 올바르지 않습니다."),

FILE_EXT("850", "PDF 파일 형식이 아닙니다."),
FILE_EXT_PDF("850", "PDF 파일 형식이 아닙니다."),

FILE_SIZE("851", "파일 업로드 최대 크기는 50M 입니다."),
FILE_EXT_IMAGE("851", "IMAGE 파일 형식이 아닙니다."),

RESUME_NULL("860", "이력서 정보가 올바르지 않습니다.")
FILE_SIZE("860", "파일 업로드 최대 크기는 50M 입니다."),

RESUME_NULL("870", "이력서 정보가 올바르지 않습니다."),

RECRUIT_CONTENT_NULL("880", "채용공고 정보가 올바르지 않습니다.")

;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.chwipoClova.interview.controller;

import com.chwipoClova.interview.request.InterviewInsertReq;
import com.chwipoClova.interview.response.InterviewInsertRes;
import com.chwipoClova.interview.service.InterviewService;
import com.chwipoClova.resume.response.ResumeUploadRes;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Encoding;
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;

@Slf4j
@RestController
@RequiredArgsConstructor
@Tag(name = "Interview", description = "면접 API")
@RequestMapping("interview")
public class InterviewController {

private final InterviewService interviewService;

@Operation(summary = "면접 등록", description = "면접 등록")
@PostMapping(path = "/insertInterview", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE})
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK")
}
)
public InterviewInsertRes insertInterview(
@RequestPart(value = "interviewData") InterviewInsertReq interviewInsertReq,
@RequestPart(value = "file", required = false) MultipartFile file
) throws Exception {
return interviewService.insertInterview(interviewInsertReq, file);
}

}
67 changes: 67 additions & 0 deletions src/main/java/com/chwipoClova/interview/entity/Interview.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.chwipoClova.interview.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 = "Interview")
@Table(name = "Interview")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties()
@DynamicInsert
@Builder
@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class Interview {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "interviewId")
@Schema(description = "면접ID")
private Long interviewId;

@Column(name = "title")
@Schema(description = "제목")
private String title;

@Column(name = "resumeSummary")
@Schema(description = "이력서 요약")
private String resumeSummary;

@Column(name = "recruitSummary")
@Schema(description = "채용공고 요약")
private String recruitSummary;

@Column(name = "regDate")
@Schema(description = "등록일")
private Date regDate;

@Column(name = "modifyDate")
@Schema(description = "수정일")
private Date modifyDate;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userId")
private User user;

// @PrePersist 메서드 정의 (최초 등록시 호출)
@PrePersist
public void prePersist() {
this.regDate = new Date(); // 현재 날짜와 시간으로 등록일 설정
}

// @PreUpdate 메서드 정의 (업데이트 시 호출)
@PreUpdate
public void preUpdate() {
this.modifyDate = new Date(); // 현재 날짜와 시간으로 수정일 업데이트
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.chwipoClova.interview.repository;

import com.chwipoClova.interview.entity.Interview;
import org.springframework.data.jpa.repository.JpaRepository;

public interface InterviewRepository extends JpaRepository<Interview, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.chwipoClova.interview.request;


import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
public class InterviewInsertReq {

@Schema(description = "유저 ID", example = "1", name = "userId")
private Long userId;

@Schema(description = "이력서 ID", example = "1", name = "resumeId")
private Long resumeId;

@Schema(description = "채용공고내용", example = "삼성채용", name = "recruitContent")
private String recruitContent;

}
Loading

0 comments on commit 05bba9a

Please sign in to comment.