Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions capturecat-core/src/docs/asciidoc/error-codes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ include::{snippets}/errorCode/logout/error-codes.adoc[]
=== 회원탈퇴
include::{snippets}/errorCode/withdraw/error-codes.adoc[]

[[사용자정보조회]]
=== 사용자정보조회
[[회원정보조회]]
=== 회원정보조회
Comment on lines +81 to +82
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent anchor naming convention.

The anchor [[회원정보조회]] on Line 81 lacks hyphens, while all subsequent anchors (회원-태그-, 회원-설정-) use hyphens for word separation. Update to [[회원-정보-조회]] for consistency.

-[[회원정보조회]]
-=== 회원정보조회
+[[회원-정보-조회]]
+=== 회원 정보 조회
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[[회원정보조회]]
=== 회원정보조회
[[회원-정보-조회]]
=== 회원 정보 조회
🤖 Prompt for AI Agents
In capturecat-core/src/docs/asciidoc/error-codes.adoc around lines 81 to 82, the
anchor [[회원정보조회]] is inconsistent with the repository's hyphenated anchor naming
convention; change it to [[회원-정보-조회]] so it matches the pattern used by
subsequent anchors (회원-태그-*, 회원-설정-*), and update any internal cross-references
in the document to reference the new hyphenated anchor.

include::{snippets}/errorCode/userInfo/error-codes.adoc[]

[[튜토리얼-완료-업데이트]]
Expand All @@ -94,18 +94,26 @@ include::{snippets}/errorCode/deleteTag/error-codes.adoc[]
=== 검색어 자동완성
include::{snippets}/errorCode/autocomplete/error-codes.adoc[]

[[유저-태그-생성]]
=== 유저 태그 생성
[[회원-태그-생성]]
=== 회원 태그 생성
include::{snippets}/errorCode/createUserTag/error-codes.adoc[]

[[유저-태그-조회]]
=== 유저 태그 조회
[[회원-태그-조회]]
=== 회원 태그 조회
include::{snippets}/errorCode/getUserTags/error-codes.adoc[]

[[유저-태그-수정]]
=== 유저 태그 수정
[[회원-태그-수정]]
=== 회원 태그 수정
include::{snippets}/errorCode/updateUserTag/error-codes.adoc[]

[[유저-태그-삭제]]
=== 유저 태그 삭제
[[회원-태그-삭제]]
=== 회원 태그 삭제
include::{snippets}/errorCode/deleteUserTag/error-codes.adoc[]

[[회원-설정-조회]]
=== 회원 설정 조회
include::{snippets}/errorCode/getUserSettings/error-codes.adoc[]

[[회원-설정-변경]]
=== 회원 설정 변경
include::{snippets}/errorCode/updateUserSettings/error-codes.adoc[]
97 changes: 72 additions & 25 deletions capturecat-core/src/docs/asciidoc/user.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,127 @@

[[튜토리얼-완료-업데이트]]
=== 튜토리얼(시작하기) 완료 업데이트

==== 성공

operation::tutorialComplete[snippets='curl-request,http-request,request-headers,http-response,response-fields']

==== 실패

튜토리얼(시작하기) 완료 업데이트가 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#튜토리얼-완료-업데이트, 튜토리얼 완료 업데이트 API에서 발생할 수 있는 에러>>를 살펴보세요.

[[회원-탈퇴]]
=== 회원 탈퇴

소셜 서비스 연결 해제 후 회원 관련 데이터를 삭제 처리 합니다.
소셜 서비스 연결 해제가 모종의 이유로 실패하더라도 삭제 처리는 롤백하지 않습니다. (별도 회원 안내 필요)
소셜 서비스 연결 해제가 모종의 이유로 실패하더라도 삭제 처리는 롤백하지 않습니다.
(별도 회원 안내 필요)

==== 성공

operation::withdraw[snippets='curl-request,http-request,request-headers,request-fields,http-response,response-fields']

==== 실패

회원 탈퇴가 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#회원탈퇴, 회원 탈퇴 API에서 발생할 수 있는 에러>>를 살펴보세요.

[[회원-정보-조회]]
=== 회원 정보 조회

[[사용자-정보-조회]]
=== 사용자 정보 조회
JWT 엑세스 토큰의 사용자 정보를 조회합니다.
JWT 엑세스 토큰의 회원 정보를 조회합니다.

==== 성공

operation::userInfo[snippets='curl-request,http-request,request-headers,http-response,response-fields']

==== 실패
사용자 정보 조회가 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#사용자정보조회, 사용자 정보 조회 API에서 발생할 수 있는 에러>>를 살펴보세요.
회원 정보 조회가 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#회원정보조회, 회원 정보 조회 API에서 발생할 수 있는 에러>>를 살펴보세요.

[[회원-태그-생성]]
=== 회원 태그 생성

[[유저-태그-생성]]
=== 유저 태그 생성
사용자의 태그를 생성합니다.
회원의 태그를 생성합니다.

==== 성공

operation::createUserTag[snippets='curl-request,http-request,request-headers,query-parameters,http-response,response-fields']

==== 실패
유저 태그 생성이 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#유저-태그-생성, 유저 태그 생성 API에서 발생할 수 있는 에러>>를 살펴보세요.
회원 태그 생성이 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#회원-태그-생성, 회원 태그 생성 API에서 발생할 수 있는 에러>>를 살펴보세요.

[[회원-태그-조회]]
=== 회원 태그 조회

[[유저-태그-조회]]
=== 유저 태그 조회
사용자의 태그를 조회합니다.
회원의 태그를 조회합니다.

==== 성공
operation::getUserTags[snippets='curl-request,http-request,request-headers,query-parameters,http-response,response-fields']

operation::getUserTags[snippets='curl-request,http-request,request-headers,http-response,response-fields']

==== 실패
유저 태그 조회가 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#유저-태그-조회, 유저 태그 조회 API에서 발생할 수 있는 에러>>를 살펴보세요.
회원 태그 조회가 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#회원-태그-조회, 회원 태그 조회 API에서 발생할 수 있는 에러>>를 살펴보세요.

[[회원-태그-수정]]
=== 회원 태그 수정

[[유저-태그-수정]]
=== 유저 태그 수정
==== 성공

operation::updateUserTag[snippets='curl-request,http-request,request-headers,request-fields,http-response,response-fields']

==== 실패
유저 태그 수정이 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#유저-태그-수정, 유저 태그 수정 API에서 발생할 수 있는 에러>>를 살펴보세요.
회원 태그 수정이 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#회원-태그-수정, 회원 태그 수정 API에서 발생할 수 있는 에러>>를 살펴보세요.

[[회원-태그-삭제]]
=== 회원 태그 삭제

[[유저-태그-삭제]]
=== 유저 태그 삭제
==== 성공

operation::deleteUserTag[snippets='curl-request,http-request,request-headers,query-parameters,http-response,response-fields']

==== 실패
유저 태그 삭제가 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#유저-태그-삭제, 유저 태그 삭제 API에서 발생할 수 있는 에러>>를 살펴보세요.
회원 태그 삭제가 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#회원-태그-삭제, 회원 태그 삭제 API에서 발생할 수 있는 에러>>를 살펴보세요.

[[회원-설정-조회]]
=== 회원 설정 조회

==== 성공

operation::getUserSettings[snippets='curl-request,http-request,request-headers,http-response,response-fields']

==== 실패

회원 설정 조회가 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#회원-설정-조회, 회원 설정 조회 API에서 발생할 수 있는 에러>>를 살펴보세요.

[[회원-설정-변경]]
=== 회원 설정 변경

==== 성공

operation::updateUserSettings[snippets='curl-request,http-request,request-headers,request-body,request-fields,http-response,response-fields']

==== 실패

회원 설정 변경에 실패했다면 HTTP 상태 코드와 함께 <<에러-객체-형식, 에러 객체>>가 돌아옵니다.

<<error-codes#회원-설정-변경, 회원 설정 변경 API에서 발생할 수 있는 에러>>를 살펴보세요.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -16,10 +17,13 @@
import lombok.RequiredArgsConstructor;

import com.capturecat.core.api.user.dto.UserReqDto.JoinReqDto;
import com.capturecat.core.api.user.dto.UserReqDto.UserSettingsReqDto;
import com.capturecat.core.api.user.dto.UserReqDto.WithdrawReqDto;
import com.capturecat.core.api.user.dto.UserRespDto.InfoRespDto;
import com.capturecat.core.api.user.dto.UserRespDto.JoinRespDto;
import com.capturecat.core.api.user.dto.UserRespDto.UserSettingsRespDto;
import com.capturecat.core.config.jwt.JwtUtil;
import com.capturecat.core.domain.user.UserSettings;
import com.capturecat.core.service.auth.LoginUser;
import com.capturecat.core.service.auth.TokenService;
import com.capturecat.core.service.user.UserService;
Expand All @@ -39,6 +43,7 @@ public class UserController {
@PostMapping("/join")
public ApiResponse<JoinRespDto> join(@RequestBody @Valid JoinReqDto joinReqDto, BindingResult bindingResult) {
JoinRespDto joinRespDto = userService.join(joinReqDto);

return ApiResponse.success(joinRespDto);
}

Expand Down Expand Up @@ -77,6 +82,29 @@ public ApiResponse<?> withdraw(@AuthenticationPrincipal LoginUser loginUser, @Re
@GetMapping("/info")
public ApiResponse<InfoRespDto> getUserInfo(@AuthenticationPrincipal LoginUser loginUser) {
InfoRespDto infoRespDto = userService.getUserInfo(loginUser.getUsername());

return ApiResponse.success(infoRespDto);
}

/**
* 회원 설정 정보 조회
*/
@GetMapping("/settings")
public ApiResponse<UserSettingsRespDto> getUserSettings(@AuthenticationPrincipal LoginUser loginUser) {
UserSettings settings = userService.getUserSettings(loginUser.getUsername());

return ApiResponse.success(UserSettingsRespDto.of(settings));
}

/**
* 회원 설정 정보 변경
*/
@PutMapping("/settings")
public ApiResponse<UserSettingsRespDto> updateUserSettings(@AuthenticationPrincipal LoginUser loginUser,
@RequestBody UserSettingsReqDto userSettingsReqDto) {
UserSettings settings = userService.setUserSettings(loginUser.getUsername(),
userSettingsReqDto.isScreenshotAutoDeleteEnabled());

return ApiResponse.success(UserSettingsRespDto.of(settings));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import com.capturecat.core.domain.user.User;
import com.capturecat.core.domain.user.UserRole;
import com.capturecat.core.domain.user.UserSettings;

/** 회원 관련 요청 DTO */
public class UserReqDto {
Expand Down Expand Up @@ -59,4 +60,11 @@ public static class WithdrawReqDto {
@Size(max = 500, message = "탈퇴 사유는 500자 이내로 작성해주세요.")
private String reason;
}

/** 회원 설정 정보 DTO */
@Getter
@Setter
public static class UserSettingsReqDto {
private boolean screenshotAutoDeleteEnabled;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;

import com.capturecat.core.domain.user.User;
import com.capturecat.core.domain.user.UserSettings;

/** 회원 관련 응답 DTO */
public class UserRespDto {
Expand Down Expand Up @@ -45,4 +47,17 @@ public JoinRespDto(User user) {
this.username = user.getUsername();
}
}

/** 회원 설정 정보 DTO */
@Getter
@RequiredArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public static class UserSettingsRespDto {
private final Long userId;
private final boolean screenshotAutoDeleteEnabled;

public static UserSettingsRespDto of(UserSettings userSettings) {
return new UserSettingsRespDto(userSettings.getUserId(), userSettings.isScreenshotAutoDeleteEnabled());
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.capturecat.core.domain.user;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

import com.capturecat.core.domain.BaseTimeEntity;

@Entity
@Table(name = "user_settings")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class UserSettings extends BaseTimeEntity {

@Id
@Column(name = "user_id")
private Long userId;

@Column(name = "screenshot_auto_delete_enabled", nullable = false)
private boolean screenshotAutoDeleteEnabled = false;


public static UserSettings init(Long userId) {
UserSettings settings = new UserSettings();
settings.userId = userId;
settings.screenshotAutoDeleteEnabled = false;
return settings;
}

public void changeAutoDelete(boolean enabled) {
this.screenshotAutoDeleteEnabled = enabled;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.capturecat.core.domain.user;

import org.springframework.data.jpa.repository.JpaRepository;

public interface UserSettingsRepository extends JpaRepository<UserSettings, Long> {
}
Loading