Skip to content

Commit

Permalink
Merge pull request #418 from GSM-MSG/feature/417_modify_the_methods_o…
Browse files Browse the repository at this point in the history
…f_transfor_data_between_data_layer_and_domain_layer

🔀  :: (#417) - modify the methods of transfer data between data layer and domain layer
  • Loading branch information
leehyeonbin authored Apr 15, 2023
2 parents 8cbd626 + 678ba18 commit b04c393
Show file tree
Hide file tree
Showing 25 changed files with 174 additions and 221 deletions.
28 changes: 0 additions & 28 deletions app/src/main/java/com/msg/gcms/data/mapper/ApplicantMapper.kt

This file was deleted.

16 changes: 0 additions & 16 deletions app/src/main/java/com/msg/gcms/data/mapper/AuthMapper.kt

This file was deleted.

54 changes: 0 additions & 54 deletions app/src/main/java/com/msg/gcms/data/mapper/ClubMapper.kt

This file was deleted.

31 changes: 0 additions & 31 deletions app/src/main/java/com/msg/gcms/data/mapper/ClubMemberMapper.kt

This file was deleted.

11 changes: 0 additions & 11 deletions app/src/main/java/com/msg/gcms/data/mapper/ImageMapper.kt

This file was deleted.

53 changes: 0 additions & 53 deletions app/src/main/java/com/msg/gcms/data/mapper/UserMapper.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.msg.gcms.data.remote.dto.applicant.get_applicant_list

import com.google.gson.annotations.SerializedName
import com.msg.gcms.domain.data.applicant.get_applicant_list.ApplicantListData
import java.util.UUID

data class ApplicantListResponse (
data class ApplicantListResponse(
@SerializedName("uuid")
val uuid: UUID,
@SerializedName("email")
Expand All @@ -18,4 +19,16 @@ data class ApplicantListResponse (
val number: Int,
@SerializedName("profileImg")
val profileImg: String?
)
)

fun ApplicantListResponse.toApplicantListData(): ApplicantListData {
return ApplicantListData(
uuid = uuid,
email = email,
name = name,
grade = grade,
classNum = classNum,
number = number,
profileImg = profileImg
)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
package com.msg.gcms.data.remote.dto.applicant.get_applicant_list

import com.google.gson.annotations.SerializedName
import com.msg.gcms.domain.data.applicant.get_applicant_list.GetApplicantListData

data class GetApplicantListResponse(
@SerializedName("scope")
val userScope: String,
@SerializedName("applicantList")
val applicantList: List<ApplicantListResponse>
)

fun GetApplicantListResponse.toApplicantListData(): GetApplicantListData {
return GetApplicantListData(
applicantList = applicantList.map { it.toApplicantListData() },
userScope = userScope
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.msg.gcms.data.remote.dto.auth.response

import com.google.gson.annotations.SerializedName
import com.msg.gcms.domain.data.auth.SignInResponseData

data class SignInResponse(
@SerializedName("accessToken")
Expand All @@ -12,3 +13,12 @@ data class SignInResponse(
@SerializedName("refreshExp")
val refreshExp: String
)

fun SignInResponse.toSignInData(): SignInResponseData {
return SignInResponseData(
accessToken = accessToken,
refreshToken = refreshToken,
accessExp = accessExp,
refreshExp = refreshExp
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.msg.gcms.data.remote.dto.club.get_club_detail

import com.google.gson.annotations.SerializedName
import com.msg.gcms.domain.data.club.get_club_detail.ClubDetailData

data class ClubDetailResponse(
@SerializedName("id")
Expand Down Expand Up @@ -32,3 +33,22 @@ data class ClubDetailResponse(
@SerializedName("isApplied")
val isApplied: Boolean
)

fun ClubDetailResponse.toClubDetailData(): ClubDetailData {
return ClubDetailData(
activityImgs = activityImgs,
bannerImg = bannerImg,
contact = contact,
content = content,
head = head.toClubMemberData(),
id = id,
isApplied = isApplied,
isOpened = isOpened,
member = member.map { it.toClubMemberData() },
name = name,
notionLink = notionLink,
scope = scope,
teacher = teacher,
type = type
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.msg.gcms.data.remote.dto.club.get_club_detail

import com.google.gson.annotations.SerializedName
import com.msg.gcms.domain.data.club.get_club_detail.ClubMemberData
import java.util.UUID

data class ClubMemberResponse(
Expand All @@ -19,3 +20,15 @@ data class ClubMemberResponse(
@SerializedName("profileImg")
val userImg: String?,
)

fun ClubMemberResponse.toClubMemberData(): ClubMemberData {
return ClubMemberData(
uuid = uuid,
email = email,
`class` = `class`,
grade = grade,
name = name,
num = num,
userImg = userImg
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.msg.gcms.data.remote.dto.club.get_club_list

import com.google.gson.annotations.SerializedName
import com.msg.gcms.domain.data.club.get_club_list.GetClubListData

data class GetClubListResponse(
@SerializedName("id")
Expand All @@ -12,3 +13,12 @@ data class GetClubListResponse(
@SerializedName("bannerImg")
val bannerUrl: String
)

fun GetClubListResponse.toClubListData(): GetClubListData {
return GetClubListData(
id = id,
bannerUrl = bannerUrl,
title = title,
type = type
)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
package com.msg.gcms.data.remote.dto.club_member.get_club_member

import com.google.gson.annotations.SerializedName
import com.msg.gcms.domain.data.club_member.get_club_member.GetClubMemberData

data class GetClubMemberResponse(
@SerializedName("scope")
val userScope: String,
@SerializedName("clubMember")
val requestUser: List<MemberResponse>
)

fun GetClubMemberResponse.toClubMemberData(): GetClubMemberData {
return GetClubMemberData(
userScope = userScope,
requestUser = requestUser.map {
it.toMemberData()
}
)
}
Loading

0 comments on commit b04c393

Please sign in to comment.