Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 1 addition & 4 deletions app-main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ spotless {
target '**/*.java'

// 네이버 자바 컨벤션 적용
importOrder() // import 순서 정리
importOrder("java","javax","org","net","com","") // import 순서 정리
removeUnusedImports()

// 네이버 코딩 컨벤션 XML 파일 사용
eclipse().configFile('naver-eclipse-formatter.xml')

trimTrailingWhitespace()
endWithNewline()
}
}

Expand Down
101 changes: 52 additions & 49 deletions app-main/src/main/java/net/causw/app/main/api/BoardController.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import net.causw.app.main.domain.user.auth.userdetails.CustomUserDetails;
import net.causw.app.main.domain.community.board.service.BoardService;
import net.causw.app.main.api.dto.board.BoardAppliesResponseDto;
import net.causw.app.main.api.dto.board.BoardApplyRequestDto;
import net.causw.app.main.api.dto.board.BoardApplyResponseDto;
Expand All @@ -28,6 +26,8 @@
import net.causw.app.main.api.dto.board.BoardResponseDto;
import net.causw.app.main.api.dto.board.BoardSubscribeResponseDto;
import net.causw.app.main.api.dto.board.BoardUpdateRequestDto;
import net.causw.app.main.domain.community.board.service.BoardService;
import net.causw.app.main.domain.user.auth.userdetails.CustomUserDetails;
import net.causw.global.exception.BadRequestException;
import net.causw.global.exception.InternalServerException;
import net.causw.global.exception.UnauthorizedException;
Expand All @@ -48,8 +48,7 @@ public class BoardController {

@GetMapping
@ResponseStatus(value = HttpStatus.OK)
@Operation(summary = "게시판 검색 API(완료)"
, description = "전체 게시판을 불러오는 api로 관리자 권한을 가진 경우 삭제된 게시판도 확인할 수 있습니다. <br>" +
@Operation(summary = "게시판 검색 API(완료)", description = "전체 게시판을 불러오는 api로 관리자 권한을 가진 경우 삭제된 게시판도 확인할 수 있습니다. <br>" +
"학적이 GRADUATED인 졸업생이 접근할 경우 크자회에게 제공되는 (isAlumni가 true) 게시판만 조회됩니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "4000", description = "로그인된 사용자를 찾을 수 없습니다.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
Expand All @@ -60,15 +59,14 @@ public class BoardController {
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
})
public List<BoardResponseDto> findAllBoard(
@AuthenticationPrincipal CustomUserDetails userDetails
) {
@AuthenticationPrincipal
CustomUserDetails userDetails) {
return this.boardService.findAllBoard(userDetails.getUser());
}

@GetMapping("/main")
@ResponseStatus(value = HttpStatus.OK)
@Operation(summary = "게시판 검색 API(완료)"
, description = "전체 게시판을 불러오는 api로 관리자 권한을 가진 경우 삭제된 게시판도 확인할 수 있습니다. <br>"
@Operation(summary = "게시판 검색 API(완료)", description = "전체 게시판을 불러오는 api로 관리자 권한을 가진 경우 삭제된 게시판도 확인할 수 있습니다. <br>"
+ "학적이 GRADUATED인 졸업생이 접근할 경우 크자회에게 제공되는 (isAlumni가 true) 게시판만 조회됩니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "4000", description = "로그인된 사용자를 찾을 수 없습니다.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
Expand All @@ -79,8 +77,8 @@ public List<BoardResponseDto> findAllBoard(
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
})
public List<BoardMainResponseDto> mainBoard(
@AuthenticationPrincipal CustomUserDetails userDetails
) {
@AuthenticationPrincipal
CustomUserDetails userDetails) {
return this.boardService.mainBoard(userDetails.getUser());
}

Expand All @@ -92,8 +90,8 @@ public List<BoardMainResponseDto> mainBoard(
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
})
public BoardNameCheckResponseDto checkBoardName(
@RequestBody @Valid BoardNameCheckRequestDto boardNameCheckRequestDto
) {
@RequestBody @Valid
BoardNameCheckRequestDto boardNameCheckRequestDto) {
return this.boardService.checkBoardName(boardNameCheckRequestDto);
}

Expand All @@ -109,9 +107,10 @@ public BoardNameCheckResponseDto checkBoardName(
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
})
public void applyBoard(
@RequestBody @Valid BoardApplyRequestDto boardApplyRequestDto,
@AuthenticationPrincipal CustomUserDetails userDetails
) {
@RequestBody @Valid
BoardApplyRequestDto boardApplyRequestDto,
@AuthenticationPrincipal
CustomUserDetails userDetails) {
this.boardService.applyBoard(userDetails.getUser(), boardApplyRequestDto);
}

Expand All @@ -128,9 +127,10 @@ public void applyBoard(
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
})
public BoardResponseDto createBoard(
@Valid @RequestBody BoardCreateRequestDto boardCreateRequestDto,
@AuthenticationPrincipal CustomUserDetails userDetails
) {
@Valid @RequestBody
BoardCreateRequestDto boardCreateRequestDto,
@AuthenticationPrincipal
CustomUserDetails userDetails) {
return this.boardService.createNoticeBoard(userDetails.getUser(), boardCreateRequestDto);
}

Expand Down Expand Up @@ -163,8 +163,8 @@ public List<BoardAppliesResponseDto> findAllBoardApply() {
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
})
public BoardApplyResponseDto findBoardApplyById(
@PathVariable("id") String id
) {
@PathVariable("id")
String id) {
return this.boardService.findBoardApplyByApplyId(id);
}

Expand All @@ -182,8 +182,8 @@ public BoardApplyResponseDto findBoardApplyById(
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
})
public BoardApplyResponseDto acceptApply(
@PathVariable("applyId") String applyId
) {
@PathVariable("applyId")
String applyId) {
return this.boardService.accept(applyId);
}

Expand All @@ -202,8 +202,8 @@ public BoardApplyResponseDto acceptApply(
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
})
public BoardApplyResponseDto rejectApply(
@PathVariable("applyId") String applyId
) {
@PathVariable("applyId")
String applyId) {
return this.boardService.reject(applyId);
}

Expand All @@ -224,10 +224,12 @@ public BoardApplyResponseDto rejectApply(
@ApiResponse(responseCode = "5001", description = "Board id checked, but exception occurred", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InternalServerException.class)))
})
public BoardResponseDto updateBoard(
@PathVariable("id") String id,
@Valid @RequestBody BoardUpdateRequestDto boardUpdateRequestDto,
@AuthenticationPrincipal CustomUserDetails userDetails
) {
@PathVariable("id")
String id,
@Valid @RequestBody
BoardUpdateRequestDto boardUpdateRequestDto,
@AuthenticationPrincipal
CustomUserDetails userDetails) {
return this.boardService.updateBoard(userDetails.getUser(), id, boardUpdateRequestDto);
}

Expand All @@ -247,9 +249,10 @@ public BoardResponseDto updateBoard(
@ApiResponse(responseCode = "5000", description = "Board id checked, but exception occurred", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InternalServerException.class)))
})
public BoardResponseDto deleteBoard(
@PathVariable("id") String id,
@AuthenticationPrincipal CustomUserDetails userDetails
) {
@PathVariable("id")
String id,
@AuthenticationPrincipal
CustomUserDetails userDetails) {

return this.boardService.deleteBoard(userDetails.getUser(), id);
}
Expand All @@ -270,43 +273,43 @@ public BoardResponseDto deleteBoard(
@ApiResponse(responseCode = "5000", description = "Board id checked, but exception occurred", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InternalServerException.class)))
})
public BoardResponseDto restoreBoard(
@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable("id") String id
) {
@AuthenticationPrincipal
CustomUserDetails userDetails,
@PathVariable("id")
String id) {
return this.boardService.restoreBoard(userDetails.getUser(), id);
}

@PostMapping("/subscribe/{id}")
@ResponseStatus(HttpStatus.OK)
@Operation(summary = "로그인한 사용자의 게시판 알람 설정 켜기"
, description = "id에는 board id 값을 넣어주세요")
@Operation(summary = "로그인한 사용자의 게시판 알람 설정 켜기", description = "id에는 board id 값을 넣어주세요")
public BoardSubscribeResponseDto subscribeBoard(
@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable("id") String id
) {
@AuthenticationPrincipal
CustomUserDetails userDetails,
@PathVariable("id")
String id) {
return boardService.setBoardSubscribe(userDetails.getUser(), id, true);
}

@DeleteMapping("/subscribe/{id}")
@ResponseStatus(HttpStatus.OK)
@Operation(summary = "로그인한 사용자의 게시판 알람 설정 끄기"
, description = "id에는 board id 값을 넣어주세요")
@Operation(summary = "로그인한 사용자의 게시판 알람 설정 끄기", description = "id에는 board id 값을 넣어주세요")
public BoardSubscribeResponseDto unsubscribeBoard(
@AuthenticationPrincipal CustomUserDetails userDetails,
@PathVariable("id") String id
) {
@AuthenticationPrincipal
CustomUserDetails userDetails,
@PathVariable("id")
String id) {
return boardService.setBoardSubscribe(userDetails.getUser(), id, false);
}

@PostMapping("/subscribe")
@ResponseStatus(HttpStatus.OK)
@PreAuthorize("@security.hasRoleGroup(@RoleGroup.EXECUTIVES)")
@Operation(summary = "게시판 구독 데이터 생성 API(관리자용/임시)",
description = "id에는 board id 값을 넣어주세요 <br>" +
"기존 게시판들의 구독 여부 저장을 위한 임시 api 입니다. 설정후 삭제 예정이고, 추후에는 공지게시판 생성과 동시에 구독여부도 저장될 예정입니다.")
@Operation(summary = "게시판 구독 데이터 생성 API(관리자용/임시)", description = "id에는 board id 값을 넣어주세요 <br>" +
"기존 게시판들의 구독 여부 저장을 위한 임시 api 입니다. 설정후 삭제 예정이고, 추후에는 공지게시판 생성과 동시에 구독여부도 저장될 예정입니다.")
public void createBoardSubscribe(
@RequestParam("id") String id
) {
@RequestParam("id")
String id) {
this.boardService.createBoardSubscribe(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public class CalendarController {
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
@ApiResponse(responseCode = "5000", description = "User id checked, but exception occurred", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
})
public CalendarsResponseDto findCalendars(@RequestParam("year") Integer year) {
public CalendarsResponseDto findCalendars(@RequestParam("year")
Integer year) {
return calendarService.findCalendarByYear(year);
}

Expand All @@ -59,7 +60,8 @@ public CalendarsResponseDto findCalendars(@RequestParam("year") Integer year) {
@ApiResponse(responseCode = "4012", description = "접근 권한이 없습니다. 다시 로그인 해주세요. 문제 반복시 관리자에게 문의해주세요.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class))),
@ApiResponse(responseCode = "5000", description = "User id checked, but exception occurred", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
})
public CalendarResponseDto findCalendars(@PathVariable("calendarId") String calendarId) {
public CalendarResponseDto findCalendars(@PathVariable("calendarId")
String calendarId) {
return calendarService.findCalendar(calendarId);
}

Expand Down Expand Up @@ -88,9 +90,10 @@ public CalendarResponseDto findHomeCalendar() {
@ApiResponse(responseCode = "5000", description = "User id checked, but exception occurred", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
})
public CalendarResponseDto createCalendar(
@RequestPart(value = "calendarCreateRequestDto") @Valid CalendarCreateRequestDto calendarCreateRequestDto,
@RequestPart(value = "image") MultipartFile image
) {
@RequestPart(value = "calendarCreateRequestDto") @Valid
CalendarCreateRequestDto calendarCreateRequestDto,
@RequestPart(value = "image")
MultipartFile image) {
return calendarService.createCalendar(calendarCreateRequestDto, image);
}

Expand All @@ -105,10 +108,12 @@ public CalendarResponseDto createCalendar(
@ApiResponse(responseCode = "5000", description = "User id checked, but exception occurred", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
})
public CalendarResponseDto updateCalendar(
@PathVariable("calendarId") String calendarId,
@RequestPart(value = "calendarUpdateRequestDto") @Valid CalendarUpdateRequestDto calendarUpdateRequestDto,
@RequestPart(value = "image") MultipartFile image
) {
@PathVariable("calendarId")
String calendarId,
@RequestPart(value = "calendarUpdateRequestDto") @Valid
CalendarUpdateRequestDto calendarUpdateRequestDto,
@RequestPart(value = "image")
MultipartFile image) {
return calendarService.updateCalendar(calendarId, calendarUpdateRequestDto, image);
}

Expand All @@ -123,8 +128,8 @@ public CalendarResponseDto updateCalendar(
@ApiResponse(responseCode = "5000", description = "User id checked, but exception occurred", content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
})
public CalendarResponseDto deleteCalendar(
@PathVariable("calendarId") String calendarId
) {
@PathVariable("calendarId")
String calendarId) {
return calendarService.deleteCalendar(calendarId);
}
}
Loading
Loading