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
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package org.ezcode.codetest.application.usermanagement.auth.dto.signin;
package org.ezcode.codetest.application.usermanagement.auth.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "로그인 요청")
public class SigninRequest {

@Schema(description = "사용자 이메일 주소", example = "[email protected]")
@NotBlank
@Email(message = "이메일은 공백일 수 없습니다")
private String email;

@Schema(description = "비밀번호 (영문, 숫자, 특수문자 포함 8~20자)", example = "Aa1234**")
@NotBlank(message = "비밀번호는 공백일 수 없습니다.")
@Pattern(
regexp = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{8,20}$",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.ezcode.codetest.application.usermanagement.auth.dto.signup;
package org.ezcode.codetest.application.usermanagement.auth.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
Expand All @@ -11,30 +12,39 @@
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "회원가입 요청")
public class SignupRequest {

@Schema(description = "유저 이메일", example = "[email protected]")
@NotBlank(message = "이메일은 공백일 수 없습니다")
@Email
private String email;

@Schema(description = "비밀번호 (영문, 숫자, 특수문자 포함 8~20자)", example = "Aa12345**")
@NotBlank(message = "비밀번호는 공백일 수 없습니다.")
@Pattern(
regexp = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{8,20}$",
message = "비밀번호는 영문, 숫자, 특수문자를 포함한 8~20자리여야 합니다.")
private String password;


@Schema(description = "비밀번호 확인", example = "Aa12345**")
@NotBlank(message = "비밀번호 확인은 공백일 수 없습니다.")
private String passwordConfirm;


@Schema(description = "사용자 이름 (최대 15자)", example = "홍길동")
@NotBlank(message = "사용자명은 반드시 입력되어야합니다.")
@Size(max = 15, message = "이름은 15글자 이하로 입력 가능합니다")
private String username;

@Schema(description = "사용자 별명 (최대 20자)", example = "다람쥐쳇바퀴에굴러가")
@NotBlank(message = "별명은 반드시 입력되어야합니다")
@Size(max = 20, message = "별명은 20글자 이하로 입력 가능합니다")
private String nickname;

//선택적 입력
@Schema(description = "나이 (선택 입력)", example = "25")
private Integer age;

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package org.ezcode.codetest.application.usermanagement.auth.dto.signin;
package org.ezcode.codetest.application.usermanagement.auth.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "소셜 로그인 응답")
public record OAuthResponse(
@Schema(description = "accessToken")
String accessToken,
@Schema(description = "refreshToken")
String refreshToken
){
public static OAuthResponse from(String accessToken, String refreshToken) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.ezcode.codetest.application.usermanagement.auth.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "refreshToken 응답")
public record RefreshTokenResponse (
@Schema(description = "생성된 refreshToken")
String token
) {
public static RefreshTokenResponse from(String token) {
return new RefreshTokenResponse(token);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.ezcode.codetest.application.usermanagement.auth.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "로그인 응답")
public record SigninResponse(
@Schema(description = "생성된 accessToken")
String accessToken,
@Schema(description = "생성된 refreshToken")
String refreshToken) {
public static SigninResponse from(String accessToken, String refreshToken) {
return new SigninResponse(accessToken, refreshToken);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.ezcode.codetest.application.usermanagement.auth.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "회원가입 응답")
public record SignupResponse(
@Schema(description = "생성된 token")
String token
) {
public static SignupResponse from(String token) {
return new SignupResponse(token);
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

import java.util.concurrent.TimeUnit;

import org.ezcode.codetest.application.usermanagement.auth.dto.signin.RefreshTokenResponse;
import org.ezcode.codetest.application.usermanagement.auth.dto.signin.SigninRequest;
import org.ezcode.codetest.application.usermanagement.auth.dto.signin.SigninResponse;
import org.ezcode.codetest.application.usermanagement.auth.dto.signup.SignupRequest;
import org.ezcode.codetest.application.usermanagement.auth.dto.signup.SignupResponse;
import org.ezcode.codetest.application.usermanagement.auth.port.JwtUtil;
import org.ezcode.codetest.application.usermanagement.auth.dto.response.RefreshTokenResponse;
import org.ezcode.codetest.application.usermanagement.auth.dto.request.SigninRequest;
import org.ezcode.codetest.application.usermanagement.auth.dto.response.SigninResponse;
import org.ezcode.codetest.application.usermanagement.auth.dto.request.SignupRequest;
import org.ezcode.codetest.application.usermanagement.auth.dto.response.SignupResponse;
import org.ezcode.codetest.application.usermanagement.user.dto.response.LogoutResponse;
import org.ezcode.codetest.domain.user.exception.AuthException;
import org.ezcode.codetest.domain.user.exception.AuthExceptionCode;
import org.ezcode.codetest.domain.user.model.entity.User;
import org.ezcode.codetest.domain.user.model.enums.AuthType;
import org.ezcode.codetest.domain.user.service.UserDomainService;
import org.ezcode.codetest.common.security.util.JwtUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package org.ezcode.codetest.application.usermanagement.user.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;

@Schema(description = "비밀번호 변경 요청")
public record ChangeUserPasswordRequest(

@Schema(description = "기존 비밀번호와 일치해야합니다", example = "Aa1234**")
@NotBlank
String oldPassword,

@Schema(description = "비밀번호 (영문, 숫자, 특수문자 포함 8~20자)", example = "Aa1234**")
@NotBlank(message = "비밀번호는 공백일 수 없습니다.")
@Pattern(
regexp = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{8,20}$",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
package org.ezcode.codetest.application.usermanagement.user.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "회원 정보 변경 요청")
public record ModifyUserInfoRequest(
@Schema(description = "변경할 별명", example = "코딩짱")
String nickname,

@Schema(description = "GitHub 주소", example = "https://github.com/username")
String githubUrl,

@Schema(description = "블로그 주소", example = "https://blog.example.com")
String blogUrl,

@Schema(description = "프로필 이미지 URL", example = "https://cdn.example.com/images/profile.jpg")
String profileImageUrl,

@Schema(description = "자기소개", example = "안녕하세요, 백엔드 개발자입니다.")
String introduction,

@Schema(description = "나이", example = "28")
Integer age
) {
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.ezcode.codetest.application.usermanagement.user.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;

@Getter
@Schema(description = "비밀번호 변경 응답 DTO")
public class ChangeUserPasswordResponse {
@Schema(description = "응답 메시지", example = "비밀번호가 성공적으로 변경되었습니다.")
String message;
public ChangeUserPasswordResponse(String message) {
this.message = message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import java.util.Map;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "Google OAuth2 응답 처리 클래스")
public class GoogleOAuth2Response implements OAuth2Response {
private final Map<String, Object> attributes;

Expand All @@ -11,22 +14,26 @@ public GoogleOAuth2Response(Map<String, Object> attributes) {
}

@Override
@Schema(description = "OAuth 제공자 이름", example = "google")
public String getProvider() {
return "google";
}

@Override
@Schema(description = "제공자 내부 식별자", example = "109000123456789012345")
public String getProviderId() {
//구글에서는 "sub"으로 제공함
return attributes.get("sub").toString();
}

@Override
@Schema(description = "사용자 이메일", example = "[email protected]")
public String getEmail() {
return attributes.get("email").toString();
}

@Override
@Schema(description = "사용자 이름", example = "홍길동")
public String getName() {
return attributes.get("name").toString();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.ezcode.codetest.application.usermanagement.user.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;

@Getter
@Schema(description = "로그아웃 응답 DTO")
public class LogoutResponse {
@Schema(description = "로그아웃 메시지", example = "성공적으로 로그아웃되었습니다.")
String message;

public LogoutResponse(String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
import org.ezcode.codetest.domain.user.model.entity.User;
import org.ezcode.codetest.domain.user.model.enums.Tier;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;

@Getter
@Schema(description = "간단한 사용자 정보 응답 DTO")
public class SimpleUserInfoResponse {
@Schema(description = "사용자 ID", example = "1")
private final Long userId;

@Schema(description = "사용자 별명", example = "다람쥐쳇바퀴에굴러가")
private final String nickname;

@Schema(description = "사용자 티어", example = "GOLD")
private final Tier tier;

@Schema(description = "프로필 이미지 URL", example = "https://cdn.example.com/profile.jpg")
private final String profileImageUrl;

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,41 @@
import org.ezcode.codetest.domain.user.model.enums.Tier;
import org.ezcode.codetest.domain.user.model.enums.UserRole;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;

@Getter
@Schema(description = "회원 정보 응답 DTO")
public class UserInfoResponse {
@Schema(description = "사용자 이름", example = "홍길동")
private final String username;

@Schema(description = "사용자 이메일", example = "[email protected]")
private final String email;

@Schema(description = "나이", example = "25")
private final Integer age;

@Schema(description = "닉네임", example = "길동이짱")
private final String nickname;

@Schema(description = "사용자 역할", example = "USER")
private final UserRole userRole;

@Schema(description = "GitHub URL", example = "https://github.com/example")
private final String githubUrl;

@Schema(description = "블로그 URL", example = "https://blog.example.com")
private final String blogUrl;

@Schema(description = "프로필 이미지 URL", example = "https://cdn.example.com/image.jpg")
private final String profileImageUrl;

@Schema(description = "자기소개", example = "안녕하세요, 백엔드 개발자입니다.")
private final String introduction;

@Schema(description = "사용자 티어", example = "GOLD")
private final Tier tier;

@Builder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
package org.ezcode.codetest.application.usermanagement.user.dto.response;

public record WithdrawUserResponse(String message) {
}
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "회원 탈퇴 응답 DTO")
public record WithdrawUserResponse(
@Schema(description = "응답 메시지", example = "회원 탈퇴가 완료되었습니다.")
String message
) {}
Loading