-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from WE-ARE-RACCOONS/RAC-99
Rac 99
- Loading branch information
Showing
18 changed files
with
264 additions
and
31 deletions.
There are no files selected for viewing
7 changes: 3 additions & 4 deletions
7
...ation/dto/req/MentoringStatusRequest.java → ...ication/dto/req/MentoringDateRequest.java
This file contains 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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package com.postgraduate.domain.mentoring.application.dto.req; | ||
|
||
import com.postgraduate.domain.mentoring.domain.entity.constant.Status; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class MentoringStatusRequest { | ||
@AllArgsConstructor | ||
public class MentoringDateRequest { | ||
@NotNull | ||
private Status status; | ||
private String date; | ||
} |
14 changes: 14 additions & 0 deletions
14
...in/java/com/postgraduate/domain/mentoring/application/dto/req/MentoringRefuseRequest.java
This file contains 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,14 @@ | ||
package com.postgraduate.domain.mentoring.application.dto.req; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class MentoringRefuseRequest { | ||
@NotNull | ||
private String refuse; | ||
} |
15 changes: 15 additions & 0 deletions
15
.../com/postgraduate/domain/mentoring/application/dto/res/SeniorMentoringDetailResponse.java
This file contains 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,15 @@ | ||
package com.postgraduate.domain.mentoring.application.dto.res; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
@Getter | ||
public class SeniorMentoringDetailResponse { | ||
private String nickName; | ||
private String topic; | ||
private String question; | ||
private String[] dates; | ||
} |
15 changes: 15 additions & 0 deletions
15
...n/java/com/postgraduate/domain/mentoring/application/dto/res/SeniorMentoringResponse.java
This file contains 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,15 @@ | ||
package com.postgraduate.domain.mentoring.application.dto.res; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
@Getter | ||
public class SeniorMentoringResponse { | ||
private Long mentoringId; | ||
private String nickname; | ||
private String[] dates; | ||
private int term; | ||
} |
This file contains 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 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 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
38 changes: 29 additions & 9 deletions
38
...in/java/com/postgraduate/domain/mentoring/application/usecase/MentoringManageUseCase.java
This file contains 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 |
---|---|---|
@@ -1,26 +1,46 @@ | ||
package com.postgraduate.domain.mentoring.application.usecase; | ||
|
||
import com.postgraduate.domain.mentoring.application.dto.req.MentoringStatusRequest; | ||
import com.postgraduate.domain.mentoring.application.dto.req.MentoringDateRequest; | ||
import com.postgraduate.domain.mentoring.application.dto.req.MentoringRefuseRequest; | ||
import com.postgraduate.domain.mentoring.domain.entity.Mentoring; | ||
import com.postgraduate.domain.mentoring.domain.entity.constant.Status; | ||
import com.postgraduate.domain.mentoring.domain.service.MentoringUpdateService; | ||
import com.postgraduate.domain.user.domain.entity.User; | ||
import com.postgraduate.domain.mentoring.exception.MentoringNotWaitingException; | ||
import com.postgraduate.global.auth.AuthDetails; | ||
import com.postgraduate.global.config.security.util.SecurityUtils; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import static com.postgraduate.domain.mentoring.domain.entity.constant.Status.WAITING; | ||
|
||
@Service | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class MentoringManageUseCase { | ||
private final SecurityUtils securityUtils; | ||
private final MentoringUpdateService mentoringUpdateService; | ||
private final CheckIsMyMentoringUseCase checkIsMyMentoringUseCase; | ||
private final MentoringUpdateService mentoringUpdateService; | ||
|
||
public void updateStatus(AuthDetails authDetails, Long mentoringId, Status status) { | ||
Mentoring mentoring = checkIsMyMentoringUseCase.byUser(authDetails, mentoringId); | ||
mentoringUpdateService.updateStatus(mentoring, status); | ||
} | ||
|
||
public void updateSeniorStatus(AuthDetails authDetails, Long mentoringId, Status status) { | ||
Mentoring mentoring = checkIsMyMentoringUseCase.bySenior(authDetails, mentoringId); | ||
mentoringUpdateService.updateStatus(mentoring, status); | ||
} | ||
|
||
public void updateRefuse(AuthDetails authDetails, Long mentoringId, MentoringRefuseRequest request, Status status) { | ||
Mentoring mentoring = checkIsMyMentoringUseCase.bySenior(authDetails, mentoringId); | ||
mentoringUpdateService.updateRefuse(mentoring, request.getRefuse()); | ||
mentoringUpdateService.updateStatus(mentoring, status); | ||
} | ||
|
||
public void updateStatus(AuthDetails authDetails, Long mentoringId, MentoringStatusRequest request) { | ||
User user = securityUtils.getLoggedInUser(authDetails); | ||
Mentoring mentoring = checkIsMyMentoringUseCase.checkByRole(user, mentoringId); | ||
mentoringUpdateService.updateStatus(mentoring, request.getStatus()); | ||
public void updateDate(AuthDetails authDetails, Long mentoringId, MentoringDateRequest request) { | ||
Mentoring mentoring = checkIsMyMentoringUseCase.bySenior(authDetails, mentoringId); | ||
if (mentoring.getStatus() != WAITING) { | ||
throw new MentoringNotWaitingException(); | ||
} | ||
mentoringUpdateService.updateDate(mentoring, request.getDate()); | ||
} | ||
} |
This file contains 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 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 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 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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/postgraduate/domain/mentoring/exception/MentoringDoneException.java
This file contains 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,12 @@ | ||
package com.postgraduate.domain.mentoring.exception; | ||
|
||
import static com.postgraduate.domain.mentoring.presentation.constant.MentoringResponseCode.MENTORING_DONE; | ||
import static com.postgraduate.domain.mentoring.presentation.constant.MentoringResponseMessage.DONE_MENTORING; | ||
|
||
|
||
public class MentoringDoneException extends MentoringException { | ||
|
||
public MentoringDoneException() { | ||
super(DONE_MENTORING.getMessage(), MENTORING_DONE.getCode()); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/postgraduate/domain/mentoring/exception/MentoringNotWaitingException.java
This file contains 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,12 @@ | ||
package com.postgraduate.domain.mentoring.exception; | ||
|
||
import static com.postgraduate.domain.mentoring.presentation.constant.MentoringResponseCode.MENTORING_NOT_WAITING; | ||
import static com.postgraduate.domain.mentoring.presentation.constant.MentoringResponseMessage.NOT_WAITING_MENTORING; | ||
|
||
|
||
public class MentoringNotWaitingException extends MentoringException { | ||
|
||
public MentoringNotWaitingException() { | ||
super(NOT_WAITING_MENTORING.getMessage(), MENTORING_NOT_WAITING.getCode()); | ||
} | ||
} |
Oops, something went wrong.