-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Ref] UserController 응답 양식 통일
- Loading branch information
Showing
13 changed files
with
273 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
pluginManagement { | ||
plugins { | ||
id 'org.jetbrains.kotlin.jvm' version '1.9.23' | ||
} | ||
} | ||
plugins { | ||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' | ||
} | ||
rootProject.name = 'CoffeeChat' |
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
17 changes: 17 additions & 0 deletions
17
src/main/java/com/soongsil/CoffeeChat/controller/exception/enums/UserErrorCode.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,17 @@ | ||
package com.soongsil.CoffeeChat.controller.exception.enums; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.HttpStatusCode; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum UserErrorCode { | ||
USER_NOT_FOUND(HttpStatus.NOT_FOUND, "USER_404", "해당 USER의 엔티티가 존재하지 않습니다."), | ||
USER_SMS_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "USER_500", "SMS 전송에 실패했습니다."); | ||
|
||
private final HttpStatusCode httpStatusCode; | ||
private final String errorCode; | ||
private final String errorMessage; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/soongsil/CoffeeChat/dto/UserController/MenteeInfoDto.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,20 @@ | ||
package com.soongsil.CoffeeChat.dto.UserController; | ||
|
||
import com.soongsil.CoffeeChat.entity.Mentee; | ||
import com.soongsil.CoffeeChat.enums.PartEnum; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class MenteeInfoDto { | ||
private PartEnum part; | ||
|
||
public static MenteeInfoDto toDto(Mentee mentee){ | ||
return MenteeInfoDto.builder() | ||
.part(mentee.getPart()) | ||
.build(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/soongsil/CoffeeChat/dto/UserController/MentorInfoDto.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.soongsil.CoffeeChat.dto.UserController; | ||
|
||
import com.soongsil.CoffeeChat.entity.Introduction; | ||
import com.soongsil.CoffeeChat.entity.Mentor; | ||
import com.soongsil.CoffeeChat.enums.ClubEnum; | ||
import com.soongsil.CoffeeChat.enums.PartEnum; | ||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class MentorInfoDto { | ||
private PartEnum part; | ||
private ClubEnum club; | ||
private Long introductionId; | ||
|
||
public static MentorInfoDto toDto(Mentor mentor){ | ||
return MentorInfoDto.builder() | ||
.part(mentor.getPart()) | ||
.club(mentor.getClub()) | ||
.introductionId(mentor.getIntroduction().getId()) | ||
.build(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/soongsil/CoffeeChat/dto/UserController/UserInfoDto.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.soongsil.CoffeeChat.dto.UserController; | ||
|
||
|
||
import com.soongsil.CoffeeChat.entity.User; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class UserInfoDto { | ||
private String username; | ||
private String name; | ||
private String email; | ||
private String role; | ||
private String phoneNum; //전화번호 | ||
private String picture; | ||
|
||
public static UserInfoDto toDto(User user){ | ||
return UserInfoDto.builder(). | ||
username(user.getUsername()). | ||
name(user.getName()). | ||
email(user.getEmail()). | ||
role(user.getRole()). | ||
phoneNum(user.getPhoneNum()). | ||
picture(user.getPicture()) | ||
.build(); | ||
} | ||
|
||
|
||
} |
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
Oops, something went wrong.