diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/CompanyWebAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/CompanyWebAdapter.java index 2c38e2483..9709dda90 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/CompanyWebAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/CompanyWebAdapter.java @@ -2,6 +2,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -38,8 +39,10 @@ import team.retum.jobis.domain.company.usecase.UpdateMouUseCase; import javax.validation.Valid; +import javax.validation.constraints.Positive; @RequiredArgsConstructor +@Validated @RequestMapping("/companies") @RestController public class CompanyWebAdapter { @@ -78,7 +81,7 @@ public void updateDetails( @GetMapping("/student") public StudentQueryCompaniesResponse studentQueryCompanies( - @RequestParam(value = "page", required = false, defaultValue = "1") Long page, + @RequestParam(value = "page", required = false, defaultValue = "1") @Positive Long page, @RequestParam(value = "name", required = false) String name ) { return studentQueryCompaniesUseCase.execute(page - 1, name); @@ -112,7 +115,7 @@ public TeacherQueryEmployCompaniesResponse queryEmployCompanies( @RequestParam(value = "company_name", required = false) String companyName, @RequestParam(value = "company_type", required = false) CompanyType type, @RequestParam(value = "year", required = false) Integer year, - @RequestParam(value = "page", defaultValue = "1") Long page + @RequestParam(value = "page", defaultValue = "1") @Positive Long page ) { return teacherQueryEmployCompaniesUseCase.execute(companyName, type, year, page - 1); } @@ -132,7 +135,7 @@ public TeacherQueryCompaniesResponse queryCompanies( @RequestParam(value = "name", required = false) String companyName, @RequestParam(value = "region", required = false) String region, @RequestParam(value = "business_area", required = false) Long businessArea, - @RequestParam(value = "page", defaultValue = "1") Long page + @RequestParam(value = "page", defaultValue = "1") @Positive Long page ) { return teacherQueryCompaniesUseCase.execute(type, companyName, region, businessArea, page - 1); } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java index acb4090fe..98e9427de 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.HttpStatus; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; @@ -36,10 +37,12 @@ import team.retum.jobis.domain.recruitment.usecase.UpdateRecruitmentUseCase; import javax.validation.Valid; +import javax.validation.constraints.Positive; import java.time.LocalDate; import java.util.List; @RestController +@Validated @RequiredArgsConstructor @RequestMapping("/recruitments") public class RecruitmentWebAdapter { @@ -92,7 +95,7 @@ public void createRecruitArea( @GetMapping("/student") public StudentQueryRecruitmentsResponse studentQueryRecruitments( @RequestParam(value = "name", required = false) String companyName, - @RequestParam(value = "page", required = false, defaultValue = "1") Long page, + @RequestParam(value = "page", required = false, defaultValue = "1") @Positive Long page, @RequestParam(value = "job_code", required = false) Long jobCode, @RequestParam(value = "tech_code", required = false) String techCode ) { @@ -117,7 +120,7 @@ public TeacherQueryRecruitmentsResponse queryRecruitmentList( @RequestParam(value = "end", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate end, @RequestParam(value = "status", required = false) RecruitStatus status, @RequestParam(value = "year", required = false) Integer year, - @RequestParam(value = "page", defaultValue = "1") Long page + @RequestParam(value = "page", defaultValue = "1") @Positive Long page ) { return teacherQueryRecruitmentsUseCase.execute(companyName, start, end, year, status, page - 1); }