-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#10 : 학생회 제휴/행사 게시글 작성/수정/삭제/조회 기능 구현 #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d53473c
feat/#10: 학생회 제휴 게시글 생성/수정/조회/삭제 기능 구현
jjaeroong 286901a
refactor/#10: 학생회 제휴/행사 게시글 생성 중, 이미지 presignedUrl temp 호출 후 게시글 생성 시…
jjaeroong 88a18ec
refactor/#10: 불필요한 임포트 및 미사용 파일 제거
jjaeroong 0ce0f50
refactor/#10: 게시글 생성 시, date 및 place 필드 저장 에러 수정
jjaeroong 95a182a
refactor/#10: 게시글 생성 시, presingedUrl 로직 수정
jjaeroong c88440d
refactor/#10: 게시글 생성 시, 이미지 전용 presingedUrl API 생성
jjaeroong 4644afd
refactor/#10: 게시글 생성 시, 이미지 sequence 필드 삭제 및 스웨거 API 설명 추가
jjaeroong dd47065
Merge dev into feature/#10
jjaeroong 474738e
refactor/#10: ociConfig 필요한 필드에 getter 추가
jjaeroong fe1a223
refactor/#10: 행사/제휴 게시글 날짜·시간 처리 로직 분리
jjaeroong d8ba38c
refactor/#10: builder -> mapper 전환 및 presignedUrl 파일명 수정
jjaeroong 3f950f8
refactor/#10: 사용하지 않는 import 제거
jjaeroong b4cab94
style/#10: 네이버 코드 포매터 적용
jjaeroong 9f29cb4
style/#10: 파일별 마지막 줄 개행적용
jjaeroong 9a97b17
refactor/#10: deletePost 컨트롤러 사용하지 않는 어노테이션 제거
jjaeroong dbe58c2
refactor/#10: ociConfig 수정 및 application-test 파일 추가
jjaeroong b71f9d1
refactor/#10: application-test 파일 수정
jjaeroong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.../com/campus/campus/domain/studentcouncilpost/application/dto/PostListItemResponseDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.dto; | ||
|
|
||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.PostCategory; | ||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.ThumbnailIcon; | ||
| import java.time.LocalDateTime; | ||
|
|
||
| public record PostListItemResponseDto( | ||
| Long id, | ||
| PostCategory category, | ||
| String title, | ||
| String place, | ||
| LocalDateTime endDateTime, | ||
| String thumbnailImageUrl, | ||
| ThumbnailIcon thumbnailIcon, | ||
| Boolean isWriter | ||
| ) {} | ||
1winhyun marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
39 changes: 39 additions & 0 deletions
39
...main/java/com/campus/campus/domain/studentcouncilpost/application/dto/PostRequestDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.dto; | ||
|
|
||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.PostCategory; | ||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.ThumbnailIcon; | ||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
|
|
||
| public record PostRequestDto( | ||
|
|
||
| @NotNull | ||
| PostCategory category, | ||
|
|
||
| @NotBlank | ||
| String title, | ||
|
|
||
| @NotBlank | ||
| String content, | ||
|
|
||
| String place, | ||
|
|
||
| @Schema(example = "2025-04-10T18:00") | ||
| @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm") | ||
| LocalDateTime startDateTime, | ||
|
|
||
| @Schema(example = "2025-04-30T23:59") | ||
| @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm") | ||
| LocalDateTime endDateTime, | ||
|
|
||
| // 썸네일 (둘 중 하나는 필수) | ||
| String thumbnailImageUrl, | ||
| ThumbnailIcon thumbnailIcon, | ||
|
|
||
| // 본문 이미지들 | ||
| List<String> imageUrls | ||
| ) {} | ||
|
||
36 changes: 36 additions & 0 deletions
36
...ain/java/com/campus/campus/domain/studentcouncilpost/application/dto/PostResponseDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.dto; | ||
|
|
||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.PostCategory; | ||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.ThumbnailIcon; | ||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import java.time.LocalDate; | ||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public class PostResponseDto { | ||
| private Long id; | ||
| private Long writerId; | ||
| private String writerName; | ||
| private Boolean isWriter; | ||
|
|
||
| private PostCategory category; | ||
| private String title; | ||
| private String content; | ||
|
|
||
| private String place; | ||
|
|
||
| private LocalDate startDate; | ||
| private LocalDate endDate; | ||
| private LocalDateTime startDateTime; | ||
|
|
||
|
|
||
| private String thumbnailImageUrl; | ||
| private ThumbnailIcon thumbnailIcon; | ||
|
|
||
| private List<String> images; | ||
| } |
26 changes: 26 additions & 0 deletions
26
...ain/java/com/campus/campus/domain/studentcouncilpost/application/exception/ErrorCode.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ErrorCodeInterface; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public enum ErrorCode implements ErrorCodeInterface { | ||
|
|
||
| POST_NOT_FOUND(2401, HttpStatus.NOT_FOUND, "게시글을 찾을 수 없습니다."), | ||
| NOT_POST_WRITER(2402, HttpStatus.FORBIDDEN, "작성자만 해당 작업을 수행할 수 있습니다."), | ||
| THUMBNAIL_REQUIRED(2403, HttpStatus.BAD_REQUEST, "썸네일(이미지 또는 아이콘)은 반드시 필요합니다."), | ||
|
|
||
| // EVENT 관련 | ||
| EVENT_START_DATETIME_REQUIRED(2405, HttpStatus.BAD_REQUEST, "행사는 시작 일시가 필요합니다."), | ||
| EVENT_END_DATETIME_NOT_ALLOWED(2406, HttpStatus.BAD_REQUEST, "행사는 종료 일시를 가질 수 없습니다."), | ||
|
|
||
| // PARTNERSHIP 관련 | ||
| PARTNERSHIP_DATE_REQUIRED(2407, HttpStatus.BAD_REQUEST, "제휴는 시작일과 종료일이 필요합니다."); | ||
|
|
||
| private final int code; | ||
| private final HttpStatus status; | ||
| private final String message; | ||
| } |
9 changes: 9 additions & 0 deletions
9
.../domain/studentcouncilpost/application/exception/EventEndDateTimeNotAllowedException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ApplicationException; | ||
|
|
||
| public class EventEndDateTimeNotAllowedException extends ApplicationException { | ||
| public EventEndDateTimeNotAllowedException() { | ||
| super(ErrorCode.EVENT_END_DATETIME_NOT_ALLOWED); | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
.../domain/studentcouncilpost/application/exception/EventStartDateTimeRequiredException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ApplicationException; | ||
|
|
||
| public class EventStartDateTimeRequiredException extends ApplicationException { | ||
| public EventStartDateTimeRequiredException() { | ||
| super(ErrorCode.EVENT_START_DATETIME_REQUIRED); | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
...campus/campus/domain/studentcouncilpost/application/exception/NotPostWriterException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ApplicationException; | ||
|
|
||
| public class NotPostWriterException extends ApplicationException { | ||
| public NotPostWriterException() { | ||
| super(ErrorCode.NOT_POST_WRITER); | ||
| } | ||
| } | ||
|
|
||
|
|
10 changes: 10 additions & 0 deletions
10
...pus/domain/studentcouncilpost/application/exception/PartnershipDateRequiredException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ApplicationException; | ||
|
|
||
| public class PartnershipDateRequiredException extends ApplicationException { | ||
| public PartnershipDateRequiredException() { | ||
| super(ErrorCode.PARTNERSHIP_DATE_REQUIRED); | ||
| } | ||
| } | ||
|
|
10 changes: 10 additions & 0 deletions
10
.../campus/campus/domain/studentcouncilpost/application/exception/PostNotFoundException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ApplicationException; | ||
|
|
||
| public class PostNotFoundException extends ApplicationException { | ||
| public PostNotFoundException() { | ||
| super(ErrorCode.POST_NOT_FOUND); | ||
| } | ||
| } | ||
|
|
10 changes: 10 additions & 0 deletions
10
...us/campus/domain/studentcouncilpost/application/exception/ThumbnailRequiredException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ApplicationException; | ||
|
|
||
| public class ThumbnailRequiredException extends ApplicationException { | ||
| public ThumbnailRequiredException() { | ||
| super(ErrorCode.THUMBNAIL_REQUIRED); | ||
| } | ||
| } | ||
|
|
58 changes: 58 additions & 0 deletions
58
.../campus/campus/domain/studentcouncilpost/application/mapper/StudentCouncilPostMapper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.mapper; | ||
|
|
||
| import com.campus.campus.domain.studentcouncilpost.application.dto.PostListItemResponseDto; | ||
| import com.campus.campus.domain.studentcouncilpost.application.dto.PostResponseDto; | ||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.StudentCouncilPost; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
|
|
||
| public class StudentCouncilPostMapper { | ||
|
|
||
| public static PostListItemResponseDto toListItem( | ||
| StudentCouncilPost post, | ||
| Long currentUserId | ||
| ) { | ||
| return new PostListItemResponseDto( | ||
| post.getId(), | ||
| post.getCategory(), | ||
| post.getTitle(), | ||
| post.getPlace(), | ||
| post.getEndDateTime(), | ||
| post.getThumbnailImageUrl(), | ||
| post.getThumbnailIcon(), | ||
| currentUserId != null && post.getWriter().getId().equals(currentUserId) | ||
1winhyun marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ); | ||
|
|
||
| } | ||
|
|
||
| public static PostResponseDto toDetail( | ||
| StudentCouncilPost post, | ||
| List<String> images, | ||
| Long currentUserId | ||
| ) { | ||
|
|
||
| var writer = post.getWriter(); | ||
| var builder = PostResponseDto.builder() | ||
| .id(post.getId()) | ||
| .writerId(writer.getId()) | ||
| .writerName(writer.getFullCouncilName()) | ||
| .isWriter(post.isWrittenBy(currentUserId)) | ||
| .category(post.getCategory()) | ||
| .title(post.getTitle()) | ||
| .content(post.getContent()) | ||
| .place(post.getPlace()) | ||
| .thumbnailImageUrl(post.getThumbnailImageUrl()) | ||
| .thumbnailIcon(post.getThumbnailIcon()) | ||
| .images(images != null ? images : Collections.emptyList()); | ||
1winhyun marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if (post.isEvent()) { | ||
| builder.startDateTime(post.getStartDateTime()); | ||
| } else { | ||
| builder.startDate(post.getDisplayStartDate()); | ||
| builder.endDate(post.getDisplayEndDate()); | ||
| } | ||
|
|
||
| return builder.build(); | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.