-
Notifications
You must be signed in to change notification settings - Fork 1
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 #27 from Re-4aliens/develop
2024-01-28 [Release Note]
- Loading branch information
Showing
58 changed files
with
2,232 additions
and
30 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
= Spring REST Docs | ||
:toc: left | ||
:toclevels: 2 | ||
:sectlinks: | ||
|
||
[[resources-post]] | ||
== Authentication | ||
|
||
[[resources-post-create]] | ||
=== 로그인 시도 | ||
|
||
==== HTTP request | ||
|
||
include::{snippets}/auth-login/http-request.adoc[] | ||
|
||
==== request-body 설명 | ||
include::{snippets}/auth-login/request-fields.adoc[] | ||
|
||
==== HTTP response | ||
|
||
include::{snippets}/auth-login/http-response.adoc[] | ||
|
||
==== response-body 설명 | ||
include::{snippets}/auth-login/response-fields.adoc[] | ||
|
||
|
||
|
||
=== 로그아웃 | ||
|
||
==== HTTP request | ||
|
||
include::{snippets}/auth-logout/http-request.adoc[] | ||
|
||
==== request-body 설명 | ||
include::{snippets}/auth-logout/request-fields.adoc[] | ||
|
||
==== HTTP response | ||
|
||
include::{snippets}/auth-logout/http-response.adoc[] | ||
|
||
|
||
|
||
|
||
=== 토큰재발급 | ||
|
||
==== HTTP request | ||
|
||
include::{snippets}/auth-reissue/http-request.adoc[] | ||
|
||
==== request-body 설명 | ||
include::{snippets}/auth-reissue/request-fields.adoc[] | ||
|
||
==== HTTP response | ||
|
||
include::{snippets}/auth-reissue/http-response.adoc[] | ||
|
||
==== response-body 설명 | ||
include::{snippets}/auth-reissue/response-fields.adoc[] |
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,75 @@ | ||
= Spring REST Docs | ||
:toc: left | ||
:toclevels: 2 | ||
:sectlinks: | ||
|
||
[[resources-post]] | ||
== 이메일 인증 | ||
|
||
[[resources-post-create]] | ||
=== 이메일 중복 검사 - 사용가능 | ||
|
||
==== HTTP request | ||
|
||
include::{snippets}/email-duplicateCheck-available/http-request.adoc[] | ||
|
||
==== request-param 설명 | ||
include::{snippets}/email-duplicateCheck-available/query-parameters.adoc[] | ||
|
||
==== HTTP response | ||
|
||
include::{snippets}/email-duplicateCheck-available/http-response.adoc[] | ||
|
||
==== response-body 설명 | ||
include::{snippets}/email-duplicateCheck-available/response-fields.adoc[] | ||
|
||
|
||
|
||
=== 이메일 중복 검사 - 사용불가 | ||
|
||
==== HTTP request | ||
|
||
include::{snippets}/email-duplicateCheck-duplicate/http-request.adoc[] | ||
|
||
==== request-param 설명 | ||
include::{snippets}/email-duplicateCheck-duplicate/query-parameters.adoc[] | ||
|
||
==== HTTP response | ||
|
||
include::{snippets}/email-duplicateCheck-duplicate/http-response.adoc[] | ||
|
||
|
||
|
||
|
||
=== 인증 이메일 전송 | ||
|
||
==== HTTP request | ||
|
||
include::{snippets}/email-verification-send/http-request.adoc[] | ||
|
||
==== request-body 설명 | ||
include::{snippets}/email-verification-send/request-fields.adoc[] | ||
|
||
==== HTTP response | ||
|
||
include::{snippets}/email-verification-send/http-response.adoc[] | ||
|
||
==== response-body 설명 | ||
include::{snippets}/email-verification-send/response-fields.adoc[] | ||
|
||
|
||
=== 인증 이메일 검증 요청 | ||
|
||
==== HTTP request | ||
|
||
include::{snippets}/email-authentication-success/http-request.adoc[] | ||
|
||
==== request-param 설명 | ||
include::{snippets}/email-authentication-success/query-parameters.adoc[] | ||
|
||
==== HTTP response | ||
|
||
include::{snippets}/email-authentication-success/http-response.adoc[] | ||
|
||
==== response-body 설명 | ||
include::{snippets}/email-authentication-success/response-fields.adoc[] |
This file was deleted.
Oops, something went wrong.
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
6 changes: 6 additions & 0 deletions
6
src/main/java/com/aliens/backend/auth/controller/dto/LoginMember.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,6 @@ | ||
package com.aliens.backend.auth.controller.dto; | ||
|
||
import com.aliens.backend.auth.domain.MemberRole; | ||
|
||
public record LoginMember(Long memberId, MemberRole role) { | ||
} |
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,50 @@ | ||
package com.aliens.backend.auth.domain; | ||
|
||
import com.aliens.backend.auth.controller.dto.LoginMember; | ||
import jakarta.persistence.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
||
@Entity | ||
public class Member { | ||
|
||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column | ||
private Long id; | ||
|
||
@Column | ||
private String email; | ||
|
||
@Column | ||
private String password; | ||
|
||
@Column | ||
private MemberRole role; | ||
|
||
@OneToMany(mappedBy = "member", cascade = CascadeType.REMOVE) | ||
private List<Token> tokens = new ArrayList<>(); | ||
|
||
protected Member() { | ||
} | ||
|
||
public Member(final String email, final String password, final MemberRole role) { | ||
this.email = email; | ||
this.password = password; | ||
this.role = role; | ||
} | ||
|
||
public boolean isCorrectPassword(String password) { | ||
return this.password.equals(password); | ||
} | ||
|
||
public LoginMember getLoginMember() { | ||
return new LoginMember(id,role); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("email: %s, password : %s, role : %s", this.email, this.password, this.role); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/aliens/backend/auth/domain/MemberRole.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.aliens.backend.auth.domain; | ||
|
||
public enum MemberRole { | ||
ADMIN(0,"관리자"), | ||
MEMBER(1,"회원"); | ||
|
||
private final Integer code; | ||
private final String description; | ||
|
||
MemberRole(final Integer code, final String description) { | ||
this.code = code; | ||
this.description = description; | ||
} | ||
|
||
public static MemberRole of(final Integer code) { | ||
for (MemberRole role : values()) { | ||
if (role.getCode().equals(code)) { | ||
return role; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public Integer getCode() { | ||
return code; | ||
} | ||
} |
Oops, something went wrong.