-
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.
- Loading branch information
Showing
4 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/com/beotkkot/qtudy/dto/response/mypage/GetMyInterestResponseDto.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,37 @@ | ||
package com.beotkkot.qtudy.dto.response.mypage; | ||
|
||
import com.beotkkot.qtudy.common.ResponseCode; | ||
import com.beotkkot.qtudy.common.ResponseMessage; | ||
import com.beotkkot.qtudy.dto.response.ResponseDto; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
public class GetMyInterestResponseDto extends ResponseDto { | ||
|
||
private List<Long> interests; | ||
|
||
public GetMyInterestResponseDto(List<Long> interests) { | ||
super(ResponseCode.SUCCESS, ResponseMessage.SUCCESS); | ||
this.interests = interests; | ||
} | ||
|
||
public static ResponseEntity<GetMyInterestResponseDto> success(List<Long> interestIds) { | ||
GetMyInterestResponseDto result = new GetMyInterestResponseDto(interestIds); | ||
return ResponseEntity.status(HttpStatus.OK).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> noAuthentication() { | ||
ResponseDto result = new ResponseDto(ResponseCode.AUTHORIZATION_FAIL, ResponseMessage.AUTHORIZATION_FAIL); | ||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> notExistedUser() { | ||
ResponseDto result = new ResponseDto(ResponseCode.NOT_EXISTED_USER, ResponseMessage.NOT_EXISTED_USER); | ||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(result); | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/com/beotkkot/qtudy/dto/response/mypage/GetMyPageAllResponseDto.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,49 @@ | ||
package com.beotkkot.qtudy.dto.response.mypage; | ||
|
||
import com.beotkkot.qtudy.common.ResponseCode; | ||
import com.beotkkot.qtudy.common.ResponseMessage; | ||
import com.beotkkot.qtudy.dto.object.PostListItem; | ||
import com.beotkkot.qtudy.dto.response.ResponseDto; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
import java.util.List; | ||
|
||
|
||
@Getter | ||
public class GetMyPageAllResponseDto extends ResponseDto { | ||
private int page; | ||
private int totalPages; | ||
private List<PostListItem> postList; | ||
|
||
public GetMyPageAllResponseDto(List<PostListItem> postListItem, int page, int totalPages) { | ||
super(ResponseCode.SUCCESS, ResponseMessage.SUCCESS); | ||
this.page = page; | ||
this.totalPages = totalPages; | ||
this.postList = postListItem; | ||
} | ||
|
||
public static ResponseEntity<GetMyPageAllResponseDto> success(List<PostListItem> postListItem, int page, int totalPages) { | ||
GetMyPageAllResponseDto result = new GetMyPageAllResponseDto(postListItem, page, totalPages); | ||
return ResponseEntity.status(HttpStatus.OK).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> notExistedPost(){ | ||
ResponseDto result = new ResponseDto(ResponseCode.NOT_EXISTED_POST, ResponseMessage.NOT_EXISTED_POST); | ||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> notExistedUser() { | ||
ResponseDto result = new ResponseDto(ResponseCode.NOT_EXISTED_USER, ResponseMessage.NOT_EXISTED_USER); | ||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> noAuthentication() { | ||
ResponseDto result = new ResponseDto(ResponseCode.AUTHORIZATION_FAIL, ResponseMessage.AUTHORIZATION_FAIL); | ||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(result); | ||
} | ||
} | ||
|
||
|
||
|
41 changes: 41 additions & 0 deletions
41
src/main/java/com/beotkkot/qtudy/dto/response/mypage/GetMyPageInfoResponseDto.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,41 @@ | ||
package com.beotkkot.qtudy.dto.response.mypage; | ||
|
||
import com.beotkkot.qtudy.common.ResponseCode; | ||
import com.beotkkot.qtudy.common.ResponseMessage; | ||
import com.beotkkot.qtudy.domain.user.Users; | ||
import com.beotkkot.qtudy.dto.response.ResponseDto; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
@Getter | ||
public class GetMyPageInfoResponseDto extends ResponseDto { | ||
|
||
private String name; | ||
private String profileImageUrl; | ||
private String email; | ||
|
||
@Builder | ||
private GetMyPageInfoResponseDto(Users user, String email) { | ||
super(ResponseCode.SUCCESS, ResponseMessage.SUCCESS); | ||
this.name = user.getName(); | ||
this.email = email; | ||
this.profileImageUrl = null; | ||
} | ||
|
||
public static ResponseEntity<GetMyPageInfoResponseDto> success(Users user, String email) { | ||
GetMyPageInfoResponseDto result = new GetMyPageInfoResponseDto(user, email); | ||
return ResponseEntity.status(HttpStatus.OK).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> noAuthentication() { | ||
ResponseDto result = new ResponseDto(ResponseCode.AUTHORIZATION_FAIL, ResponseMessage.AUTHORIZATION_FAIL); | ||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> notExistedUser() { | ||
ResponseDto result = new ResponseDto(ResponseCode.NOT_EXISTED_USER, ResponseMessage.NOT_EXISTED_USER); | ||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(result); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/beotkkot/qtudy/dto/response/mypage/MyInterestResponseDto.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,39 @@ | ||
package com.beotkkot.qtudy.dto.response.mypage; | ||
|
||
import com.beotkkot.qtudy.common.ResponseCode; | ||
import com.beotkkot.qtudy.common.ResponseMessage; | ||
import com.beotkkot.qtudy.dto.response.ResponseDto; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
@Getter | ||
public class MyInterestResponseDto extends ResponseDto { | ||
|
||
public MyInterestResponseDto() { | ||
super(ResponseCode.SUCCESS, ResponseMessage.SUCCESS); | ||
|
||
} | ||
|
||
public static ResponseEntity<MyInterestResponseDto> success() { | ||
MyInterestResponseDto result = new MyInterestResponseDto(); | ||
return ResponseEntity.status(HttpStatus.OK).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> notExistedUser() { | ||
ResponseDto result = new ResponseDto(ResponseCode.NOT_EXISTED_USER, ResponseMessage.NOT_EXISTED_USER); | ||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> noAuthentication() { | ||
ResponseDto result = new ResponseDto(ResponseCode.AUTHORIZATION_FAIL, ResponseMessage.AUTHORIZATION_FAIL); | ||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(result); | ||
} | ||
|
||
public static ResponseEntity<ResponseDto> inputFailed() { | ||
ResponseDto result = new ResponseDto(ResponseCode.INVALID_FORMAT, ResponseMessage.INVALID_FORMAT); | ||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(result); | ||
} | ||
|
||
|
||
} |