Skip to content

Commit

Permalink
Merge pull request #116 from IDEA-CAMPUS/develop
Browse files Browse the repository at this point in the history
release 2.4.7
  • Loading branch information
jisujeong0 authored Jan 15, 2024
2 parents 9b91248 + 5645f3a commit 1ef6cb4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,15 @@ public Page<ProjectRes> getAllProjects(int page, int size, String sortBy) {
return new PageImpl<>(projectResList, pageable, projectPosts.getTotalElements());
}

public Page<ProjectRes> getProjectsByKeyword(int page, int size, String sortBy, ProjectKeywordReq projectKeywordReq) {
public Page<ProjectRes> getProjectsByKeyword(int page, int size, String sortBy,
boolean booleanWeb, boolean booleanApp, boolean booleanAi) {
Pageable pageable;
if (sortBy.equals("hits")) {
pageable = PageRequest.of(page, size, Sort.by("hits").descending());
} else {
pageable = PageRequest.of(page, size, Sort.by("createdAt").descending());
}

boolean booleanWeb = projectKeywordReq.isBooleanWeb();
boolean booleanApp = projectKeywordReq.isBooleanApp();
boolean booleanAi = projectKeywordReq.isBooleanAi();

Page<ProjectPost> projectPosts = projectPostRepository
.findByBooleanWebAndBooleanAppAndBooleanAi(booleanWeb, booleanApp, booleanAi, pageable);
List<ProjectRes> projectResList = projectPosts.getContent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ public ResponseEntity<?> getProjectsByKeyword(@Parameter(description = "정렬:
@RequestParam(defaultValue = "createdAt") String sortBy,
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "12") int size,
@RequestBody ProjectKeywordReq projectKeywordReq) {
Page<ProjectRes> projectRes = projectPostService.getProjectsByKeyword(page, size, sortBy, projectKeywordReq);
@RequestParam(defaultValue = "false") boolean booleanWeb,
@RequestParam(defaultValue = "false") boolean booleanApp,
@RequestParam(defaultValue = "false") boolean booleanAi) {
Page<ProjectRes> projectRes = projectPostService.getProjectsByKeyword(page, size, sortBy, booleanWeb, booleanApp, booleanAi);
if (projectRes.isEmpty()) {
return ResponseEntity.noContent().build();
}
Expand All @@ -96,8 +98,8 @@ public ResponseEntity<?> getProjectDetail(@PathVariable("project-id") Long proje
return ResponseEntity.ok(apiResponse);
}

@Operation(summary = "프로젝트 수정", description = "프로젝트 게시글 한 건을 삭제하는 API입니다.")
@PutMapping("/{project-id}")
@Operation(summary = "프로젝트 수정", description = "프로젝트 게시글 한 건을 수정하는 API입니다.")
@PutMapping(path = "/{project-id}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<?> updateProject(@CurrentUser UserPrincipal userPrincipal,
@PathVariable("project-id") Long projectId,
@Valid @ModelAttribute PostProjectReq updateProjectReq) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package depth.main.ideac.global.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.support.StandardServletMultipartResolver;

@Configuration
public class MultipartConfig {

@Bean
public StandardServletMultipartResolver multipartResolver() {
StandardServletMultipartResolver resolver = new StandardServletMultipartResolver();
//설정 추가 필요 시 이 곳에 추가
return resolver;
}
}

0 comments on commit 1ef6cb4

Please sign in to comment.