Skip to content

Commit

Permalink
Merge pull request #67 from AmorGakCo/fix/#66
Browse files Browse the repository at this point in the history
fix/#66
  • Loading branch information
songhaechan authored Oct 29, 2024
2 parents 22c7f20 + 8f40ff6 commit b9967ea
Show file tree
Hide file tree
Showing 50 changed files with 643 additions and 1,961 deletions.
928 changes: 97 additions & 831 deletions docs/index.html

Large diffs are not rendered by default.

928 changes: 97 additions & 831 deletions main/main/src/main/resources/static/docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endif::[]

include::group.adoc[]

include::groupParticipation.adoc[]
include::groupApplication.adoc[]

include::participant.adoc[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public SecurityFilterChain securityFilterChain(final HttpSecurity http) throws E
request.requestMatchers(
"/tokens/**",
"/oauth2/**",
"/groups/locations",
"/groups/detail/**",
"/groups/basic/**",
"/groups/locations",
"/members/login",
"/favicon.ico",
"/error")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.amorgakco.backend.global.exception;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class DuplicatedRequestException extends IllegalStateException{

private final ErrorCode errorCode;

public static DuplicatedRequestException duplicatedParticipant() {
return new DuplicatedRequestException(ErrorCode.PARTICIPANT_DUPLICATED);
}

public static DuplicatedRequestException duplicatedGroupApplication() {
return new DuplicatedRequestException(ErrorCode.GROUP_APPLICATION_DUPLICATED);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public enum ErrorCode {
MEMBER_NOT_FOUND("201", "존재하지 않는 회원입니다."),
DASH_NOT_ALLOWED("202", "전화번호에 '-'를 포함할 수 없습니다."),
INVALID_GITHUB_URL("203", "부적절한 github 주소입니다."),
CAN_NOT_EXCEED_POSITIVE_100("204", "모각코 온도는 100도를 넘을 수 없습니다."),
CAN_NOT_UNDER_NEGATIVE_100("204", "모각코 온도는 -100도 보다 낮을 수 없습니다."),
EXCEED_MAX_TEMPERATURE("204", "모각코 온도는 100도를 넘을 수 없습니다."),
UNDER_MIN_TEMPERATURE("204", "모각코 온도는 -100도 보다 낮을 수 없습니다."),


// Group Error Code
Expand All @@ -42,7 +42,9 @@ public enum ErrorCode {
EXCEED_GROUP_CAPACITY("311", "그룹 수용 인원을 초과합니다."),
PARTICIPATION_NOT_FOUND("312", "참여 요청을 조회할 수 없습니다."),
INVALID_DIAGONAL_DISTANCE("313", "잘못된 그룹 검색 요청입니다. 위도 경도를 확인해주세요."),
NOT_SAME_GROUP_PARTICIPANT("314", "동일한 그룹 내의 참여자끼리 온도를 변경할 수 있습니다.");
NOT_SAME_GROUP_PARTICIPANT("314", "동일한 그룹 내의 참여자끼리 온도를 변경할 수 있습니다."),
EXCEED_PARTICIPATION_LIMIT("315","활동중인 모각코는 5개를 넘을 수 없습니다."),
GROUP_APPLICATION_DUPLICATED("316","중복된 참여 요청입니다");

private final String code;
private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public ErrorResponse accessDenied(final AccessDeniedException e) {
return new ErrorResponse(e.getMessage());
}

@ExceptionHandler(IllegalAccessException.class)
@ExceptionHandler(GroupAuthorityException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorResponse illegalAccess(final IllegalAccessException e) {
public ErrorResponse invalidGroupAuthority(final GroupAuthorityException e) {
setCustomExceptionLog(e.getErrorCode());
return new ErrorResponse(e.getErrorCode());
}
Expand All @@ -59,7 +59,7 @@ private void setCustomExceptionLog(final ErrorCode errorCode) {

@ExceptionHandler(RetryFailedException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorResponse illegalAccess(final RetryFailedException e) {
public ErrorResponse retryFailed(final RetryFailedException e) {
setCustomExceptionLog(e.getErrorCode());
return new ErrorResponse(e.getErrorCode());
}
Expand All @@ -85,10 +85,52 @@ public ErrorResponse jwtAuthentication(final JwtAuthenticationException e) {
return new ErrorResponse(e.getErrorCode());
}

@ExceptionHandler(ParticipantException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorResponse participantException(final ParticipantException e) {
setCustomExceptionLog(e.getErrorCode());
return new ErrorResponse(e.getErrorCode());
}

@ExceptionHandler(MemberTemperatureException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorResponse invalidMemberTemperature(final MemberTemperatureException e) {
setCustomExceptionLog(e.getErrorCode());
return new ErrorResponse(e.getErrorCode());
}

@ExceptionHandler(InvalidOauth2ProviderException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorResponse invalidOauth2Provider(final InvalidOauth2ProviderException e) {
setCustomExceptionLog(e.getErrorCode());
return new ErrorResponse(e.getErrorCode());
}

@ExceptionHandler(LocationVerificationException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorResponse invalidLocationVerification(final LocationVerificationException e) {
setCustomExceptionLog(e.getErrorCode());
return new ErrorResponse(e.getErrorCode());
}

@ExceptionHandler(GroupSearchException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorResponse invalidGroupSearch(final GroupSearchException e) {
setCustomExceptionLog(e.getErrorCode());
return new ErrorResponse(e.getErrorCode());
}

@ExceptionHandler(GroupCapacityException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorResponse invalidGroupCapacity(final GroupCapacityException e) {
setCustomExceptionLog(e.getErrorCode());
return new ErrorResponse(e.getErrorCode());
}

@ExceptionHandler(DuplicatedRequestException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorResponse duplicatedRequest(final DuplicatedRequestException e) {
setCustomExceptionLog(e.getErrorCode());
return new ErrorResponse(e.getErrorCode());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.amorgakco.backend.global.exception;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class GroupAuthorityException extends IllegalStateException {
private final ErrorCode errorCode;

public static GroupAuthorityException noAuthorityForGroup() {
return new GroupAuthorityException(ErrorCode.NO_AUTHORITY_FOR_GROUP);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.amorgakco.backend.global.exception;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class GroupCapacityException extends IllegalStateException {
private final ErrorCode errorCode;

public static GroupCapacityException exceedGroupCapacity() {
return new GroupCapacityException(ErrorCode.EXCEED_GROUP_CAPACITY);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.amorgakco.backend.global.exception;


import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class GroupSearchException extends IllegalArgumentException {

private final ErrorCode errorCode;

public static GroupSearchException invalidDiagonalDistance() {
return new GroupSearchException(ErrorCode.INVALID_DIAGONAL_DISTANCE);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static JwtAuthenticationException loginAgain() {
return new JwtAuthenticationException(ErrorCode.LOGIN_AGAIN);
}

public static JwtAuthenticationException accessTokenNotFound() {
return new JwtAuthenticationException(ErrorCode.ACCESS_TOKEN_NOT_FOUND);
public static JwtAuthenticationException refreshTokenRequired() {
return new JwtAuthenticationException(ErrorCode.REFRESH_TOKEN_REQUIRED);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.amorgakco.backend.global.exception;


import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class LocationVerificationException extends IllegalStateException{

private final ErrorCode errorCode;

public static LocationVerificationException verificationFailed() {
return new LocationVerificationException(ErrorCode.VERIFICATION_FAILED);
}

public static LocationVerificationException verificationDuplicated() {
return new LocationVerificationException(ErrorCode.VERIFICATION_DUPLICATED);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.amorgakco.backend.global.exception;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class MemberTemperatureException extends IllegalStateException{

private final ErrorCode errorCode;

public static MemberTemperatureException exceedMaxTemperature() {
return new MemberTemperatureException(ErrorCode.EXCEED_MAX_TEMPERATURE);
}

public static MemberTemperatureException underMinTemperature() {
return new MemberTemperatureException(ErrorCode.UNDER_MIN_TEMPERATURE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.amorgakco.backend.global.exception;


import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class ParticipantException extends IllegalStateException {

private final ErrorCode errorCode;

public static ParticipantException exceedParticipationLimit() {
return new ParticipantException(ErrorCode.EXCEED_PARTICIPATION_LIMIT);
}

public static ParticipantException notSameGroupParticipant() {
return new ParticipantException(ErrorCode.NOT_SAME_GROUP_PARTICIPANT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@ public IdResponse register(
return groupService.register(groupRegisterRequest, host);
}

@GetMapping("/basic/{groupId}")
public GroupBasicResponse getGroupBasic(@PathVariable final Long groupId) {
return groupService.getBasicGroup(groupId);
@GetMapping("/{groupId}/basic")
public GroupBasicResponse getGroupBasic(
@PathVariable final Long groupId, @AuthMember final Member member) {
return groupService.getBasicGroup(groupId,member);
}

@GetMapping("/detail/{groupId}")
public GroupDetailResponse getGroupDetail(@PathVariable final Long groupId) {
return groupService.getDetailGroup(groupId);
@GetMapping("/{groupId}/detail")
public GroupDetailResponse getGroupDetail(@PathVariable final Long groupId, @AuthMemberId final Long memberId) {
return groupService.getDetailGroup(groupId,memberId);
}

@DeleteMapping("/{groupId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@AuthMemberId final Long hostId, @PathVariable final Long groupId) {
groupService.delete(hostId, groupId);
public void delete(@AuthMember final Member member, @PathVariable final Long groupId) {
groupService.delete(member, groupId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/groups")
@RequestMapping("/group-locations")
@RequiredArgsConstructor
public class GroupLocationController {

private final GroupLocationService groupLocationService;

@GetMapping("/locations")
@GetMapping
public GroupSearchResponse getLocations(
@ModelAttribute final GroupSearchRequest groupSearchRequest) {
return groupLocationService.findGroups(groupSearchRequest);
Expand Down
Loading

0 comments on commit b9967ea

Please sign in to comment.