-
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 branch 'develop' into feat/YEL-193
- Loading branch information
Showing
48 changed files
with
1,153 additions
and
311 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
:reproducible: | ||
== 탈퇴 & 사유 저장 v2 | ||
|
||
=== 요청 | ||
|
||
include::{snippets}/api/v2/user/deleteUser/http-request.adoc[] | ||
|
||
=== 응답 | ||
|
||
include::{snippets}/api/v2/user/deleteUser/http-response.adoc[] | ||
|
||
*필드 타입* | ||
|
||
- "value": String | ||
* value는 탈퇴 사유를 보내주시면 됩니다. | ||
|
||
|
||
*필드 타입* | ||
|
||
=== NOTE | ||
|
||
- AccessToken에 해당하는 User의 탈퇴 처리 및 탈퇴 사유를 저장하는 API입니다. | ||
// - User의 다양한 정보를 저장하는 API로 범용적인 확장할 예정입니다. | ||
// * 차후에 tag에 들어갈 수 있는 ENUM의 종류를 다양화 할 예정입니다. | ||
|
||
=== CHANGELOG | ||
|
||
- 2024.01.27 API 릴리즈 | ||
- 2024.01.09 명세 작성 |
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 |
---|---|---|
@@ -1,30 +1,47 @@ | ||
:reproducible: | ||
== 탈퇴 & 사유 저장 v2 | ||
== 유저 기타 정보 저장 (명세) | ||
|
||
=== 요청 | ||
|
||
include::{snippets}/api/v2/user/http-request.adoc[] | ||
|
||
=== 응답 | ||
|
||
include::{snippets}/api/v2/user/http-response.adoc[] | ||
[http] | ||
---- | ||
POST /api/v1/user/data/recommended HTTP/1.1 | ||
Authorization: Bearer your-access-token | ||
Content-Type: application-json | ||
{ | ||
"value": "true" | ||
} | ||
---- | ||
|
||
*필드 타입* | ||
|
||
- "tag": "withdraw-reason" | "account-update-at" | "recommended" | ||
* withdraw-reason 자리가 ENUM으로 대체될 예정입니다. | ||
- "value": String | ||
* value는 탈퇴 사유를 보내주시면 됩니다. | ||
|
||
=== 응답 | ||
|
||
*필드 타입* | ||
[http,json] | ||
---- | ||
HTTP/1.1 200 OK | ||
Vary: Origin | ||
Vary: Access-Control-Request-Method | ||
Vary: Access-Control-Request-Headers | ||
Content-Type: application/json | ||
{ | ||
"status" : 200, | ||
"message" : "탈퇴 사유 정보 저장에 성공하였습니다." | ||
} | ||
---- | ||
|
||
=== NOTE | ||
|
||
- AccessToken에 해당하는 User의 탈퇴 사유를 저장하는 API입니다. | ||
- User의 다양한 정보를 저장하는 API로 범용적인 확장할 예정입니다. | ||
* 차후에 tag에 들어갈 수 있는 ENUM의 종류를 다양화 할 예정입니다. | ||
|
||
=== CHANGELOG | ||
|
||
- 2024.01.27 API 릴리즈 | ||
- 2024.01.30 탈퇴 v2 분리로 인한 명세 업데이트 | ||
- 2024.01.09 명세 작성 |
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
src/main/java/com/yello/server/domain/admin/dto/response/AdminConfigurationResponse.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.yello.server.domain.admin.dto.response; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record AdminConfigurationResponse( | ||
String tag, | ||
String value | ||
) { | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
...main/java/com/yello/server/domain/admin/dto/response/AdminConfigurationUpdateRequest.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.yello.server.domain.admin.dto.response; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record AdminConfigurationUpdateRequest( | ||
String tag, | ||
String value | ||
) { | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/yello/server/domain/admin/entity/AdminConfiguration.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,32 @@ | ||
package com.yello.server.domain.admin.entity; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Convert; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class AdminConfiguration { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column | ||
@Convert(converter = AdminConfigurationTypeConverter.class) | ||
private AdminConfigurationType tag; | ||
|
||
@Column | ||
private String value; | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/yello/server/domain/admin/entity/AdminConfigurationType.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,28 @@ | ||
package com.yello.server.domain.admin.entity; | ||
|
||
import java.text.MessageFormat; | ||
import java.util.Arrays; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum AdminConfigurationType { | ||
ACCESS_TOKEN_TIME("ACCESS_TOKEN_TIME"), | ||
REFRESH_TOKEN_TIME("REFRESH_TOKEN_TIME"), | ||
ADMIN_SITE_PASSWORD("ADMIN_SITE_PASSWORD"); | ||
|
||
private final String intial; | ||
|
||
public static AdminConfigurationType fromCode(String dbData) { | ||
return Arrays.stream(AdminConfigurationType.values()) | ||
.filter(v -> v.getIntial().equals(dbData)) | ||
.findAny() | ||
.orElseThrow(() -> new IllegalArgumentException( | ||
MessageFormat.format("존재하지 않는 태그입니다. {0}", dbData))); | ||
} | ||
|
||
public String intial() { | ||
return intial; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/yello/server/domain/admin/entity/AdminConfigurationTypeConverter.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,31 @@ | ||
package com.yello.server.domain.admin.entity; | ||
|
||
import javax.persistence.AttributeConverter; | ||
import javax.persistence.Converter; | ||
import lombok.extern.log4j.Log4j2; | ||
|
||
@Converter | ||
@Log4j2 | ||
public class AdminConfigurationTypeConverter implements AttributeConverter<AdminConfigurationType, String> { | ||
|
||
@Override | ||
public String convertToDatabaseColumn(AdminConfigurationType type) { | ||
if (type == null) { | ||
return null; | ||
} | ||
return type.getIntial(); | ||
} | ||
|
||
@Override | ||
public AdminConfigurationType convertToEntityAttribute(String dbData) { | ||
if (dbData == null) { | ||
return null; | ||
} | ||
try { | ||
return AdminConfigurationType.fromCode(dbData); | ||
} catch (IllegalArgumentException exception) { | ||
log.error("failure to convert cause unexpected code" + dbData + exception); | ||
throw exception; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ain/java/com/yello/server/domain/admin/exception/AdminConfigurationNotFoundException.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.yello.server.domain.admin.exception; | ||
|
||
import com.yello.server.global.common.ErrorCode; | ||
import com.yello.server.global.exception.CustomException; | ||
|
||
public class AdminConfigurationNotFoundException extends CustomException { | ||
|
||
public AdminConfigurationNotFoundException(ErrorCode error) { | ||
super(error, "[AdminConfigurationNotFoundException] " + error.getMessage()); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/yello/server/domain/admin/repository/AdminConfigurationJpaRepository.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,8 @@ | ||
package com.yello.server.domain.admin.repository; | ||
|
||
import com.yello.server.domain.admin.entity.AdminConfiguration; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface AdminConfigurationJpaRepository extends JpaRepository<AdminConfiguration, Long> { | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/yello/server/domain/admin/repository/AdminConfigurationRepository.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,14 @@ | ||
package com.yello.server.domain.admin.repository; | ||
|
||
import com.yello.server.domain.admin.entity.AdminConfiguration; | ||
import com.yello.server.domain.admin.entity.AdminConfigurationType; | ||
import java.util.List; | ||
|
||
public interface AdminConfigurationRepository { | ||
|
||
List<AdminConfiguration> findConfigurations(AdminConfigurationType tag); | ||
|
||
void setConfigurations(AdminConfigurationType tag, String value); | ||
|
||
void deleteConfigurations(AdminConfigurationType tag); | ||
} |
Oops, something went wrong.