Skip to content

Commit

Permalink
[feat][#53] DTO 관련 수정
Browse files Browse the repository at this point in the history
- NicknameRequest 이동
- Profile 관련 ProfileRequest로 통합해서 관리
- Logout, Refresh 나누기
  • Loading branch information
ProtoSeo committed Jul 22, 2022
1 parent fefad2d commit 0c41420
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 84 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package kr.startoff.backend.domain.user.dto.request;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class LogoutRequest {
@NotBlank
private String uuid;

@NotBlank
private String accessToken;

public LogoutRequest(String uuid, String accessToken) {
this.uuid = uuid;
this.accessToken = accessToken;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package kr.startoff.backend.domain.user.dto.request;

import lombok.Getter;

@Getter
public class NicknameRequest {
String nickname;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package kr.startoff.backend.domain.user.dto.request;

import kr.startoff.backend.domain.user.domain.Profile;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
public class ProfileRequest {
private String githubUrl;
private String blogUrl;
private String baekjoonId;
private String introduce;

public Profile toEntity() {
return Profile.builder()
.githubUrl(githubUrl)
.blogUrl(blogUrl)
.baekjoonId(baekjoonId)
.introduce(introduce)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Getter
@NoArgsConstructor
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class RefreshOrLogoutRequest {
public class RefreshRequest {
@NotBlank
private String uuid;

Expand All @@ -23,7 +23,7 @@ public class RefreshOrLogoutRequest {
@NotBlank
private String accessToken;

public RefreshOrLogoutRequest(String uuid, String email, String accessToken) {
public RefreshRequest(String uuid, String email, String accessToken) {
this.uuid = uuid;
this.email = email;
this.accessToken = accessToken;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kr.startoff.backend.domain.user.dto.request.profile;
package kr.startoff.backend.domain.user.dto.request;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
Expand Down

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
@@ -1,38 +1,38 @@
package kr.startoff.backend.domain.user.dto.response;

import java.util.List;
import java.util.stream.Collectors;

import javax.validation.constraints.NotBlank;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import kr.startoff.backend.domain.user.domain.User;
import kr.startoff.backend.domain.project.dto.ProjectResponse;
import kr.startoff.backend.domain.tag.dto.SkillTagResponse;
import kr.startoff.backend.domain.user.domain.Profile;
import lombok.Builder;
import lombok.Getter;

@Getter
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class UserProfileResponse {
@NotBlank
private String nickname;
private String introduce;
private String imageUrl;
private String githubUrl;
private String blogUrl;
private String baekjoonId;
private List<ProjectResponse> projects;
private List<SkillTagResponse> userSkills;

public UserProfileResponse(User user) {
this.nickname = user.getNickname();
this.introduce = user.getIntroduce();
this.imageUrl = user.getImageUrl();
this.githubUrl = user.getGithubUrl();
this.blogUrl = user.getBlogUrl();
this.baekjoonId = user.getBaekjoonId();
private UserProfileResponse(Profile profile) {
this.introduce = profile.getIntroduce();
this.githubUrl = profile.getGithubUrl();
this.blogUrl = profile.getBlogUrl();
this.baekjoonId = profile.getBaekjoonId();
}

public static UserProfileResponse from(Profile profile) {
return new UserProfileResponse(profile);
// TODO 수정 필요
// this.projects = user.getProjects().stream().map(ProjectResponse::new).collect(Collectors.toList());
// this.userSkills = user.getUserSkills().stream().map(SkillTagResponse::new).collect(Collectors.toList());
Expand Down

0 comments on commit 0c41420

Please sign in to comment.