-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/h-jjang/bauction into fix/…
…#63-post-entity
- Loading branch information
Showing
26 changed files
with
546 additions
and
203 deletions.
There are no files selected for viewing
32 changes: 0 additions & 32 deletions
32
backend/src/main/java/com/hjjang/backend/domain/email/controller/MailController.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
backend/src/main/java/com/hjjang/backend/domain/email/domain/EmailRegex.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
backend/src/main/java/com/hjjang/backend/domain/email/domain/ExceptionMessage.java
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
backend/src/main/java/com/hjjang/backend/domain/email/exception/MailException.java
This file was deleted.
Oops, something went wrong.
61 changes: 0 additions & 61 deletions
61
backend/src/main/java/com/hjjang/backend/domain/email/service/MailService.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
backend/src/main/java/com/hjjang/backend/domain/mail/controller/MailController.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,37 @@ | ||
package com.hjjang.backend.domain.mail.controller; | ||
|
||
import static com.hjjang.backend.global.response.code.SuccessCode.*; | ||
import static org.springframework.http.HttpStatus.*; | ||
|
||
import com.hjjang.backend.domain.mail.dto.MailRequest; | ||
import com.hjjang.backend.domain.mail.dto.MailResponse; | ||
import com.hjjang.backend.domain.mail.service.MailService; | ||
import com.hjjang.backend.global.response.response.SuccessResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/mail") | ||
public class MailController { | ||
|
||
private final MailService mailService; | ||
|
||
@PostMapping("/send") | ||
public ResponseEntity<SuccessResponse> send(@RequestBody MailRequest mailRequest) { | ||
String mail = mailRequest.getMail(); | ||
MailResponse mailResponse = mailService.sendMail(mail); | ||
SuccessResponse response = SuccessResponse.of(MAIL_SEND_SUCCESS, mailResponse); | ||
return new ResponseEntity<>(response, CREATED); | ||
} | ||
|
||
@PostMapping("/check") | ||
public ResponseEntity<SuccessResponse> auth(@RequestBody MailRequest mailRequest) { | ||
MailResponse mailResponse = mailService.checkCode(mailRequest); | ||
return ResponseEntity.ok(SuccessResponse.of(MAIL_CHECK_SUCCESS)); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...end/domain/email/domain/EmailMessage.java → ...ckend/domain/mail/domain/MailMessage.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
15 changes: 15 additions & 0 deletions
15
backend/src/main/java/com/hjjang/backend/domain/mail/domain/MailRegex.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.hjjang.backend.domain.mail.domain; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public enum MailRegex { | ||
UNIVERSITY("UNIVERSITY_MAIL_REGEX", "^[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.+a+c+\\.+k+r+$"), | ||
GS_UNIVERSITY("GS_UNIVERSITY_MAIL_REGEX", "^[a-zA-Z0-9]+@+g+s+\\.+[a-zA-Z0-9]+\\.+a+c+\\.+k+r+$"), | ||
MAIL_PARSE("MAIL_PARSE_REGEX", "[@.]"); | ||
|
||
private final String name; | ||
private final String regex; | ||
} |
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
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/com/hjjang/backend/domain/mail/exception/InvalidMailException.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,11 @@ | ||
package com.hjjang.backend.domain.mail.exception; | ||
|
||
import com.hjjang.backend.global.execption.BusinessException; | ||
import com.hjjang.backend.global.response.code.ErrorCode; | ||
|
||
public class InvalidMailException extends BusinessException { | ||
|
||
public InvalidMailException() { | ||
super(ErrorCode.INVALID_MAIL); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/com/hjjang/backend/domain/mail/exception/UnauthorizedException.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,11 @@ | ||
package com.hjjang.backend.domain.mail.exception; | ||
|
||
import com.hjjang.backend.global.execption.BusinessException; | ||
import com.hjjang.backend.global.response.code.ErrorCode; | ||
|
||
public class UnauthorizedException extends BusinessException { | ||
|
||
public UnauthorizedException() { | ||
super(ErrorCode.INVALID_CODE); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
.../src/main/java/com/hjjang/backend/domain/mail/exception/handler/MailExceptionHandler.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,27 @@ | ||
package com.hjjang.backend.domain.mail.exception.handler; | ||
|
||
import static com.hjjang.backend.global.response.code.ErrorCode.*; | ||
import static org.springframework.http.HttpStatus.*; | ||
|
||
import com.hjjang.backend.domain.mail.exception.InvalidMailException; | ||
import com.hjjang.backend.domain.mail.exception.UnauthorizedException; | ||
import com.hjjang.backend.global.response.response.ErrorResponse; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@RestControllerAdvice | ||
public class MailExceptionHandler { | ||
|
||
@ExceptionHandler(value = InvalidMailException.class) | ||
public ResponseEntity<ErrorResponse> mailExceptionHandle() { | ||
ErrorResponse response = ErrorResponse.of(INVALID_MAIL); | ||
return new ResponseEntity<>(response, BAD_REQUEST); | ||
} | ||
|
||
@ExceptionHandler(value = UnauthorizedException.class) | ||
public ResponseEntity<ErrorResponse> unauthorizedExceptionHandle() { | ||
ErrorResponse response = ErrorResponse.of(INVALID_CODE); | ||
return new ResponseEntity<>(response, UNAUTHORIZED); | ||
} | ||
} |
Oops, something went wrong.