-
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.
Merge pull request #167 from PSR-Co/refactor/166-assember-to-dto
[refactor] Assembler 함수 -> DTO, Entity 이전
- Loading branch information
Showing
18 changed files
with
200 additions
and
205 deletions.
There are no files selected for viewing
50 changes: 0 additions & 50 deletions
50
src/main/kotlin/com/psr/psr/cs/dto/assembler/CsAssembler.kt
This file was deleted.
Oops, something went wrong.
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,5 +1,17 @@ | ||
package com.psr.psr.cs.dto.response | ||
|
||
import com.psr.psr.cs.entity.Faq | ||
import java.util.stream.Collectors | ||
|
||
data class FaqListRes ( | ||
val faqLists: List<FaqRes>? | ||
) | ||
){ | ||
companion object{ | ||
fun toFaqListRes(faqList: List<Faq>?) : FaqListRes { | ||
if(faqList!!.isEmpty()) return FaqListRes(null) | ||
return FaqListRes(faqList.stream().map { | ||
f -> FaqRes(f.id, f.type.value, f.title) | ||
}.collect(Collectors.toList())) | ||
} | ||
} | ||
} |
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,11 +1,18 @@ | ||
package com.psr.psr.cs.dto.response | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude | ||
import com.psr.psr.cs.entity.Faq | ||
|
||
data class FaqRes ( | ||
val faqId: Long, | ||
val type: String, | ||
val title: String, | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
val content: String?= null, | ||
) | ||
){ | ||
companion object{ | ||
fun toFaqRes(faq: Faq): FaqRes { | ||
return FaqRes(faq.id, faq.type.value, faq.title, faq.content) | ||
} | ||
} | ||
} |
21 changes: 20 additions & 1 deletion
21
src/main/kotlin/com/psr/psr/cs/dto/response/NoticeListRes.kt
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,5 +1,24 @@ | ||
package com.psr.psr.cs.dto.response | ||
|
||
import com.psr.psr.cs.dto.response.NoticeRes.Companion.toNoticeResHome | ||
import com.psr.psr.cs.entity.Notice | ||
import java.util.stream.Collectors | ||
|
||
data class NoticeListRes ( | ||
val noticeLists: List<NoticeRes>? | ||
) | ||
){ | ||
companion object{ | ||
fun toNoticeListRes(noticeList: List<Notice>?): NoticeListRes { | ||
if (noticeList!!.isEmpty()) return NoticeListRes(null) | ||
return NoticeListRes(noticeList.stream().map { | ||
n -> NoticeRes(n.id, n.title, n.createdAt) | ||
}.collect(Collectors.toList())) | ||
} | ||
|
||
fun toNoticeListResForHomePage(noticeList: List<Notice>?): NoticeListRes { | ||
return NoticeListRes( | ||
noticeLists = noticeList?.map { n -> toNoticeResHome(n) }!!.toList() | ||
) | ||
} | ||
} | ||
} |
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
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: 11 additions & 1 deletion
12
src/main/kotlin/com/psr/psr/user/dto/UserInterestListDto.kt
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,5 +1,15 @@ | ||
package com.psr.psr.user.dto | ||
|
||
import com.psr.psr.user.entity.UserInterest | ||
|
||
data class UserInterestListDto ( | ||
val interestList: List<UserInterestDto>? | ||
) | ||
){ | ||
companion object{ | ||
fun toUserInterestListDto(interests: List<UserInterest>?): UserInterestListDto { | ||
return UserInterestListDto( | ||
interestList = interests?.map { i -> UserInterestDto(i.category.value) }?.toList() | ||
) | ||
} | ||
} | ||
} |
113 changes: 0 additions & 113 deletions
113
src/main/kotlin/com/psr/psr/user/dto/assembler/UserAssembler.kt
This file was deleted.
Oops, something went wrong.
9 changes: 8 additions & 1 deletion
9
src/main/kotlin/com/psr/psr/user/dto/eidReq/BusinessListReq.kt
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,10 +1,17 @@ | ||
package com.psr.psr.user.dto.eidReq | ||
|
||
import com.psr.psr.user.dto.request.UserEidReq | ||
import jakarta.validation.constraints.NotBlank | ||
import java.util.* | ||
|
||
data class BusinessListReq ( | ||
@field:NotBlank | ||
val businesses: List<Business> | ||
){ | ||
|
||
companion object{ | ||
fun toUserEidList(userEidReq: UserEidReq): BusinessListReq { | ||
val business = Business(userEidReq.number, userEidReq.companyDate, userEidReq.ownerName, userEidReq.companyName) | ||
return BusinessListReq(Collections.singletonList(business)) | ||
} | ||
} | ||
} |
Oops, something went wrong.