-
Notifications
You must be signed in to change notification settings - Fork 1
feat: 기존 동아리 정보 수정 요청 API 추가 #642
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
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
dc55fbb
feat: 기존 동아리 정보 수정 요청 API 추가
dh2906 d44f4c7
chore: 코드 포맷팅
dh2906 15a12e2
fix: 동아리 수정 요청 알림에 변경 전후 값을 표시
dh2906 e7d8ec2
fix: 수정 요청 builder 출력에서 club 참조 제외
dh2906 0e6047f
fix: 동아리 수정 요청 비교 기준을 웹 동아리로 변경
dh2906 90f4e1e
fix: 동아리 수정 요청 입력을 등록 요청과 맞춤
dh2906 5bf82d0
chore: 코드 포맷팅
dh2906 7809710
fix: 동아리 수정 요청 알림 변경값만 비교 표시
dh2906 a6080df
fix: 동아리 수정 요청 입력 검증 보강
dh2906 59efb3f
chore: 코드 포맷팅
dh2906 de35f11
fix: PR 리뷰 피드백 반영
dh2906 46fcbbb
refactor: 수정 요청 DTO 이름 정리
dh2906 504f602
Revert "refactor: 수정 요청 DTO 이름 정리"
dh2906 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
67 changes: 67 additions & 0 deletions
67
src/main/java/gg/agit/konect/domain/club/dto/ClubInformationUpdateRequestDto.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,67 @@ | ||
| package gg.agit.konect.domain.club.dto; | ||
|
|
||
| import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import gg.agit.konect.domain.club.enums.ClubCategory; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| @Schema(name = "ClubInformationUpdateRequest", description = "동아리 정보 수정 요청") | ||
| public record ClubInformationUpdateRequestDto( | ||
|
|
||
| @Schema(description = "대학교 명", example = "한국기술교육대학교", requiredMode = REQUIRED) | ||
| @NotBlank(message = "대학교 명은 필수입니다.") | ||
| String universityName, | ||
|
|
||
| @Schema(description = "동아리 명", example = "BCSD Lab", requiredMode = REQUIRED) | ||
| @NotBlank(message = "동아리 명은 필수입니다.") | ||
| @Size(max = 50, message = "동아리 명은 최대 50자입니다.") | ||
| String clubName, | ||
|
|
||
| @Schema(description = "동아리 분과", example = "ACADEMIC", requiredMode = REQUIRED) | ||
| @NotNull(message = "동아리 분과는 필수입니다.") | ||
| ClubCategory clubCategory, | ||
|
|
||
| @Schema(description = "동아리 주제", example = "코딩", requiredMode = REQUIRED) | ||
| @NotBlank(message = "동아리 주제는 필수입니다.") | ||
| @Size(max = 20, message = "동아리 주제는 최대 20자입니다.") | ||
| String clubTopic, | ||
|
|
||
| @Schema(description = "동아리 이모지", example = "💻", requiredMode = REQUIRED) | ||
| @NotBlank(message = "동아리 이모지는 필수입니다.") | ||
| @Size(max = 10, message = "동아리 이모지는 최대 10자입니다.") | ||
| String clubEmoji, | ||
|
|
||
| @Schema( | ||
| description = "한 줄 소개 (최대 30자)", | ||
| example = "코딩 동아리입니다.", | ||
| requiredMode = REQUIRED | ||
| ) | ||
| @NotBlank(message = "한 줄 소개는 필수입니다.") | ||
| @Size(max = 30, message = "한 줄 소개는 최대 30자입니다.") | ||
| String shortDescription, | ||
|
|
||
| @Schema( | ||
| description = "동아리 소개 (최대 2000자)", | ||
| example = "상세한 동아리 소개 내용...", | ||
| requiredMode = REQUIRED | ||
| ) | ||
| @NotBlank(message = "동아리 소개는 필수입니다.") | ||
| @Size(max = 2000, message = "동아리 소개는 최대 2000자입니다.") | ||
| String fullIntroduction, | ||
|
|
||
| @Schema( | ||
| description = "사진 및 영상 URL 목록 (최대 5개)", | ||
| example = "[\"https://example.com/image1.jpg\"]" | ||
| ) | ||
| @Size(max = 5, message = "사진 및 영상은 최대 5개까지 업로드 가능합니다.") | ||
| List< | ||
| @NotBlank(message = "이미지 URL은 필수입니다.") | ||
| @Size(max = 500, message = "이미지 URL은 최대 500자입니다.") | ||
| String> imageUrls | ||
| ) { | ||
| } |
50 changes: 50 additions & 0 deletions
50
src/main/java/gg/agit/konect/domain/club/event/ClubInformationUpdateRequestedEvent.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,50 @@ | ||
| package gg.agit.konect.domain.club.event; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import gg.agit.konect.domain.club.model.ClubInformationUpdateRequest; | ||
|
|
||
| public record ClubInformationUpdateRequestedEvent( | ||
| Integer requestId, | ||
| Integer clubId, | ||
| String currentUniversityName, | ||
| String requestedUniversityName, | ||
| String currentClubName, | ||
| String requestedClubName, | ||
| String currentCategory, | ||
| String requestedCategory, | ||
| String currentTopic, | ||
| String requestedTopic, | ||
| String requestedEmoji, | ||
| String currentDescription, | ||
| String requestedDescription, | ||
| String currentFullIntroduction, | ||
| String requestedFullIntroduction, | ||
| String currentImageUrl, | ||
| List<String> requestedImageUrls | ||
| ) { | ||
|
|
||
| public static ClubInformationUpdateRequestedEvent from(ClubInformationUpdateRequest request) { | ||
| return new ClubInformationUpdateRequestedEvent( | ||
| request.getId(), | ||
| request.getClub().getId(), | ||
| request.getClub().getUniversity().getKoreanName(), | ||
| request.getUniversityName(), | ||
| request.getClub().getName(), | ||
| request.getClubName(), | ||
| request.getClub().getClubCategory().getDescription(), | ||
| request.getClubCategory().getDescription(), | ||
| request.getClub().getTopic(), | ||
| request.getClubTopic(), | ||
| request.getClubEmoji(), | ||
| request.getClub().getDescription(), | ||
| request.getShortDescription(), | ||
| request.getClub().getIntroduce(), | ||
| request.getFullIntroduction(), | ||
| request.getClub().getImageUrl(), | ||
| request.getImages().stream() | ||
| .map(image -> image.getImageUrl()) | ||
| .toList() | ||
| ); | ||
| } | ||
| } |
126 changes: 126 additions & 0 deletions
126
src/main/java/gg/agit/konect/domain/club/model/ClubInformationUpdateRequest.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,126 @@ | ||
| package gg.agit.konect.domain.club.model; | ||
|
|
||
| import static jakarta.persistence.CascadeType.ALL; | ||
| import static jakarta.persistence.EnumType.STRING; | ||
| import static jakarta.persistence.FetchType.LAZY; | ||
| import static jakarta.persistence.GenerationType.IDENTITY; | ||
| import static lombok.AccessLevel.PROTECTED; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| import gg.agit.konect.domain.club.enums.ClubCategory; | ||
| import gg.agit.konect.domain.website.model.WebClub; | ||
| import gg.agit.konect.global.model.BaseEntity; | ||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.Enumerated; | ||
| import jakarta.persistence.GeneratedValue; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.JoinColumn; | ||
| import jakarta.persistence.ManyToOne; | ||
| import jakarta.persistence.OneToMany; | ||
| import jakarta.persistence.OrderBy; | ||
| import jakarta.persistence.Table; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.ToString; | ||
|
|
||
| @Getter | ||
| @ToString | ||
| @Entity | ||
| @Table(name = "club_information_update_request") | ||
| @NoArgsConstructor(access = PROTECTED) | ||
| public class ClubInformationUpdateRequest extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = IDENTITY) | ||
| @Column(name = "id", nullable = false, updatable = false, unique = true) | ||
| private Integer id; | ||
|
|
||
| @NotNull | ||
| @ToString.Exclude | ||
| @ManyToOne(fetch = LAZY) | ||
| @JoinColumn(name = "web_club_id", nullable = false) | ||
| private WebClub club; | ||
|
|
||
| @NotNull | ||
| @Column(name = "university_name", nullable = false) | ||
| private String universityName; | ||
|
|
||
| @NotNull | ||
| @Column(name = "club_name", length = 50, nullable = false) | ||
| private String clubName; | ||
|
|
||
| @NotNull | ||
| @Enumerated(value = STRING) | ||
| @Column(name = "club_category", nullable = false) | ||
| private ClubCategory clubCategory; | ||
|
|
||
| @NotNull | ||
| @Column(name = "club_topic", length = 20, nullable = false) | ||
| private String clubTopic; | ||
|
|
||
| @NotNull | ||
| @Column(name = "club_emoji", length = 10, nullable = false) | ||
| private String clubEmoji; | ||
|
|
||
| @NotNull | ||
| @Column(name = "short_description", length = 30, nullable = false) | ||
| private String shortDescription; | ||
|
|
||
| @NotNull | ||
| @Column(name = "full_introduction", columnDefinition = "TEXT", nullable = false) | ||
| private String fullIntroduction; | ||
|
|
||
| @OneToMany(mappedBy = "request", cascade = ALL, orphanRemoval = true) | ||
| @OrderBy("displayOrder ASC") | ||
| private List<ClubInformationUpdateRequestImage> images = new ArrayList<>(); | ||
|
|
||
| @NotNull | ||
| @Enumerated(value = STRING) | ||
| @Column(name = "status", length = 20, nullable = false) | ||
| private UpdateRequestStatus status; | ||
|
|
||
| @Builder | ||
|
github-code-quality[bot] marked this conversation as resolved.
Fixed
github-code-quality[bot] marked this conversation as resolved.
Fixed
github-code-quality[bot] marked this conversation as resolved.
Fixed
github-code-quality[bot] marked this conversation as resolved.
Fixed
github-code-quality[bot] marked this conversation as resolved.
Fixed
|
||
| private ClubInformationUpdateRequest( | ||
| Integer id, | ||
| WebClub club, | ||
| String universityName, | ||
| String clubName, | ||
| ClubCategory clubCategory, | ||
| String clubTopic, | ||
| String clubEmoji, | ||
| String shortDescription, | ||
| String fullIntroduction, | ||
| UpdateRequestStatus status | ||
| ) { | ||
| this.id = id; | ||
| this.club = club; | ||
| this.universityName = universityName; | ||
| this.clubName = clubName; | ||
| this.clubCategory = clubCategory; | ||
| this.clubTopic = clubTopic; | ||
| this.clubEmoji = clubEmoji; | ||
| this.shortDescription = shortDescription; | ||
| this.fullIntroduction = fullIntroduction; | ||
| this.status = status != null ? status : UpdateRequestStatus.PENDING; | ||
| } | ||
|
|
||
| public void addImages(List<String> imageUrls) { | ||
| for (int i = 0; i < imageUrls.size(); i++) { | ||
| ClubInformationUpdateRequestImage image = ClubInformationUpdateRequestImage.builder() | ||
| .request(this) | ||
| .imageUrl(imageUrls.get(i)) | ||
| .displayOrder(i) | ||
| .build(); | ||
| this.images.add(image); | ||
| } | ||
| } | ||
|
|
||
| public enum UpdateRequestStatus { | ||
| PENDING, APPROVED, REJECTED | ||
| } | ||
| } | ||
68 changes: 68 additions & 0 deletions
68
src/main/java/gg/agit/konect/domain/club/model/ClubInformationUpdateRequestImage.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,68 @@ | ||
| package gg.agit.konect.domain.club.model; | ||
|
|
||
| import static jakarta.persistence.FetchType.LAZY; | ||
| import static jakarta.persistence.GenerationType.IDENTITY; | ||
| import static lombok.AccessLevel.PROTECTED; | ||
|
|
||
| import gg.agit.konect.global.model.BaseEntity; | ||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.GeneratedValue; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.JoinColumn; | ||
| import jakarta.persistence.ManyToOne; | ||
| import jakarta.persistence.Table; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Getter | ||
| @Entity | ||
| @Table(name = "club_information_update_request_image") | ||
| @NoArgsConstructor(access = PROTECTED) | ||
| public class ClubInformationUpdateRequestImage extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = IDENTITY) | ||
| @Column(name = "id", nullable = false, updatable = false, unique = true) | ||
| private Integer id; | ||
|
|
||
| @NotNull | ||
| @ManyToOne(fetch = LAZY) | ||
| @JoinColumn(name = "request_id", nullable = false) | ||
| private ClubInformationUpdateRequest request; | ||
|
|
||
| @NotNull | ||
| @Column(name = "image_url", length = 500, nullable = false) | ||
| private String imageUrl; | ||
|
|
||
| @NotNull | ||
| @Column(name = "display_order", nullable = false) | ||
| private Integer displayOrder; | ||
|
|
||
| @Builder | ||
| private ClubInformationUpdateRequestImage( | ||
| Integer id, | ||
| ClubInformationUpdateRequest request, | ||
| String imageUrl, | ||
| Integer displayOrder | ||
| ) { | ||
| this.id = id; | ||
| this.request = request; | ||
| this.imageUrl = imageUrl; | ||
| this.displayOrder = displayOrder; | ||
| } | ||
|
|
||
| public static class ClubInformationUpdateRequestImageBuilder { | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "ClubInformationUpdateRequestImage.ClubInformationUpdateRequestImageBuilder(" | ||
| + "id=" + id | ||
| + ", imageUrl=" + imageUrl | ||
| + ", displayOrder=" + displayOrder | ||
| + ")"; | ||
| } | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
...in/java/gg/agit/konect/domain/club/repository/ClubInformationUpdateRequestRepository.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 gg.agit.konect.domain.club.repository; | ||
|
|
||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| import gg.agit.konect.domain.club.model.ClubInformationUpdateRequest; | ||
|
|
||
| public interface ClubInformationUpdateRequestRepository | ||
| extends JpaRepository<ClubInformationUpdateRequest, Integer> { | ||
| } |
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.