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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public record InnerAppliedClubResponse(
@Schema(description = "동아리 분과", example = "학술", requiredMode = REQUIRED)
String categoryName,

@Schema(description = "동아리 주제", example = "코딩", requiredMode = REQUIRED)
String topic,

@Schema(description = "가입 신청 일시", example = "2025-01-13T10:30:00", requiredMode = REQUIRED)
LocalDateTime appliedAt
) {
Expand All @@ -39,6 +42,7 @@ public static InnerAppliedClubResponse from(ClubApply clubApply) {
clubApply.getClub().getName(),
clubApply.getClub().getImageUrl(),
clubApply.getClub().getClubCategory().getDescription(),
clubApply.getClub().getTopic(),
clubApply.getCreatedAt()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public record ClubBasicInfoUpdateRequest(

@Schema(description = "동아리 분과", example = "ACADEMIC", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "동아리 분과는 필수 입력입니다.")
ClubCategory clubCategory
ClubCategory clubCategory,

@Schema(description = "동아리 주제", example = "코딩", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "동아리 주제는 필수 입력입니다.")
@Size(max = 20, message = "동아리 주제는 20자 이하여야 합니다.")
String topic
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ public record ClubCreateRequest(

@Schema(description = "동아리 분과", example = "ACADEMIC", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "동아리 분과는 필수입니다.")
ClubCategory clubCategory
ClubCategory clubCategory,

@Schema(description = "동아리 주제", example = "코딩", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "동아리 주제는 필수 입력입니다.")
@Size(max = 20, message = "동아리 주제는 20자 이하여야 합니다.")
String topic
) {
public Club toEntity(University university) {
return Club.builder()
Expand All @@ -52,6 +57,7 @@ public Club toEntity(University university) {
.imageUrl(imageUrl)
.location(location)
.clubCategory(clubCategory)
.topic(topic)
.university(university)
.isRecruitmentEnabled(false)
.isApplicationEnabled(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public record ClubDetailResponse(
@Schema(description = "동아리 분과", example = "학술", requiredMode = REQUIRED)
String categoryName,

@Schema(description = "동아리 주제", example = "코딩", requiredMode = REQUIRED)
String topic,

@Schema(description = "동아리 인원 수", example = "30", requiredMode = REQUIRED)
Integer memberCount,

Expand Down Expand Up @@ -106,6 +109,7 @@ public static ClubDetailResponse of(
club.getIntroduce(),
club.getImageUrl(),
club.getClubCategory().getDescription(),
club.getTopic(),
memberCount,
InnerRecruitment.from(clubRecruitment, club.getIsRecruitmentEnabled()),
presidentUser.getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public record InnerJoinedClubResponse(
@Schema(description = "동아리 분과", example = "학술", requiredMode = REQUIRED)
String categoryName,

@Schema(description = "동아리 주제", example = "코딩", requiredMode = REQUIRED)
String topic,

@Schema(description = "직책", example = "회장", requiredMode = REQUIRED)
String position
) {
Expand All @@ -35,6 +38,7 @@ public static InnerJoinedClubResponse from(ClubMember clubMember) {
clubMember.getClub().getName(),
clubMember.getClub().getImageUrl(),
clubMember.getClub().getClubCategory().getDescription(),
clubMember.getClub().getTopic(),
clubMember.getClubPosition().getDescription()
);
}
Expand All @@ -45,6 +49,7 @@ public static InnerJoinedClubResponse forAdmin(Club club) {
club.getName(),
club.getImageUrl(),
club.getClubCategory().getDescription(),
club.getTopic(),
ClubPosition.PRESIDENT.getDescription()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public record InnerClubResponse(
@Schema(description = "동아리 분과", example = "학술", requiredMode = REQUIRED)
String categoryName,

@Schema(description = "동아리 주제", example = "코딩", requiredMode = REQUIRED)
String topic,

@Schema(description = "동아리 소개", example = "즐겁게 일하고 열심히 노는 IT 특성화 동아리", requiredMode = REQUIRED)
String description,

Expand All @@ -70,6 +73,7 @@ public static InnerClubResponse from(ClubSummaryInfo clubSummaryInfo, boolean is
clubSummaryInfo.name(),
clubSummaryInfo.imageUrl(),
clubSummaryInfo.categoryName(),
clubSummaryInfo.topic(),
clubSummaryInfo.description(),
clubSummaryInfo.status(),
isPendingApproval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public record MyManagedClubResponse(
@Schema(description = "동아리 이름", example = "BCSD", requiredMode = REQUIRED)
String clubName,

@Schema(description = "동아리 주제", example = "코딩", requiredMode = REQUIRED)
String topic,

@Schema(description = "회원 이름", example = "배진호", requiredMode = REQUIRED)
String name,

Expand All @@ -33,6 +36,7 @@ public static MyManagedClubResponse from(Club club, ClubMember clubMember) {
club.getId(),
club.getImageUrl(),
club.getName(),
club.getTopic(),
user.getName(),
user.getStudentNumber(),
clubMember.getClubPosition().getDescription()
Expand All @@ -44,6 +48,7 @@ public static MyManagedClubResponse forAdmin(Club club, User user) {
club.getId(),
club.getImageUrl(),
club.getName(),
club.getTopic(),
user.getName(),
user.getStudentNumber(),
ClubPosition.PRESIDENT.getDescription()
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/gg/agit/konect/domain/club/model/Club.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public class Club extends BaseEntity {
@Column(name = "name", length = 50, nullable = false)
private String name;

@Column(name = "topic", length = 20, nullable = false)
private String topic;

@Column(name = "description", length = 20, nullable = false)
private String description;

Expand Down Expand Up @@ -105,6 +108,7 @@ private Club(
ClubCategory clubCategory,
University university,
String name,
String topic,
String description,
String introduce,
String imageUrl,
Expand All @@ -122,6 +126,7 @@ private Club(
this.clubCategory = clubCategory;
this.university = university;
this.name = name;
this.topic = topic;
this.description = description;
this.introduce = introduce;
this.imageUrl = imageUrl;
Expand All @@ -144,6 +149,7 @@ public static Club of(ClubCreateRequest request, University university) {
.imageUrl(request.imageUrl())
.location(request.location())
.clubCategory(request.clubCategory())
.topic(request.topic())
.university(university)
.build();
}
Expand Down Expand Up @@ -173,9 +179,10 @@ public void updateInfo(String description, String imageUrl, String location, Str
this.introduce = introduce;
}

public void updateBasicInfo(String name, ClubCategory clubCategory) {
public void updateBasicInfo(String name, ClubCategory clubCategory, String topic) {
this.name = name;
this.clubCategory = clubCategory;
this.topic = topic;
}

public void updateSettings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public record ClubSummaryInfo(
String name,
String imageUrl,
String categoryName,
String topic,
String description,
RecruitmentStatus status,
Boolean isAlwaysRecruiting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ private List<ClubSummaryInfo> convertToSummaryInfo(List<Club> clubs) {
club.getName(),
club.getImageUrl(),
club.getClubCategory().getDescription(),
club.getTopic(),
club.getDescription(),
status,
isAlwaysRecruiting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void updateBasicInfo(Integer clubId, Integer userId, ClubBasicInfoUpdateR

clubPermissionValidator.validateManagerAccess(clubId, user);

club.updateBasicInfo(request.name(), request.clubCategory());
club.updateBasicInfo(request.name(), request.clubCategory(), request.topic());
}

public ClubMembershipsResponse getJoinedClubs(Integer userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public record WebsiteClubDetailResponse(
@Schema(description = "분과명", example = "학술", requiredMode = REQUIRED)
String categoryName,

@Schema(description = "동아리 주제", example = "코딩", requiredMode = REQUIRED)
String topic,

@Schema(description = "한 줄 소개", example = "테스트 동아리 소개", requiredMode = REQUIRED)
String description,

Expand Down Expand Up @@ -113,6 +116,7 @@ public static WebsiteClubDetailResponse of(Club club, Long memberCount, Long uni
club.getImageUrl(),
club.getClubCategory(),
club.getClubCategory().getDescription(),
club.getTopic(),
club.getDescription(),
club.getIntroduce(),
club.getLocation(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public record ClubResponse(
@Schema(description = "분과명", example = "학술", requiredMode = REQUIRED)
String categoryName,

@Schema(description = "동아리 주제", example = "코딩", requiredMode = REQUIRED)
String topic,

@Schema(description = "한 줄 소개", example = "테스트 동아리 소개", requiredMode = REQUIRED)
String description,

Expand All @@ -118,6 +121,7 @@ public static ClubResponse of(Club club, Long memberCount) {
club.getImageUrl(),
club.getClubCategory(),
club.getClubCategory().getDescription(),
club.getTopic(),
club.getDescription(),
memberCount
);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/db/migration/V75__add_topic_to_club.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE club
ADD COLUMN topic VARCHAR(20) NOT NULL DEFAULT '기타' AFTER name;
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,15 @@ void createClubByAdminSuccess() throws Exception {
"상세 소개",
"https://example.com/image.png",
"학생회관 201호",
ClubCategory.ACADEMIC
ClubCategory.ACADEMIC,
"코딩"
);

// when & then
performPost("/clubs", request)
.andExpect(status().isOk())
.andExpect(jsonPath("$.name").value("새 동아리"))
.andExpect(jsonPath("$.topic").value("코딩"))
.andExpect(jsonPath("$.presidentName").value("새회장"))
.andExpect(jsonPath("$.memberCount").value(1));
}
Expand All @@ -176,7 +178,8 @@ void createClubByNormalUserFails() throws Exception {
"상세 소개",
"https://example.com/image.png",
"학생회관 201호",
ClubCategory.ACADEMIC
ClubCategory.ACADEMIC,
"코딩"
);

// when & then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ void getClubDetailSuccess() throws Exception {
.andExpect(status().isOk())
.andExpect(jsonPath("$.name").value("ZEST"))
.andExpect(jsonPath("$.categoryName").value("공연"))
.andExpect(jsonPath("$.topic").value("코딩"))
.andExpect(jsonPath("$.university.name").value("한국기술교육대학교"))
.andExpect(jsonPath("$.university.region").value("CHUNGCHEONG"))
.andExpect(jsonPath("$.university.imageUrl").value("https://example.com/koreatech-logo.png"))
Expand Down Expand Up @@ -214,6 +215,7 @@ private Club createClub(University university, String name, ClubCategory categor
.imageUrl("https://example.com/" + name + ".png")
.location("학생회관 101호")
.clubCategory(category)
.topic("코딩")
.isRecruitmentEnabled(false)
.isApplicationEnabled(false)
.isFeeRequired(false)
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/gg/agit/konect/support/fixture/ClubFixture.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public static Club create(University university, String name) {
.imageUrl("https://example.com/club.png")
.location("학생회관 101호")
.clubCategory(ClubCategory.ACADEMIC)
.topic("코딩")
.isRecruitmentEnabled(false)
.isApplicationEnabled(true)
.isFeeRequired(false)
Expand All @@ -46,6 +47,7 @@ public static Club createWithRecruitment(University university, String name) {
.imageUrl("https://example.com/club.png")
.location("학생회관 101호")
.clubCategory(ClubCategory.ACADEMIC)
.topic("코딩")
.isRecruitmentEnabled(true)
.isApplicationEnabled(true)
.isFeeRequired(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void setUp() {
club = Club.builder()
.id(clubId)
.name("Test Club")
.topic("코딩")
.university(university)
.build();
}
Expand Down
Loading
Loading