-
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.
Browse files
Browse the repository at this point in the history
Feat/#29/매칭 취소,매칭 성공 로직 완성
- Loading branch information
Showing
43 changed files
with
988 additions
and
276 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -37,3 +37,5 @@ out/ | |
.vscode/ | ||
|
||
src/main/resources/.env | ||
|
||
docker-compose.yml |
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/gachtaxi/domain/matching/aop/SseSubscribeRequired.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.gachtaxi.domain.matching.aop; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface SseSubscribeRequired { | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/com/gachtaxi/domain/matching/aop/SseSubscribeRequiredAop.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,52 @@ | ||
package com.gachtaxi.domain.matching.aop; | ||
|
||
import com.gachtaxi.domain.matching.common.controller.ResponseMessage; | ||
import com.gachtaxi.domain.matching.common.exception.ControllerNotHasCurrentMemberIdException; | ||
import com.gachtaxi.domain.matching.common.service.AutoMatchingService; | ||
import com.gachtaxi.global.auth.jwt.annotation.CurrentMemberId; | ||
import com.gachtaxi.global.common.response.ApiResponse; | ||
import java.lang.reflect.Parameter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
import org.aspectj.lang.reflect.MethodSignature; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Aspect | ||
@Component | ||
@RequiredArgsConstructor | ||
public class SseSubscribeRequiredAop { | ||
|
||
private final AutoMatchingService autoMatchingService; | ||
|
||
@Around("@annotation(com.gachtaxi.domain.matching.aop.SseSubscribeRequired)") | ||
public Object checkSseSubscribe(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{ | ||
Long memberId = null; | ||
MethodSignature signature = (MethodSignature) proceedingJoinPoint.getSignature(); | ||
Parameter[] parameters = signature.getMethod().getParameters(); | ||
|
||
for (int i = 0; i < parameters.length; i++) { | ||
Parameter parameter = parameters[i]; | ||
if (parameter.getType().equals(Long.class) && parameter.isAnnotationPresent( | ||
CurrentMemberId.class)) { | ||
memberId = (Long) proceedingJoinPoint.getArgs()[i]; | ||
break; | ||
} | ||
} | ||
|
||
if (memberId == null) { | ||
throw new ControllerNotHasCurrentMemberIdException(); | ||
} | ||
|
||
if (!this.autoMatchingService.isSseSubscribed(memberId)) { | ||
return ApiResponse.response( | ||
HttpStatus.BAD_REQUEST, | ||
ResponseMessage.NOT_SUBSCRIBED_SSE.getMessage() | ||
); | ||
} | ||
|
||
return proceedingJoinPoint.proceed(); | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
...in/java/com/gachtaxi/domain/matching/common/dto/request/AutoMatchingCancelledRequest.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,7 @@ | ||
package com.gachtaxi.domain.matching.common.dto.request; | ||
|
||
public record AutoMatchingCancelledRequest( | ||
Long roomId | ||
) { | ||
|
||
} |
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
1 change: 1 addition & 0 deletions
1
src/main/java/com/gachtaxi/domain/matching/common/entity/Route.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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/gachtaxi/domain/matching/common/entity/enums/MatchingRoomStatus.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,5 +1,5 @@ | ||
package com.gachtaxi.domain.matching.common.entity.enums; | ||
|
||
public enum MatchingRoomStatus { | ||
PROCESS, COMPLETE, CANCELED, ACTIVE | ||
COMPLETE, CANCELLED, ACTIVE | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/com/gachtaxi/domain/matching/common/entity/enums/PaymentStatus.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,5 +1,5 @@ | ||
package com.gachtaxi.domain.matching.common.entity.enums; | ||
|
||
public enum PaymentStatus { | ||
PAYED, NOT_PAYED, FAILED | ||
PAYED, NOT_PAYED, FAILED, LEFT | ||
} |
13 changes: 13 additions & 0 deletions
13
...m/gachtaxi/domain/matching/common/exception/ControllerNotHasCurrentMemberIdException.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,13 @@ | ||
package com.gachtaxi.domain.matching.common.exception; | ||
|
||
import static com.gachtaxi.domain.matching.common.exception.ErrorMessage.CONTROLLER_NOT_HAS_CURRENT_MEMBER_ID; | ||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; | ||
|
||
import com.gachtaxi.global.common.exception.BaseException; | ||
|
||
public class ControllerNotHasCurrentMemberIdException extends BaseException { | ||
|
||
public ControllerNotHasCurrentMemberIdException() { | ||
super(INTERNAL_SERVER_ERROR, CONTROLLER_NOT_HAS_CURRENT_MEMBER_ID.getMessage()); | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
...main/java/com/gachtaxi/domain/matching/common/exception/MemberAlreadyJoinedException.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,13 @@ | ||
package com.gachtaxi.domain.matching.common.exception; | ||
|
||
import static com.gachtaxi.domain.matching.common.exception.ErrorMessage.MEMBER_ALREADY_JOINED_MATCHING_ROOM; | ||
import static org.springframework.http.HttpStatus.CONFLICT; | ||
|
||
import com.gachtaxi.global.common.exception.BaseException; | ||
|
||
public class MemberAlreadyJoinedException extends BaseException { | ||
|
||
public MemberAlreadyJoinedException() { | ||
super(CONFLICT, MEMBER_ALREADY_JOINED_MATCHING_ROOM.getMessage()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...com/gachtaxi/domain/matching/common/exception/MemberAlreadyLeftMatchingRoomException.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,13 @@ | ||
package com.gachtaxi.domain.matching.common.exception; | ||
|
||
import static com.gachtaxi.domain.matching.common.exception.ErrorMessage.MEMBER_ALREADY_LEFT_MATCHING_ROOM; | ||
import static org.springframework.http.HttpStatus.CONFLICT; | ||
|
||
import com.gachtaxi.global.common.exception.BaseException; | ||
|
||
public class MemberAlreadyLeftMatchingRoomException extends BaseException { | ||
|
||
public MemberAlreadyLeftMatchingRoomException() { | ||
super(CONFLICT, MEMBER_ALREADY_LEFT_MATCHING_ROOM.getMessage()); | ||
} | ||
} |
Oops, something went wrong.