Skip to content

Commit

Permalink
Merge branch 'staging' of https://github.com/Genti2024/GenTI-BE into …
Browse files Browse the repository at this point in the history
…main-test
  • Loading branch information
LeeJae-H committed Sep 4, 2024
2 parents bdde845 + 14453cc commit 396d93d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ private void matchRequestToAdmin(PictureGenerateRequest pgr, Creator adminCreato
adminCreator.addPictureGenerateResponse(newPGRES);
pgresList.add(newPGRES);
gentiMatchResult.addMatchResult(
"email : %s가 요청한 id : %d 요청을 어드민에게 매칭".formatted(pgr.getRequester().getEmail(), pgr.getId()));
"[요청자 email] : %s [요청자 id] : %d [작업자 email] : %s [작업자 id] : %d [프롬프트] : %s [비율] : %s [앵글] : %s ".formatted(
pgr.getRequester().getEmail(), pgr.getId(), adminCreator.getUser().getEmail(), adminCreator.getId(),
pgr.getPrompt(), pgr.getPictureRatio().getResponse(), pgr.getCameraAngle().getResponse()));
}

private void matchRequestToCreator(PictureGenerateRequest pgr, Creator creator, GentiMatchResult gentiMatchResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void validateToken(String token) {
} catch (MalformedJwtException | IllegalArgumentException | UnsupportedJwtException | SignatureException e) {
throw ExpectedException.withLogging(ResponseCode.INVALID_TOKEN);
} catch (ExpiredJwtException e) {
throw ExpectedException.withLogging(TOKEN_EXPIRED);
throw ExpectedException.withoutLogging(TOKEN_EXPIRED);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public enum ResponseCode {
* 인증/인가
*/
TOKEN_NOT_PROVIDED(ErrorConstants.TOKEN_NOT_PROVIDED, HttpStatus.UNAUTHORIZED, false, "토큰이 전달되지 않았습니다."),
TOKEN_EXPIRED(ErrorConstants.TOKEN_EXPIRED, HttpStatus.UNAUTHORIZED, false, "토큰이 만료되었습니다."),
TOKEN_EXPIRED(ErrorConstants.TOKEN_EXPIRED, HttpStatus.UNAUTHORIZED, false, "액세스 토큰이 만료되었습니다."),
INVALID_TOKEN(ErrorConstants.INVALID_TOKEN, HttpStatus.UNAUTHORIZED, false, "유효하지 않은 토큰입니다."),
INSUFFICIENT_PERMISSIONS(ErrorConstants.INSUFFICIENT_PERMISSIONS, HttpStatus.FORBIDDEN, false, "접근 권한이 부족합니다."),
REFRESH_TOKEN_EXPIRED(ErrorConstants.REFRESH_TOKEN_EXPIRED, HttpStatus.UNAUTHORIZED, false, "리프레시 토큰이 만료되었습니다."),
Expand Down Expand Up @@ -116,9 +116,9 @@ public enum ResponseCode {
false,
"사진생성요청을 요청한 유저만 볼 수 있습니다."),
PictureGenerateRequestAlreadyProcessed(ErrorConstants.PictureGenerateRequestAlreadyProcessed,
BAD_REQUEST,
false,
"사진생성요청이 이미 처리중입니다."),
BAD_REQUEST,
false,
"사진생성요청이 이미 처리중입니다."),
/**
* User
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.apache.commons.text.StringEscapeUtils;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -43,11 +44,13 @@ public class DiscordAppender extends UnsynchronizedAppenderBase<ILoggingEvent> {
private String username = "Error log";
private String adminAvatarUrl = "https://img.icons8.com/ios-filled/50/FA5252/business.png";
private String errorAvatarUrl = "https://img.icons8.com/ios-filled/50/22C3E6/error--v1.png";
private String devErrorAvatarUrl = "https://img.icons8.com/ios-filled/50/FFFFFF/error--v1.png";
private String eventAvatarUrl = "https://img.icons8.com/ios-filled/50/40C057/confetti.png";

@Override
protected void append(ILoggingEvent eventObject) {
DiscordWebHook discordWebhook = new DiscordWebHook(username, errorAvatarUrl, false);
String avatarUrl = Objects.equals(profile, "staging") ? devErrorAvatarUrl : errorAvatarUrl;
DiscordWebHook discordWebhook = new DiscordWebHook(username, avatarUrl, false);
Map<String, String> mdcPropertyMap = eventObject.getMDCPropertyMap();
Color messageColor = getLevelColor(eventObject);

Expand Down

0 comments on commit 396d93d

Please sign in to comment.