Skip to content

Commit

Permalink
Merge pull request #130 from kakao-tech-campus-2nd-step3/Develop
Browse files Browse the repository at this point in the history
[Master] Swagger ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ถฉ๋Œ ํ•ด๊ฒฐ ๋ฐ ์„ค์ • ๋ณ€๊ฒฝ
  • Loading branch information
minsu-cnu authored Nov 10, 2024
2 parents 6561e87 + a8369d8 commit 1dfe252
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 65 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dependencies {
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.6'
runtimeOnly 'com.h2database:h2'
implementation 'jakarta.validation:jakarta.validation-api:3.0.2'
implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation group: 'com.itextpdf', name: 'itextpdf', version: '5.5.13.2'
implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: '2.0.13'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-11-08T17:16:00+0900",
date = "2024-11-10T20:46:08+0900",
comments = "version: 1.5.3.Final, compiler: javac, environment: Java 21.0.3 (Eclipse Adoptium)"
)
@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-11-08T17:16:00+0900",
date = "2024-11-10T20:46:08+0900",
comments = "version: 1.5.3.Final, compiler: javac, environment: Java 21.0.3 (Eclipse Adoptium)"
)
@Component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package team18.team18_be.apply.dto.response;

public record MandatoryResponse(boolean resumeExistence, boolean visaExistence,
boolean foreignerIdNumberExistence,boolean signExistence) {
boolean foreignerIdNumberExistence, boolean signExistence) {

}
10 changes: 4 additions & 6 deletions src/main/java/team18/team18_be/apply/service/ApplyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
import team18.team18_be.apply.ApplyStatusEnum.ApplyStatus;
Expand All @@ -21,8 +20,6 @@
import team18.team18_be.resume.entity.Resume;
import team18.team18_be.resume.repository.ResumeRepository;
import team18.team18_be.userInformation.entity.Company;
import team18.team18_be.userInformation.entity.ForeignerInformation;
import team18.team18_be.userInformation.entity.Sign;
import team18.team18_be.userInformation.repository.CompanyRepository;
import team18.team18_be.userInformation.repository.ForeignerInformationRepository;
import team18.team18_be.userInformation.repository.SignRepository;
Expand All @@ -42,14 +39,15 @@ public class ApplyService {
public ApplyService(ApplicationFormRepository applicationFormRepository,
ApplyRepository applyRepository, RecruitmentRepository recruitmentRepository,
ResumeRepository resumeRepository, CompanyRepository companyRepository,
ForeignerInformationRepository foreignerInformationRepository,SignRepository signRepository) {
ForeignerInformationRepository foreignerInformationRepository,
SignRepository signRepository) {
this.applicationFormRepository = applicationFormRepository;
this.applyRepository = applyRepository;
this.recruitmentRepository = recruitmentRepository;
this.resumeRepository = resumeRepository;
this.companyRepository = companyRepository;
this.foreignerInformationRepository = foreignerInformationRepository;
this.signRepository=signRepository;
this.signRepository = signRepository;
}

public Long createApplicationForm(ApplicationFormRequest applicationFormRequest,
Expand Down Expand Up @@ -127,7 +125,7 @@ public MandatoryResponse checkMandatory(User user) {
boolean signExistence = signRepository.findByUser(user).isPresent();

MandatoryResponse mandatoryResponse = new MandatoryResponse(resumeExistence, visaExistence,
foreignerIdNumberExistence,signExistence);
foreignerIdNumberExistence, signExistence);
return mandatoryResponse;
}

Expand Down
39 changes: 0 additions & 39 deletions src/main/java/team18/team18_be/config/swagger/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.parameters.HeaderParameter;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.security.SecurityScheme.In;
import io.swagger.v3.oas.models.security.SecurityScheme.Type;
import java.util.Set;
import org.springdoc.core.customizers.OpenApiCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -38,38 +33,4 @@ public OpenAPI api() {
.components(new Components().addSecuritySchemes("Bearer Token", apiKey))
.addSecurityItem(securityRequirement);
}

@Bean
public OpenApiCustomizer customAuthParameter() {
Set<String> targetPaths = Set.of(
"/api/register"
);

return openApi -> openApi
.getPaths()
.forEach((path, pathItem) -> {
boolean isTargetPath = false;
for (String targetPath : targetPaths) {
if (path.startsWith(targetPath)) {
isTargetPath = true;
break;
}
}

if (isTargetPath) {
pathItem.readOperations().forEach(
this::addAuthParam
);
}
});
}

private void addAuthParam(Operation operation) {
operation.addParametersItem(new HeaderParameter()
.name("Authorization")
.description("์•ก์„ธ์Šค ํ† ํฐ")
.required(true)
.schema(new StringSchema()));
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package team18.team18_be.recruitment.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
Expand All @@ -23,7 +23,7 @@
import team18.team18_be.recruitment.dto.response.RecruitmentSummationResponse;
import team18.team18_be.recruitment.service.RecruitmentService;

@Api(tags = {"๊ตฌ์ธ๊ธ€ ๊ด€๋ จ Controller"})
@Tag(name = "๊ตฌ์ธ๊ธ€ ๊ด€๋ จ Controller")
@RestController
@RequestMapping("/api/recruitments")
public class RecruitmentController {
Expand All @@ -34,7 +34,7 @@ public RecruitmentController(RecruitmentService recruitmentService) {
this.recruitmentService = recruitmentService;
}

@ApiOperation(value = "๊ตฌ์ธ๊ธ€ ์ €์žฅ ๋ฉ”์„œ๋“œ")
@Operation(summary = "๊ตฌ์ธ๊ธ€ ์ €์žฅ ๋ฉ”์„œ๋“œ")
@PostMapping
public ResponseEntity<Void> saveRecruitment(
@RequestBody RecruitmentRequest recruitmentRequest,
Expand All @@ -44,7 +44,7 @@ public ResponseEntity<Void> saveRecruitment(
return ResponseEntity.status(HttpStatus.CREATED).build();
}

@ApiOperation(value = "๊ตฌ์ธ๊ธ€ ์ „์ฒด ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@Operation(summary = "๊ตฌ์ธ๊ธ€ ์ „์ฒด ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@GetMapping
public ResponseEntity<List<RecruitmentSummationResponse>> getAllRecruitments(
@RequestParam int page
Expand All @@ -54,7 +54,7 @@ public ResponseEntity<List<RecruitmentSummationResponse>> getAllRecruitments(
return ResponseEntity.ok().body(recruitmentService.getAllRecruitment(pageable));
}

@ApiOperation(value = "๊ตฌ์ธ๊ธ€id๋กœ ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@Operation(summary = "๊ตฌ์ธ๊ธ€id๋กœ ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@GetMapping("/{postId}")
public ResponseEntity<RecruitmentResponse> getRecruitments(
@PathVariable Long postId
Expand All @@ -63,7 +63,7 @@ public ResponseEntity<RecruitmentResponse> getRecruitments(
.body(recruitmentService.getRecruitmentResponseByRecruitmentId(postId));
}

@ApiOperation(value = "ํšŒ์‚ฌ ๋ณ„ ๊ตฌ์ธ๊ธ€ ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@Operation(summary = "ํšŒ์‚ฌ ๋ณ„ ๊ตฌ์ธ๊ธ€ ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@GetMapping("/company/{companyId}")
public ResponseEntity<List<RecruitmentResponseForCompany>> getAllRecruitmentByCompanyId(
@PathVariable Long companyId
Expand All @@ -72,7 +72,7 @@ public ResponseEntity<List<RecruitmentResponseForCompany>> getAllRecruitmentByCo
.body(recruitmentService.getRecruitmentResponseByCompanyId(companyId));
}

@ApiOperation(value = "๊ตฌ์ธ๊ธ€ ๋งˆ๊ฐ ๋ฉ”์„œ๋“œ")
@Operation(summary = "๊ตฌ์ธ๊ธ€ ๋งˆ๊ฐ ๋ฉ”์„œ๋“œ")
@GetMapping("/hiringClose/{recruitmentId}")
public ResponseEntity<Void> setRecruitmentHiringFalse(
@PathVariable Long recruitmentId
Expand All @@ -81,7 +81,7 @@ public ResponseEntity<Void> setRecruitmentHiringFalse(
return ResponseEntity.ok().build();
}

@ApiOperation(value = "์ตœ๊ทผ ์˜ฌ๋ผ์˜จ ๊ตฌ์ธ๊ธ€ ์ˆœ์„œ๋Œ€๋กœ ์ •๋ ฌ")
@Operation(summary = "์ตœ๊ทผ ์˜ฌ๋ผ์˜จ ๊ตฌ์ธ๊ธ€ ์ˆœ์„œ๋Œ€๋กœ ์ •๋ ฌ")
@GetMapping("/latestRegistration")
public ResponseEntity<List<RecruitmentSummationResponse>> getAllRecruitmentsLatestRegistration(
@RequestParam int page
Expand All @@ -91,7 +91,7 @@ public ResponseEntity<List<RecruitmentSummationResponse>> getAllRecruitmentsLate
return ResponseEntity.ok().body(recruitmentService.getAllRecruitmentAndSortByDate(pageable));
}

@ApiOperation(value = "๊ธ‰์—ฌ ๋†’์€ ์ˆœ์„œ๋Œ€๋กœ ์ •๋ฆฌํ•ด์„œ ์ „์ฒด ๊ตฌ์ธ๊ธ€ ๋ฐ˜ํ™˜ํ•˜๋Š” ๋ฉ”์„œ๋“œ")
@Operation(summary = "๊ธ‰์—ฌ ๋†’์€ ์ˆœ์„œ๋Œ€๋กœ ์ •๋ฆฌํ•ด์„œ ์ „์ฒด ๊ตฌ์ธ๊ธ€ ๋ฐ˜ํ™˜ํ•˜๋Š” ๋ฉ”์„œ๋“œ")
@GetMapping("/salary")
public ResponseEntity<List<RecruitmentSummationResponse>> getAllRecruitmentsSalary(
@RequestParam int page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package team18.team18_be.recruitment.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
Expand All @@ -13,8 +14,10 @@ public class RecruitmentContent {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long resumeContentId;
@Lob
@Column(columnDefinition = "TEXT")
private String koreanDetailedDescription;
@Lob
@Column(columnDefinition = "TEXT")
private String vietnameseDetailedDescription;

public RecruitmentContent(String koreanDetailedDescription,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package team18.team18_be.resume.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -17,7 +17,7 @@
import team18.team18_be.resume.dto.response.ResumeResponse;
import team18.team18_be.resume.service.ResumeService;

@Api(tags = {"์ด๋ ฅ์„œ ๊ด€๋ จ Controller"})
@Tag(name = "์ด๋ ฅ์„œ ๊ด€๋ จ Controller")
@RestController
@RequestMapping("/api/resumes")
public class ResumeController {
Expand All @@ -28,7 +28,7 @@ public ResumeController(ResumeService resumeService) {
this.resumeService = resumeService;
}

@ApiOperation(value = "์ด๋ ฅ์„œ ์ €์žฅ ๋ฉ”์„œ๋“œ")
@Operation(summary = "์ด๋ ฅ์„œ ์ €์žฅ ๋ฉ”์„œ๋“œ")
@PostMapping
public ResponseEntity<Void> saveResume(
@RequestBody ResumeRequest resumeRequest,
Expand All @@ -38,15 +38,15 @@ public ResponseEntity<Void> saveResume(
return new ResponseEntity<>(HttpStatus.CREATED);
}

@ApiOperation(value = "๊ตฌ์ง์ž ๋ณ„ ์ด๋ ฅ์„œ ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@Operation(summary = "๊ตฌ์ง์ž ๋ณ„ ์ด๋ ฅ์„œ ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@GetMapping
public ResponseEntity<ResumeResponse> getResume(
@LoginUser User user
) {
return ResponseEntity.ok().body(resumeService.findResumeByEmployee(user));
}

@ApiOperation(value = "์ด๋ ฅ์„œ id๋กœ ์ด๋ ฅ์„œ ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@Operation(summary = "์ด๋ ฅ์„œ id๋กœ ์ด๋ ฅ์„œ ์กฐํšŒ ๋ฉ”์„œ๋“œ")
@GetMapping("/{resumeId}/{applyId}")
public ResponseEntity<ResumeAndApplyResponse> getResumeById(
@PathVariable Long resumeId,
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/team18/team18_be/resume/entity/Resume.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package team18.team18_be.resume.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
Expand All @@ -25,6 +26,7 @@ public class Resume {
private String career;
private String korean;
@Lob
@Column(columnDefinition = "TEXT")
private String selfIntroduction;

@ManyToOne
Expand Down

0 comments on commit 1dfe252

Please sign in to comment.