-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: dto 빌더 클래스 레벨로 변경 및 정적 메서드 사용
- Loading branch information
Showing
20 changed files
with
91 additions
and
157 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
17 changes: 12 additions & 5 deletions
17
src/main/java/com/timcooki/jnuwiki/domain/docs/DTO/response/NewApproveResDTO.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 |
---|---|---|
@@ -1,20 +1,27 @@ | ||
package com.timcooki.jnuwiki.domain.docs.DTO.response; | ||
|
||
import com.timcooki.jnuwiki.domain.docs.entity.Docs; | ||
import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation; | ||
import com.timcooki.jnuwiki.domain.docsRequest.entity.DocsCategory; | ||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import lombok.Builder; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Builder | ||
public record NewApproveResDTO( | ||
Long id, | ||
String docsName, | ||
String docsCategory, | ||
DocsLocation docsLocation, | ||
String docsCreatedAt | ||
){ | ||
@Builder | ||
public NewApproveResDTO { | ||
|
||
public static NewApproveResDTO of(Docs docs){ | ||
return NewApproveResDTO.builder() | ||
.id(docs.getDocsId()) | ||
.docsCategory(docs.getDocsCategory().getCategory()) | ||
.docsName(docs.getDocsName()) | ||
.docsLocation(docs.getDocsLocation()) | ||
.docsCreatedAt(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"))) | ||
.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
6 changes: 1 addition & 5 deletions
6
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/request/CheckNicknameReqDTO.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 |
---|---|---|
@@ -1,12 +1,8 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.request; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record CheckNicknameReqDTO( | ||
String nickname | ||
) { | ||
@Builder | ||
public CheckNicknameReqDTO{ | ||
|
||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/request/EditNicknameReqDTO.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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.request; | ||
|
||
import lombok.Builder; | ||
|
||
public record EditNicknameReqDTO(String nickname) { | ||
@Builder | ||
public EditNicknameReqDTO { | ||
} | ||
@Builder | ||
public record EditNicknameReqDTO( | ||
String nickname | ||
) { | ||
} |
9 changes: 4 additions & 5 deletions
9
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/request/EditPasswordReqDTO.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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.request; | ||
|
||
import lombok.Builder; | ||
|
||
public record EditPasswordReqDTO(String password) { | ||
@Builder | ||
public EditPasswordReqDTO { | ||
} | ||
@Builder | ||
public record EditPasswordReqDTO( | ||
String password | ||
) { | ||
} |
6 changes: 1 addition & 5 deletions
6
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/request/JoinReqDTO.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 |
---|---|---|
@@ -1,14 +1,10 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.request; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record JoinReqDTO( | ||
String email, | ||
String nickName, | ||
String password | ||
) { | ||
@Builder | ||
public JoinReqDTO{ | ||
|
||
} | ||
} |
6 changes: 1 addition & 5 deletions
6
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/response/InfoResDTO.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 |
---|---|---|
@@ -1,14 +1,10 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.response; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record InfoResDTO( | ||
Long id, | ||
String nickname, | ||
String password | ||
) { | ||
@Builder | ||
public InfoResDTO{ | ||
|
||
} | ||
} |
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
11 changes: 8 additions & 3 deletions
11
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/response/ReadResDTO.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 |
---|---|---|
@@ -1,14 +1,19 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.response; | ||
|
||
import com.timcooki.jnuwiki.domain.member.entity.Member; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ReadResDTO( | ||
Long id, | ||
String nickName, | ||
String password | ||
) { | ||
@Builder | ||
public ReadResDTO{ | ||
|
||
public static ReadResDTO of(Member member) { | ||
return ReadResDTO.builder() | ||
.id(member.getMemberId()) | ||
.nickName(member.getNickName()) | ||
.password(member.getPassword()) | ||
.build(); | ||
} | ||
} |
14 changes: 11 additions & 3 deletions
14
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/response/ScrapListResDTO.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 |
---|---|---|
@@ -1,16 +1,24 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.response; | ||
|
||
import com.timcooki.jnuwiki.domain.docs.entity.Docs; | ||
import com.timcooki.jnuwiki.domain.member.entity.Member; | ||
import lombok.Builder; | ||
|
||
import java.util.List; | ||
import org.springframework.data.domain.Page; | ||
|
||
@Builder | ||
public record ScrapListResDTO( | ||
List<ScrapResDTO> scrapList, | ||
int totalPages | ||
) { | ||
|
||
@Builder | ||
public ScrapListResDTO { | ||
public static ScrapListResDTO of(Page<Docs> docs, Member member) { | ||
return ScrapListResDTO.builder() | ||
.scrapList(docs.stream() | ||
.map(d -> ScrapResDTO.of(d, member)) | ||
.toList()) | ||
.totalPages(docs.getTotalPages()) | ||
.build(); | ||
} | ||
} | ||
|
14 changes: 11 additions & 3 deletions
14
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/response/ScrapResDTO.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 |
---|---|---|
@@ -1,16 +1,24 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.response; | ||
|
||
import com.timcooki.jnuwiki.domain.docs.entity.Docs; | ||
import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation; | ||
import com.timcooki.jnuwiki.domain.member.entity.Member; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ScrapResDTO( | ||
Long docsId, | ||
String docsName, | ||
String docsCategory, | ||
DocsLocation docsRequestLocation, | ||
String member | ||
) { | ||
@Builder | ||
public ScrapResDTO { | ||
public static ScrapResDTO of(Docs docs, Member member) { | ||
return ScrapResDTO.builder() | ||
.docsId(docs.getDocsId()) | ||
.docsName(docs.getDocsName()) | ||
.docsCategory(docs.getDocsCategory().getCategory()) | ||
.docsRequestLocation(docs.getDocsLocation()) | ||
.member(member.getNickName()) | ||
.build(); | ||
} | ||
} |
6 changes: 1 addition & 5 deletions
6
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/response/WrapLoginResDTO.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 |
---|---|---|
@@ -1,16 +1,12 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.response; | ||
|
||
import com.timcooki.jnuwiki.util.ApiResult; | ||
import lombok.Builder; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@Builder | ||
public record WrapLoginResDTO<T>( | ||
HttpHeaders headers, | ||
LoginResDTO body | ||
|
||
) { | ||
@Builder | ||
public WrapLoginResDTO{ | ||
} | ||
} |
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
12 changes: 2 additions & 10 deletions
12
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/response/admin/EditReadResDTO.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 |
---|---|---|
@@ -1,24 +1,16 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.response.admin; | ||
|
||
import com.timcooki.jnuwiki.domain.docs.entity.Docs; | ||
import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation; | ||
import com.timcooki.jnuwiki.domain.docsRequest.entity.DocsCategory; | ||
import com.timcooki.jnuwiki.domain.docsRequest.entity.DocsRequestType; | ||
import lombok.Builder; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Builder | ||
public record EditReadResDTO( | ||
Long docsRequestId, | ||
Long docsId, // 수정하려는 문서 | ||
Long docsId, | ||
DocsRequestType docsRequestType, | ||
String docsRequestCategory, | ||
String docsRequestName, | ||
DocsLocation docsRequestLocation | ||
) { | ||
@Builder | ||
public EditReadResDTO { | ||
|
||
} | ||
|
||
} |
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
7 changes: 1 addition & 6 deletions
7
src/main/java/com/timcooki/jnuwiki/domain/member/DTO/response/admin/NewReadResDTO.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 |
---|---|---|
@@ -1,20 +1,15 @@ | ||
package com.timcooki.jnuwiki.domain.member.DTO.response.admin; | ||
|
||
import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation; | ||
import com.timcooki.jnuwiki.domain.docsRequest.entity.DocsCategory; | ||
import com.timcooki.jnuwiki.domain.docsRequest.entity.DocsRequestType; | ||
import lombok.Builder; | ||
|
||
|
||
@Builder | ||
public record NewReadResDTO( | ||
Long docsRequestId, | ||
DocsRequestType docsRequestType, | ||
String docsRequestCategory, | ||
String docsRequestName, | ||
DocsLocation docsRequestLocation | ||
) { | ||
@Builder | ||
public NewReadResDTO { | ||
|
||
} | ||
} |
Oops, something went wrong.