forked from EveryUniv/next-student-council-backend
-
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 EveryUniv#63 from EveryUniv/dev
feat: 로그인 기능에서 단국대 인증 확인 로직 삭제
- Loading branch information
Showing
10 changed files
with
152 additions
and
14 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
src/main/java/com/dku/council/domain/user/exception/RequiredDkuUpdateException.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,11 +1,12 @@ | ||
package com.dku.council.domain.user.exception; | ||
|
||
import com.dku.council.global.error.CustomHttpStatus; | ||
import com.dku.council.global.error.exception.LocalizedMessageException; | ||
import org.springframework.http.HttpStatus; | ||
|
||
public class RequiredDkuUpdateException extends LocalizedMessageException { | ||
|
||
public RequiredDkuUpdateException() { | ||
super(HttpStatus.NOT_ACCEPTABLE, "required.dku-update"); | ||
super(CustomHttpStatus.REQUIRED_DKU_UPDATE, "required.dku-update"); | ||
} | ||
} |
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
99 changes: 99 additions & 0 deletions
99
src/main/java/com/dku/council/global/error/CustomHttpStatus.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,99 @@ | ||
package com.dku.council.global.error; | ||
|
||
import lombok.Getter; | ||
import org.springframework.lang.Nullable; | ||
|
||
public enum CustomHttpStatus{ | ||
|
||
/** | ||
* 600 : 단국대학교 학생 인증이 없을 경우 | ||
*/ | ||
REQUIRED_DKU_UPDATE(600, CustomSeries.DKU_ERROR, "Required DkuInfo"); | ||
|
||
public static final CustomHttpStatus[] VALUES; | ||
|
||
static { | ||
VALUES = values(); | ||
} | ||
|
||
private final int value; | ||
|
||
private final CustomSeries series; | ||
|
||
@Getter | ||
private final String reasonPhrase; | ||
|
||
CustomHttpStatus(int value, CustomSeries series, String reasonPhrase) { | ||
this.value = value; | ||
this.series = series; | ||
this.reasonPhrase = reasonPhrase; | ||
} | ||
|
||
public int value() { | ||
return this.value; | ||
} | ||
|
||
public CustomSeries series() { | ||
return this.series; | ||
} | ||
|
||
public String toString() { | ||
return this.value + " " + name(); | ||
} | ||
|
||
public static CustomHttpStatus valueOf(int statusCode) { | ||
CustomHttpStatus status = resolve(statusCode); | ||
if (status == null) { | ||
throw new IllegalArgumentException("No matching constant for [" + statusCode + "]"); | ||
} | ||
return status; | ||
} | ||
|
||
@Nullable | ||
public static CustomHttpStatus resolve(int statusCode) { | ||
for (CustomHttpStatus status : VALUES) { | ||
if (status.value == statusCode) { | ||
return status; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public enum CustomSeries { | ||
DKU_ERROR(6); | ||
|
||
private final int value; | ||
|
||
CustomSeries(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int value() { | ||
return this.value; | ||
} | ||
|
||
@Deprecated | ||
public static CustomSeries valueOf(CustomHttpStatus status) { | ||
return status.series; | ||
} | ||
|
||
public static CustomSeries valueOf(int statusCode) { | ||
CustomSeries series = resolve(statusCode); | ||
if (series == null) { | ||
throw new IllegalArgumentException("No matching constant for [" + statusCode + "]"); | ||
} | ||
return series; | ||
} | ||
|
||
@Nullable | ||
public static CustomSeries resolve(int statusCode) { | ||
int seriesCode = statusCode / 100; | ||
for (CustomSeries series : values()) { | ||
if (series.value == seriesCode) { | ||
return series; | ||
} | ||
} | ||
return null; | ||
} | ||
} | ||
} |
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
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