-
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 all 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
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
42 changes: 42 additions & 0 deletions
42
...a/com/campus/campus/domain/studentcouncilpost/application/dto/request/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,42 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.dto.request; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
|
|
||
| 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; | ||
|
|
||
| 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 | ||
| ) { | ||
| } |
9 changes: 9 additions & 0 deletions
9
.../campus/campus/domain/studentcouncilpost/application/dto/response/NormalizedDateTime.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.dto.response; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| public record NormalizedDateTime( | ||
| LocalDateTime startDateTime, | ||
| LocalDateTime endDateTime | ||
| ) { | ||
| } |
18 changes: 18 additions & 0 deletions
18
...us/campus/domain/studentcouncilpost/application/dto/response/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,18 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.dto.response; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.PostCategory; | ||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.ThumbnailIcon; | ||
|
|
||
| public record PostListItemResponseDto( | ||
| Long id, | ||
| PostCategory category, | ||
| String title, | ||
| String place, | ||
| LocalDateTime endDateTime, | ||
| String thumbnailImageUrl, | ||
| ThumbnailIcon thumbnailIcon, | ||
| Boolean isWriter | ||
| ) { | ||
| } |
35 changes: 35 additions & 0 deletions
35
...com/campus/campus/domain/studentcouncilpost/application/dto/response/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,35 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.dto.response; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
|
|
||
| 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 lombok.Builder; | ||
|
|
||
| @Builder | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
1winhyun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public record PostResponseDto( | ||
|
|
||
| Long id, | ||
| Long writerId, | ||
| String writerName, | ||
| Boolean isWriter, | ||
|
|
||
| PostCategory category, | ||
| String title, | ||
| String content, | ||
| String place, | ||
| LocalDate startDate, | ||
| LocalDate endDate, | ||
| LocalDateTime startDateTime, | ||
|
|
||
| String thumbnailImageUrl, | ||
| ThumbnailIcon thumbnailIcon, | ||
|
|
||
| List<String> images | ||
| ) { | ||
| } | ||
27 changes: 27 additions & 0 deletions
27
...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,27 @@ | ||
| 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, "썸네일(이미지 또는 아이콘)은 반드시 필요합니다."), | ||
| POST_IMAGE_LIMIT_EXCEEDED(2404, HttpStatus.BAD_REQUEST, "게시글 이미지는 최대 10개까지 등록할 수 있습니다."), | ||
|
|
||
| // 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); | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
...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,9 @@ | ||
| 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); | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
...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,9 @@ | ||
| 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); | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
...mpus/domain/studentcouncilpost/application/exception/PostImageLimitExceededException.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 PostImageLimitExceededException extends ApplicationException { | ||
| public PostImageLimitExceededException() { | ||
| super(ErrorCode.POST_IMAGE_LIMIT_EXCEEDED); | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
.../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,9 @@ | ||
| 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); | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
...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,9 @@ | ||
| 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); | ||
| } | ||
| } |
92 changes: 92 additions & 0 deletions
92
.../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,92 @@ | ||
| package com.campus.campus.domain.studentcouncilpost.application.mapper; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
|
|
||
| import com.campus.campus.domain.council.domain.entity.StudentCouncil; | ||
| import com.campus.campus.domain.studentcouncilpost.application.dto.response.PostListItemResponseDto; | ||
| import com.campus.campus.domain.studentcouncilpost.application.dto.request.PostRequestDto; | ||
| import com.campus.campus.domain.studentcouncilpost.application.dto.response.PostResponseDto; | ||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.PostImage; | ||
| import com.campus.campus.domain.studentcouncilpost.domain.entity.StudentCouncilPost; | ||
|
|
||
| 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(), | ||
| post.getWriter().getId().equals(currentUserId) | ||
| ); | ||
|
|
||
| } | ||
|
|
||
| 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()); | ||
|
|
||
| if (post.isEvent()) { | ||
| builder.startDateTime(post.getStartDateTime()); | ||
| } else { | ||
| builder.startDate(post.getDisplayStartDate()); | ||
| builder.endDate(post.getDisplayEndDate()); | ||
| } | ||
|
|
||
| return builder.build(); | ||
| } | ||
|
|
||
| public static StudentCouncilPost toEntity( | ||
| StudentCouncil writer, | ||
| PostRequestDto dto, | ||
| LocalDateTime startDateTime, | ||
| LocalDateTime endDateTime | ||
| ) { | ||
| return StudentCouncilPost.builder() | ||
| .writer(writer) | ||
| .category(dto.category()) | ||
| .title(dto.title()) | ||
| .content(dto.content()) | ||
| .place(dto.place()) | ||
| .startDateTime(startDateTime) | ||
| .endDateTime(endDateTime) | ||
| .thumbnailImageUrl(dto.thumbnailImageUrl()) | ||
| .thumbnailIcon(dto.thumbnailIcon()) | ||
| .build(); | ||
| } | ||
|
|
||
| public static PostImage toEntity( | ||
| StudentCouncilPost post, | ||
| String imageUrl | ||
| ) { | ||
| return PostImage.builder() | ||
| .post(post) | ||
| .imageUrl(imageUrl) | ||
| .build(); | ||
| } | ||
|
|
||
| } |
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.