From a8c2dd49f4df86d364598827728c2e3b85601a55 Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:36:23 +0900 Subject: [PATCH 01/15] =?UTF-8?q?fix:=20=EC=98=A4=ED=94=88=EC=B1=84?= =?UTF-8?q?=ED=8C=85=EB=B0=A9=20=EB=A7=81=ED=81=AC=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=EC=97=90=EC=84=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/with_dankook/model/entity/type/BearEats.java | 4 ++-- .../domain/with_dankook/model/entity/type/Dormitory.java | 4 ++-- .../domain/with_dankook/model/entity/type/EatingAlong.java | 4 ++-- .../domain/with_dankook/model/entity/type/Study.java | 6 ++++-- .../domain/with_dankook/model/entity/type/Trade.java | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/BearEats.java b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/BearEats.java index 6feee086..471009a7 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/BearEats.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/BearEats.java @@ -37,8 +37,8 @@ public class BearEats extends WithDankook { @Builder - private BearEats(User user, String chatLink, String restaurant, String deliveryPlace, LocalDateTime deliveryTime, String content) { - super(user, chatLink); + private BearEats(User user, String restaurant, String deliveryPlace, LocalDateTime deliveryTime, String content) { + super(user); this.restaurant = restaurant; this.deliveryPlace = deliveryPlace; this.deliveryTime = deliveryTime; diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Dormitory.java b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Dormitory.java index ce9d407e..f38ce05a 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Dormitory.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Dormitory.java @@ -35,8 +35,8 @@ public class Dormitory extends WithDankook { private String duration; @Builder - private Dormitory(User user, String chatLink, String title, int minStudentId, String livingHall, String duration) { - super(user, chatLink); + private Dormitory(User user, String title, int minStudentId, String livingHall, String duration) { + super(user); this.title = title; this.minStudentId = minStudentId; this.livingHall = livingHall; diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/EatingAlong.java b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/EatingAlong.java index e0e575cc..fc3ac472 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/EatingAlong.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/EatingAlong.java @@ -27,8 +27,8 @@ public class EatingAlong extends WithDankook { private String content; @Builder - private EatingAlong(User user, String chatLink, String title, String content) { - super(user, chatLink); + private EatingAlong(User user, String title, String content) { + super(user); this.title = title; this.content = content; } diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Study.java b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Study.java index ddb2eb38..0ac2a894 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Study.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Study.java @@ -30,9 +30,11 @@ public class Study extends WithDankook { private int minStudentId; @NotNull + @DateTimeFormat(pattern = "yyyy-MM-dd HH:MM") private LocalDateTime startTime; @NotNull + @DateTimeFormat(pattern = "yyyy-MM-dd HH:MM") private LocalDateTime endTime; @ManyToOne(fetch = FetchType.LAZY) @@ -44,8 +46,8 @@ public class Study extends WithDankook { private String content; @Builder - private Study(User user, String chatLink, String title, int minStudentId, LocalDateTime startTime, LocalDateTime endTime, StudyTag tag, String content) { - super(user, chatLink); + private Study(User user, String title, int minStudentId, LocalDateTime startTime, LocalDateTime endTime, StudyTag tag, String content) { + super(user); this.title = title; this.minStudentId = minStudentId; this.startTime = startTime; diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Trade.java b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Trade.java index b720f99f..752622bb 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Trade.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/entity/type/Trade.java @@ -40,8 +40,8 @@ public class Trade extends WithDankook { private List images = new ArrayList<>(); @Builder - private Trade(User user, String chatLink, String title, int price, String content, String tradePlace) { - super(user, chatLink); + private Trade(User user, String title, int price, String content, String tradePlace) { + super(user); this.title = title; this.price = price; this.content = content; From 4229d8b7c6f71822cf45b4de5fd455dd0837fe4c Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:36:54 +0900 Subject: [PATCH 02/15] =?UTF-8?q?feat:=20WIthDankook=20=EC=97=90=20?= =?UTF-8?q?=EC=8B=A0=EC=B2=AD=ED=95=9C=20=EC=82=AC=EC=9A=A9=EC=9E=90?= =?UTF-8?q?=EC=9D=B8=EC=A7=80=20=ED=99=95=EC=9D=B8=ED=95=98=EB=8A=94=20JPQ?= =?UTF-8?q?L=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/WithDankookUserRepository.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/dku/council/domain/with_dankook/repository/WithDankookUserRepository.java b/src/main/java/com/dku/council/domain/with_dankook/repository/WithDankookUserRepository.java index e61d47ac..d466d8ca 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/repository/WithDankookUserRepository.java +++ b/src/main/java/com/dku/council/domain/with_dankook/repository/WithDankookUserRepository.java @@ -6,6 +6,8 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; +import java.util.Optional; + public interface WithDankookUserRepository extends JpaRepository, JpaSpecificationExecutor { @Query("select COUNT(u.withDankook.id) " + "from WithDankookUser u " + @@ -14,4 +16,10 @@ public interface WithDankookUserRepository extends JpaRepository isExistsByWithDankookIdAndUserId(Long withDankookId, Long userId); } From 739aabddd179aa0edbc4c46e8303b1253b66b2e5 Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:37:09 +0900 Subject: [PATCH 03/15] =?UTF-8?q?fix:=20WithDankook=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=EC=97=90=EC=84=9C=20ChatLink=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/with_dankook/model/entity/WithDankook.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/entity/WithDankook.java b/src/main/java/com/dku/council/domain/with_dankook/model/entity/WithDankook.java index 9680f452..554215df 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/entity/WithDankook.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/entity/WithDankook.java @@ -39,17 +39,11 @@ public abstract class WithDankook extends BaseEntity { @OneToMany(mappedBy = "withDankook", cascade = CascadeType.ALL, orphanRemoval = true) private List users = new ArrayList<>(); - @NonNull - @Lob - @Column(name = "chat_link") - private String chatLink; - @Enumerated(STRING) private WithDankookStatus withDankookStatus; - protected WithDankook(User user, String chatLink) { + protected WithDankook(User user) { this.masterUser = user; - this.chatLink = chatLink; this.withDankookStatus = ACTIVE; } From aa1b56fcad973cc47d7bcede7216db6f85965cdd Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:37:37 +0900 Subject: [PATCH 04/15] =?UTF-8?q?fix:=20=EB=8B=A8=EC=9D=BC=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20WithDankook=20dto=20=EC=97=90=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=9E=90=20=EC=A0=95=EB=B3=B4=20=EC=B6=94=EA=B0=80=20=EB=B0=8F?= =?UTF-8?q?=20=EC=98=A4=ED=94=88=EC=B1=84=ED=8C=85=EB=B0=A9=20=EB=A7=81?= =?UTF-8?q?=ED=81=AC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ResponseSingleWithDankookDto.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleWithDankookDto.java b/src/main/java/com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleWithDankookDto.java index 4c4017f5..86095eeb 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleWithDankookDto.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleWithDankookDto.java @@ -15,12 +15,21 @@ public class ResponseSingleWithDankookDto { @Schema(description = "작성자", example = "익명") private final String author; + @Schema(description = "성별", example = "남자") + private final String gender; + + @Schema(description = "학번", example = "201511111") + private final String studentId; + + @Schema(description = "소속 대학", example = "SW융합대학") + private final String department; + + @Schema(description = "소속 학과", example = "소프트웨어학과") + private final String major; + @Schema(description = "생성 날짜") private final LocalDateTime createdAt; - @Schema(description = "채팅 링크", example = "https://open.kakao.com/o/ghjgjgjg") - private final String chatLink; - @Schema(description = "좋아요 수", example = "26") private final int likes; @@ -36,8 +45,11 @@ public class ResponseSingleWithDankookDto { public ResponseSingleWithDankookDto(int likes, boolean isMine, boolean isLiked, WithDankook withDankook) { this.id = withDankook.getId(); this.author = withDankook.getDisplayingUsername(); + this.gender = withDankook.getMasterUser().getGender(); + this.studentId = withDankook.getMasterUser().getStudentId(); + this.major = withDankook.getMasterUser().getMajor().getName(); + this.department = withDankook.getMasterUser().getMajor().getDepartment(); this.createdAt = withDankook.getCreatedAt(); - this.chatLink = withDankook.getChatLink(); this.likes = likes; this.isMine = isMine; this.isLiked = isLiked; @@ -47,8 +59,11 @@ public ResponseSingleWithDankookDto(int likes, boolean isMine, boolean isLiked, public ResponseSingleWithDankookDto(ResponseSingleWithDankookDto copy) { this.id = copy.id; this.author = copy.author; + this.gender = copy.gender; + this.studentId = copy.studentId; + this.major = copy.major; + this.department = copy.department; this.createdAt = copy.createdAt; - this.chatLink = copy.chatLink; this.likes = copy.likes; this.isMine = copy.isMine; this.isLiked = copy.isLiked; From 914c875b73db9d9cc21a601306144815802c79c6 Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:38:06 +0900 Subject: [PATCH 05/15] =?UTF-8?q?feat:=20WithDankook,=20=EB=8B=A8=ED=84=B0?= =?UTF-8?q?=EB=94=94=EC=97=90=20=ED=95=84=EC=9A=94=ED=95=9C=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=B2=98=EB=A6=AC=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/AlreadyEnteredException.java | 11 +++++++++++ .../exception/AlreadyFullRecruitedException.java | 11 +++++++++++ .../exception/InvalidMinStudentIdException.java | 11 +++++++++++ .../exception/InvalidStatusException.java | 11 +++++++++++ 4 files changed, 44 insertions(+) create mode 100644 src/main/java/com/dku/council/domain/with_dankook/exception/AlreadyEnteredException.java create mode 100644 src/main/java/com/dku/council/domain/with_dankook/exception/AlreadyFullRecruitedException.java create mode 100644 src/main/java/com/dku/council/domain/with_dankook/exception/InvalidMinStudentIdException.java create mode 100644 src/main/java/com/dku/council/domain/with_dankook/exception/InvalidStatusException.java diff --git a/src/main/java/com/dku/council/domain/with_dankook/exception/AlreadyEnteredException.java b/src/main/java/com/dku/council/domain/with_dankook/exception/AlreadyEnteredException.java new file mode 100644 index 00000000..974f2248 --- /dev/null +++ b/src/main/java/com/dku/council/domain/with_dankook/exception/AlreadyEnteredException.java @@ -0,0 +1,11 @@ +package com.dku.council.domain.with_dankook.exception; + +import com.dku.council.global.error.exception.LocalizedMessageException; +import org.springframework.http.HttpStatus; + +public class AlreadyEnteredException extends LocalizedMessageException { + + public AlreadyEnteredException() { + super(HttpStatus.BAD_REQUEST, "already.entered"); + } +} diff --git a/src/main/java/com/dku/council/domain/with_dankook/exception/AlreadyFullRecruitedException.java b/src/main/java/com/dku/council/domain/with_dankook/exception/AlreadyFullRecruitedException.java new file mode 100644 index 00000000..15dffd03 --- /dev/null +++ b/src/main/java/com/dku/council/domain/with_dankook/exception/AlreadyFullRecruitedException.java @@ -0,0 +1,11 @@ +package com.dku.council.domain.with_dankook.exception; + +import com.dku.council.global.error.exception.LocalizedMessageException; +import org.springframework.http.HttpStatus; + +public class AlreadyFullRecruitedException extends LocalizedMessageException { + + public AlreadyFullRecruitedException() { + super(HttpStatus.BAD_REQUEST, "already.full-recruited"); + } +} diff --git a/src/main/java/com/dku/council/domain/with_dankook/exception/InvalidMinStudentIdException.java b/src/main/java/com/dku/council/domain/with_dankook/exception/InvalidMinStudentIdException.java new file mode 100644 index 00000000..b3082868 --- /dev/null +++ b/src/main/java/com/dku/council/domain/with_dankook/exception/InvalidMinStudentIdException.java @@ -0,0 +1,11 @@ +package com.dku.council.domain.with_dankook.exception; + +import com.dku.council.global.error.exception.LocalizedMessageException; +import org.springframework.http.HttpStatus; + +public class InvalidMinStudentIdException extends LocalizedMessageException { + + public InvalidMinStudentIdException() { + super(HttpStatus.BAD_REQUEST, "invalid.student-id"); + } +} diff --git a/src/main/java/com/dku/council/domain/with_dankook/exception/InvalidStatusException.java b/src/main/java/com/dku/council/domain/with_dankook/exception/InvalidStatusException.java new file mode 100644 index 00000000..381a4145 --- /dev/null +++ b/src/main/java/com/dku/council/domain/with_dankook/exception/InvalidStatusException.java @@ -0,0 +1,11 @@ +package com.dku.council.domain.with_dankook.exception; + +import com.dku.council.global.error.exception.LocalizedMessageException; +import org.springframework.http.HttpStatus; + +public class InvalidStatusException extends LocalizedMessageException { + + public InvalidStatusException() { + super(HttpStatus.BAD_REQUEST, "invalid.status"); + } +} From 1e47b458453c3ea41035cb79afb985c7895a32f1 Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:38:39 +0900 Subject: [PATCH 06/15] =?UTF-8?q?fix:=20=EB=8B=A8=ED=84=B0=EB=94=94=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20Dto=EC=97=90=20?= =?UTF-8?q?=EB=AA=A8=EC=A7=91=EB=90=9C=20=EC=82=AC=EC=9A=A9=EC=9E=90?= =?UTF-8?q?=EB=93=A4=20=EC=A0=95=EB=B3=B4=20List=20=ED=98=95=ED=83=9C?= =?UTF-8?q?=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../with_dankook/model/dto/list/SummarizedStudyDto.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/dto/list/SummarizedStudyDto.java b/src/main/java/com/dku/council/domain/with_dankook/model/dto/list/SummarizedStudyDto.java index d7e9a140..c00e17c8 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/dto/list/SummarizedStudyDto.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/dto/list/SummarizedStudyDto.java @@ -17,13 +17,13 @@ public class SummarizedStudyDto extends SummarizedWithDankookDto { private final String tag; @Schema(description = "모집된 인원", example = "1") - private final int recruited; + private final int recruitedCount; - public SummarizedStudyDto(SummarizedWithDankookDto dto, Study study, int recruited) { + public SummarizedStudyDto(SummarizedWithDankookDto dto, Study study, int recruitedCount) { super(dto); this.title = study.getTitle(); this.content = study.getContent(); this.tag = study.getTag().getName(); - this.recruited = recruited; + this.recruitedCount = recruitedCount; } } From 85b45f6a1302b3db823ba72199e7c4095f5d544c Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:38:59 +0900 Subject: [PATCH 07/15] =?UTF-8?q?remove:=20WithDankook=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20Dto=20=EC=97=90=EC=84=9C=20=EC=98=A4=ED=94=88?= =?UTF-8?q?=EC=B1=84=ED=8C=85=EB=B0=A9=20=EB=A7=81=ED=81=AC=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/dto/list/SummarizedWithDankookDto.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/dto/list/SummarizedWithDankookDto.java b/src/main/java/com/dku/council/domain/with_dankook/model/dto/list/SummarizedWithDankookDto.java index 2a308f7e..14777a6b 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/dto/list/SummarizedWithDankookDto.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/dto/list/SummarizedWithDankookDto.java @@ -18,9 +18,6 @@ public class SummarizedWithDankookDto { @Schema(description = "생성 날짜") private final LocalDateTime createdAt; - @Schema(description = "채팅 링크", example = "https://open.kakao.com/o/ghjgjgjg") - private final String chatLink; - @Schema(description = "게시글 타입", example = "TRADE") private final String type; @@ -28,7 +25,6 @@ public SummarizedWithDankookDto(int bodySize, WithDankook withDankook) { this.id = withDankook.getId(); this.author = withDankook.getDisplayingUsername(); this.createdAt = withDankook.getCreatedAt(); - this.chatLink = withDankook.getChatLink(); this.type = withDankook.getClass().getSimpleName().toUpperCase(); } @@ -36,7 +32,6 @@ public SummarizedWithDankookDto(SummarizedWithDankookDto copy) { this.id = copy.getId(); this.author = copy.getAuthor(); this.createdAt = copy.getCreatedAt(); - this.chatLink = copy.getChatLink(); this.type = copy.getType(); } } From 313f0b22e778a796bcabdbce95d3651968dc1147 Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:39:27 +0900 Subject: [PATCH 08/15] =?UTF-8?q?remove:=20WithDankook=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20Request=20dto=20=EC=97=90=EC=84=9C=20=EC=98=A4?= =?UTF-8?q?=ED=94=88=EC=B1=84=ED=8C=85=EB=B0=A9=20=EB=A7=81=ED=81=AC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/dto/request/RequestCreateStudyDto.java | 16 ++++++---------- .../model/dto/request/RequestCreateTradeDto.java | 8 +------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/dto/request/RequestCreateStudyDto.java b/src/main/java/com/dku/council/domain/with_dankook/model/dto/request/RequestCreateStudyDto.java index aa64956b..a5a6152b 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/dto/request/RequestCreateStudyDto.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/dto/request/RequestCreateStudyDto.java @@ -2,6 +2,7 @@ import com.dku.council.domain.user.model.entity.User; import com.dku.council.domain.with_dankook.model.entity.type.Study; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; @@ -20,11 +21,13 @@ public class RequestCreateStudyDto extends RequestCreateWithDankookDto { private final int minStudentId; @NotNull - @Schema(description = "스터디 시작 시간", example = "2023-12-25 17:30:00") + @JsonFormat(pattern = "yyyy-MM-dd HH:MM") + @Schema(description = "스터디 시작 시간", example = "2023-12-25 17:30") private final LocalDateTime startTime; @NotNull - @Schema(description = "스터디 끝나는 시간", example = "2023-12-25 18:30:00") + @JsonFormat(pattern = "yyyy-MM-dd HH:MM") + @Schema(description = "스터디 끝나는 시간", example = "2023-12-25 18:30") private final LocalDateTime endTime; @Schema(description = "해시태그", example = "자격증") @@ -34,24 +37,18 @@ public class RequestCreateStudyDto extends RequestCreateWithDankookDto { @Schema(description = "본문", example = "내용") private final String content; - @NotBlank - @Schema(description = "오픈채팅방 링크", example = "https://open.kakao.com/o/abc123") - private final String chatLink; - public RequestCreateStudyDto (@NotBlank String title, @NotBlank int minStudentId, @NotBlank LocalDateTime startTime, @NotBlank LocalDateTime endTime, String tag, - @NotBlank String content, - @NotBlank String chatLink) { + @NotBlank String content) { this.title = title; this.minStudentId = minStudentId; this.startTime = startTime; this.endTime = endTime; this.tag = tag; this.content = content; - this.chatLink = chatLink; } public Study toEntity(User user) { @@ -62,7 +59,6 @@ public Study toEntity(User user) { .endTime(endTime) .content(content) .user(user) - .chatLink(chatLink) .build(); } } diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/dto/request/RequestCreateTradeDto.java b/src/main/java/com/dku/council/domain/with_dankook/model/dto/request/RequestCreateTradeDto.java index 54429dd1..6eeeb0f2 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/dto/request/RequestCreateTradeDto.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/dto/request/RequestCreateTradeDto.java @@ -35,17 +35,12 @@ public class RequestCreateTradeDto extends RequestCreateWithDankookDto { @Schema(description = "이미지 파일 목록") private final List images; - @NotBlank - @Schema(description = "오픈채팅방 링크", example = "https://open.kakao.com/o/abc123") - private final String chatLink; - - public RequestCreateTradeDto(@NotBlank String title, @NotBlank int price, @NotBlank String content, @NotBlank String tradePlace, List images, @NotBlank String chatLink) { + public RequestCreateTradeDto(@NotBlank String title, @NotBlank int price, @NotBlank String content, @NotBlank String tradePlace, List images) { this.title = title; this.price = price; this.content = content; this.tradePlace = tradePlace; this.images = Objects.requireNonNullElseGet(images, ArrayList::new); - this.chatLink = chatLink; } public Trade toEntity(User user) { @@ -55,7 +50,6 @@ public Trade toEntity(User user) { .content(content) .tradePlace(tradePlace) .user(user) - .chatLink(chatLink) .build(); } } From 6b6df878057be6b73e12d0b7f2e4e1a4eebea53e Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:39:50 +0900 Subject: [PATCH 09/15] =?UTF-8?q?feat:=20WithDankook=EC=97=90=20=EC=8B=A0?= =?UTF-8?q?=EC=B2=AD=ED=95=9C=20=EC=82=AC=EC=9A=A9=EC=9E=90=EB=93=A4?= =?UTF-8?q?=EC=9D=98=20=EC=A0=95=EB=B3=B4=20Response=20Dto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/dto/RecruitedUsersDto.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/com/dku/council/domain/with_dankook/model/dto/RecruitedUsersDto.java diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/dto/RecruitedUsersDto.java b/src/main/java/com/dku/council/domain/with_dankook/model/dto/RecruitedUsersDto.java new file mode 100644 index 00000000..2df04afb --- /dev/null +++ b/src/main/java/com/dku/council/domain/with_dankook/model/dto/RecruitedUsersDto.java @@ -0,0 +1,24 @@ +package com.dku.council.domain.with_dankook.model.dto; + +import com.dku.council.domain.with_dankook.model.entity.WithDankookUser; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +@Getter +public class RecruitedUsersDto { + + @Schema(description = "닉네임", example = "닉네임") + private final String nickname; + + @Schema(description = "학과", example = "컴퓨터공학과") + private final String majorName; + + @Schema(description = "학번", example = "19") + private final String studentId; + + public RecruitedUsersDto(WithDankookUser user) { + this.nickname = user.getParticipant().getNickname(); + this.majorName = user.getParticipant().getMajor().getName(); + this.studentId = user.getParticipant().getStudentId(); + } +} From a81caff102ff94b2af6178aef97aa317a885463f Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:40:14 +0900 Subject: [PATCH 10/15] =?UTF-8?q?fix:=20=EB=8B=A8=ED=84=B0=EB=94=94=20?= =?UTF-8?q?=EB=8B=A8=EC=9D=BC=20=EC=A1=B0=ED=9A=8C=20dto=20=EB=AA=A8?= =?UTF-8?q?=EC=A7=91=EB=90=9C=20=EC=82=AC=EC=9A=A9=EC=9E=90=EB=93=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/ResponseSingleStudyDto.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleStudyDto.java b/src/main/java/com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleStudyDto.java index b54f7399..983e594f 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleStudyDto.java +++ b/src/main/java/com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleStudyDto.java @@ -1,10 +1,13 @@ package com.dku.council.domain.with_dankook.model.dto.response; +import com.dku.council.domain.with_dankook.model.dto.RecruitedUsersDto; import com.dku.council.domain.with_dankook.model.entity.type.Study; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; @Getter public class ResponseSingleStudyDto extends ResponseSingleWithDankookDto { @@ -28,9 +31,12 @@ public class ResponseSingleStudyDto extends ResponseSingleWithDankookDto { private final String content; @Schema(description = "모집된 인원", example = "1") - private final int recruited; + private final int recruitedCount; - public ResponseSingleStudyDto(ResponseSingleWithDankookDto dto, Study study, int recruited) { + @Schema(description = "모집된 사용자들") + private final List recruitedUsers; + + public ResponseSingleStudyDto(ResponseSingleWithDankookDto dto, Study study, int recruitedCount) { super(dto); this.title = study.getTitle(); this.minStudentId = study.getMinStudentId(); @@ -38,6 +44,9 @@ public ResponseSingleStudyDto(ResponseSingleWithDankookDto dto, Study study, int this.endTime = study.getEndTime(); this.content = study.getContent(); this.tag = study.getTag().getName(); - this.recruited = recruited; + this.recruitedCount = recruitedCount; + this.recruitedUsers = study.getUsers().stream() + .map(RecruitedUsersDto::new) + .collect(Collectors.toList()); } } From a3e263413b15bece99b04b02673f20347c835f9b Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:40:31 +0900 Subject: [PATCH 11/15] =?UTF-8?q?feat:=20WithDankook=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EA=B8=80=EC=97=90=20=EC=8B=A0=EC=B2=AD=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/WithDankookService.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/main/java/com/dku/council/domain/with_dankook/service/WithDankookService.java b/src/main/java/com/dku/council/domain/with_dankook/service/WithDankookService.java index 356ed3a9..fae9b0ce 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/service/WithDankookService.java +++ b/src/main/java/com/dku/council/domain/with_dankook/service/WithDankookService.java @@ -3,15 +3,21 @@ import com.dku.council.domain.like.model.LikeTarget; import com.dku.council.domain.like.service.LikeService; import com.dku.council.domain.post.exception.PostNotFoundException; +import com.dku.council.domain.user.model.entity.User; import com.dku.council.domain.user.repository.UserRepository; +import com.dku.council.domain.with_dankook.exception.AlreadyEnteredException; +import com.dku.council.domain.with_dankook.exception.AlreadyFullRecruitedException; import com.dku.council.domain.with_dankook.exception.WithDankookNotFoundException; import com.dku.council.domain.with_dankook.model.dto.list.SummarizedWithDankookDto; import com.dku.council.domain.with_dankook.model.dto.response.ResponseSingleWithDankookDto; import com.dku.council.domain.with_dankook.model.entity.WithDankook; +import com.dku.council.domain.with_dankook.model.entity.WithDankookUser; import com.dku.council.domain.with_dankook.repository.WithDankookRepository; +import com.dku.council.domain.with_dankook.repository.WithDankookUserRepository; import com.dku.council.domain.with_dankook.repository.spec.WithDankookSpec; import com.dku.council.global.auth.role.UserRole; import com.dku.council.global.error.exception.NotGrantedException; +import com.dku.council.global.error.exception.UserNotFoundException; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -27,8 +33,10 @@ public class WithDankookService { protected final UserRepository userRepository; + protected final WithDankookUserRepository withDankookUserRepository; protected final LikeService likeService; + protected final WithDankookUserService withDankookUserService; /** * With-Dankook 게시판 글 목록 조회 @@ -124,6 +132,30 @@ private E findWithDankook(WithDankookRepository repository, Long withDankookI return withDankook.orElseThrow(WithDankookNotFoundException::new); } + /** + * With-Dankook 게시판 글에 참여를 신청합니다. + * + * @param withDankookId 게시글 id + * @param userId 사용자 id + */ + @Transactional + public void enter(WithDankookRepository repository, Long withDankookId, Long userId, UserRole role) { + E withDankook = findWithDankook(repository, withDankookId, role); + + User user = userRepository.findById(userId).orElseThrow(UserNotFoundException::new); + + if (withDankookUserService.isParticipant(withDankookId, user.getId())) { + throw new AlreadyEnteredException(); + } else if (withDankookUserService.recruitedCount(withDankook.getId()) >= 4){ + throw new AlreadyFullRecruitedException(); + } else { + WithDankookUser withDankookUser = WithDankookUser.builder() + .user(user) + .withDankook(withDankook) + .build(); + withDankookUserRepository.save(withDankookUser); + } + } /** * With-Dankook 게시판 글 삭제. 실제 DB에서 삭제는 하지 않는다. * From 57d777119c7919f1db978e49e670bec0131b2b35 Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:40:45 +0900 Subject: [PATCH 12/15] =?UTF-8?q?feat:=20WithDankook=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=ED=8C=90=EC=97=90=20=EC=9D=B4=EB=AF=B8=20=EC=B0=B8=EC=97=AC?= =?UTF-8?q?=ED=95=9C=20=EC=82=AC=EC=9A=A9=EC=9E=90=EC=9D=B8=EC=A7=80=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/WithDankookUserService.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/dku/council/domain/with_dankook/service/WithDankookUserService.java b/src/main/java/com/dku/council/domain/with_dankook/service/WithDankookUserService.java index 1c98ee28..c1bb3ace 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/service/WithDankookUserService.java +++ b/src/main/java/com/dku/council/domain/with_dankook/service/WithDankookUserService.java @@ -1,10 +1,14 @@ package com.dku.council.domain.with_dankook.service; +import com.dku.council.domain.with_dankook.model.entity.WithDankookUser; import com.dku.council.domain.with_dankook.repository.WithDankookUserRepository; +import com.dku.council.global.error.exception.UserNotFoundException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import java.util.Optional; + @Service @RequiredArgsConstructor @Slf4j @@ -20,4 +24,15 @@ public class WithDankookUserService { public int recruitedCount(Long withDankookId) { return withDankookUserRepository.findRecruitedById(withDankookId); } + + /** + * With-Dankook 게시판에 참여한 유저인지 확인합니다. + * + * @param withDankookId 게시글 id + * @param userId 유저 id + * @return 참여한 유저인지 여부 + */ + public boolean isParticipant(Long withDankookId, Long userId) { + return withDankookUserRepository.isExistsByWithDankookIdAndUserId(withDankookId, userId).isPresent(); + } } From 59193a67cc46771639a0bf90966fc932d8b0556e Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:41:10 +0900 Subject: [PATCH 13/15] =?UTF-8?q?fix:=20toEntity=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=98=A4=ED=94=88=EC=B1=84=ED=8C=85=EB=B0=A9=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20=EB=B0=8F=20=EB=8B=A8=ED=84=B0=EB=94=94=20=EC=8B=A0?= =?UTF-8?q?=EC=B2=AD=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../with_dankook/service/StudyService.java | 26 ++++++++++++++++++- .../with_dankook/service/TradeService.java | 1 - 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/dku/council/domain/with_dankook/service/StudyService.java b/src/main/java/com/dku/council/domain/with_dankook/service/StudyService.java index ba6a925e..2cde7000 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/service/StudyService.java +++ b/src/main/java/com/dku/council/domain/with_dankook/service/StudyService.java @@ -4,8 +4,11 @@ import com.dku.council.domain.studytag.repository.StudyTagRepository; import com.dku.council.domain.user.model.entity.User; import com.dku.council.domain.user.repository.UserRepository; +import com.dku.council.domain.with_dankook.exception.InvalidMinStudentIdException; +import com.dku.council.domain.with_dankook.exception.InvalidStatusException; import com.dku.council.domain.with_dankook.exception.StudyCooltimeException; import com.dku.council.domain.with_dankook.exception.WithDankookNotFoundException; +import com.dku.council.domain.with_dankook.model.ParticipantStatus; import com.dku.council.domain.with_dankook.model.dto.list.SummarizedStudyDto; import com.dku.council.domain.with_dankook.model.dto.request.RequestCreateStudyDto; import com.dku.council.domain.with_dankook.model.dto.response.ResponseSingleStudyDto; @@ -71,7 +74,6 @@ public Long create(Long userId, RequestCreateStudyDto dto) { .endTime(dto.getEndTime()) .tag(studyTag) .content(dto.getContent()) - .chatLink(dto.getChatLink()) .build(); Long result = studyRepository.save(study).getId(); @@ -147,6 +149,28 @@ private Study findStudy(StudyRepository studyRepository, Long studyId, UserRole return study.orElseThrow(WithDankookNotFoundException::new); } + @Transactional + public void enter(Long id, Long userId, UserRole userRole) { + Study study = findStudy(studyRepository, id, userRole); + User user = userRepository.findById(userId).orElseThrow(UserNotFoundException::new); + + boolean isValid = isInvalidParticipant(study, user); + if (study.getMinStudentId() < Integer.parseInt(String.valueOf(user.getYearOfAdmission()).substring(2))) { + throw new InvalidMinStudentIdException(); + } else if(isValid) { + throw new InvalidStatusException(); + } else{ + withDankookService.enter(studyRepository, id, userId, userRole); + } + } + + private boolean isInvalidParticipant(Study study, User user) { + return study.getUsers().stream().anyMatch( + withDankookUser -> withDankookUser.getParticipant().getId().equals(user.getId()) && + withDankookUser.getParticipantStatus().equals(ParticipantStatus.INVALID) + ); + } + @Transactional public void delete(Long studyId, Long userId, boolean isAdmin) { withDankookService.delete(studyRepository, studyId, userId, isAdmin); diff --git a/src/main/java/com/dku/council/domain/with_dankook/service/TradeService.java b/src/main/java/com/dku/council/domain/with_dankook/service/TradeService.java index 511c6a08..962e7eea 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/service/TradeService.java +++ b/src/main/java/com/dku/council/domain/with_dankook/service/TradeService.java @@ -79,7 +79,6 @@ public Long create(Long userId, RequestCreateTradeDto dto) { .price(dto.getPrice()) .content(dto.getContent()) .tradePlace(dto.getTradePlace()) - .chatLink(dto.getChatLink()) .build(); attachImages(trade, dto.getImages()); From 63b0995d064850520e0e0cd7c36f3779ac4e48cc Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:41:20 +0900 Subject: [PATCH 14/15] =?UTF-8?q?feat:=20Error=20=EB=A9=94=EC=84=B8?= =?UTF-8?q?=EC=A7=80=20=ED=94=84=EB=A1=9C=ED=8D=BC=ED=8B=B0=EC=97=90=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/errors.properties | 4 ++++ src/main/resources/errors_en_US.properties | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/main/resources/errors.properties b/src/main/resources/errors.properties index 71c8f119..88fb1711 100644 --- a/src/main/resources/errors.properties +++ b/src/main/resources/errors.properties @@ -46,6 +46,8 @@ invalid.only-jukjeon=\uC8FD\uC804 \uCEA0\uD37C\uC2A4 \uC18C\uC18D\uB9CC \uC2E0\u invalid.ticket-approval = \uC2B9\uC778\uD560 \uC218 \uC5C6\uB294 \uD2F0\uCF13\uC785\uB2C8\uB2E4. invalid.dku-auth.refresh=\uB2E8\uAD6D\uB300 \uC778\uC99D\uC774 \uAC31\uC2E0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. invalid.imagesize=\uC774\uBBF8\uC9C0 \uAC1C\uC218\uAC00 \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4. +invalid.student-id=\uCD5C\uC18C \uD559\uBC88\uC5D0 \uD574\uB2F9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. +invalid.status=\uCC38\uC5EC\uAC00 \uBD88\uAC00\uB2A5\uD569\uB2C8\uB2E4. notfound.user=\uC720\uC800\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. notfound.post=\uD574\uB2F9 \uAC8C\uC2DC\uAE00\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. @@ -77,6 +79,8 @@ already.reported=\uC774\uBBF8 \uC2E0\uACE0\uD55C \uAC8C\uC2DC\uAE00\uC785\uB2C8\ already.issued-ticket=\uC774\uBBF8 \uC2E0\uCCAD\uD588\uC2B5\uB2C8\uB2E4. already.homebus-issued=\uC774\uBBF8 \uADC0\uD5A5\uBC84\uC2A4\uB97C \uC2E0\uCCAD\uD588\uC2B5\uB2C8\uB2E4. already.homebus-cancel=\uC774\uBBF8 \uCDE8\uC18C\uB97C \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4. +already.full-recruited=\uC774\uBBF8 \uC2E0\uCCAD\uC790\uAC00 \uB2E4 \uCC2C \uC0C1\uD0DC\uC785\uB2C8\uB2E4. +already.entered=\uC774\uBBF8 \uC2E0\uCCAD\uB41C \uC0C1\uD0DC\uC785\uB2C8\uB2E4. cooltime.petition=\uCCAD\uC6D0\uC744 \uC62C\uB9B0 \uB4A4\uB85C 1\uC77C\uC774 \uC9C0\uB098\uC57C \uB2E4\uC2DC \uAC8C\uC2DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. cooltime.general-forum=\uAC8C\uC2DC\uAE00\uC744 \uC62C\uB9B0 \uB4A4\uB85C 3\uBD84\uC774 \uC9C0\uB098\uC57C \uB2E4\uC2DC \uAC8C\uC2DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. diff --git a/src/main/resources/errors_en_US.properties b/src/main/resources/errors_en_US.properties index 5fedb82e..c3cfb505 100644 --- a/src/main/resources/errors_en_US.properties +++ b/src/main/resources/errors_en_US.properties @@ -46,6 +46,9 @@ invalid.only-jukjeon=Only those belonging to Jukjeon Campus can apply. invalid.ticket-approval = Invalid ticket approval. invalid.dku-auth.refresh=Dankook University Certification has not been renewed. invalid.imagesize=The number of images has exceeded the limit. +invalid.student-id=It does not correspond to the minimum number of students. +invalid.status=You can't enter because of your status. + notfound.user=Cannot find that user. notfound.post=No such post was found. @@ -78,6 +81,8 @@ already.reported=You have already reported this post. already.issued-ticket=You have already issued a ticket. already.homebus-issued=You have already issued a homebus ticket. already.homebus-cancel=You have already requested canceling a homebus ticket. +already.full-recruited=The recruitment is already full. +already.entered=You have already entered. cooltime.petition=You can't post again until one day after posting the petition. cooltime.general-forum=You can't post again until 3 minutes after posting. From 7c7106333bf37b7d1e44de91443c46ed864aaf22 Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Tue, 26 Dec 2023 15:41:48 +0900 Subject: [PATCH 15/15] =?UTF-8?q?feat:=20=EB=8B=A8=ED=84=B0=EB=94=94=20?= =?UTF-8?q?=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=EC=97=90=20=EC=8B=A0?= =?UTF-8?q?=EC=B2=AD=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../with_dankook/controller/StudyController.java | 11 +++++++++++ .../with_dankook/controller/TradeController.java | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/dku/council/domain/with_dankook/controller/StudyController.java b/src/main/java/com/dku/council/domain/with_dankook/controller/StudyController.java index c34f9d74..4c34327f 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/controller/StudyController.java +++ b/src/main/java/com/dku/council/domain/with_dankook/controller/StudyController.java @@ -93,6 +93,17 @@ public ResponseIdDto create(AppAuthentication auth, return new ResponseIdDto(id); } + /** + * 단터디 게시글 신청 + * + * @param id 게시글 id + */ + @PostMapping("/{id}/enter") + @UserAuth + public void enter(AppAuthentication auth, @PathVariable @Valid Long id) { + studyService.enter(id, auth.getUserId(), auth.getUserRole()); + } + /** * 단터디 게시글 삭제 * diff --git a/src/main/java/com/dku/council/domain/with_dankook/controller/TradeController.java b/src/main/java/com/dku/council/domain/with_dankook/controller/TradeController.java index c1f8f20d..82165dc6 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/controller/TradeController.java +++ b/src/main/java/com/dku/council/domain/with_dankook/controller/TradeController.java @@ -3,13 +3,10 @@ import com.dku.council.domain.like.model.LikeTarget; import com.dku.council.domain.like.service.LikeService; import com.dku.council.domain.post.model.dto.response.ResponsePage; -import com.dku.council.domain.with_dankook.model.WithDankookStatus; import com.dku.council.domain.with_dankook.model.dto.list.SummarizedTradeDto; import com.dku.council.domain.with_dankook.model.dto.request.RequestCreateTradeDto; import com.dku.council.domain.with_dankook.model.dto.response.ResponseSingleTradeDto; -import com.dku.council.domain.with_dankook.model.entity.type.Trade; import com.dku.council.domain.with_dankook.service.TradeService; -import com.dku.council.domain.with_dankook.service.WithDankookService; import com.dku.council.global.auth.jwt.AppAuthentication; import com.dku.council.global.auth.role.UserAuth; import com.dku.council.global.model.dto.ResponseIdDto; @@ -22,7 +19,6 @@ import org.springframework.web.bind.annotation.*; import javax.validation.Valid; -import javax.validation.constraints.NotNull; @Tag(name = "단국 거래 게시판", description = "단국 거래 게시판 API") @RestController