Skip to content

Commit

Permalink
🔀 :: (#658) 매핑 함수 private으로 전체 변환
Browse files Browse the repository at this point in the history
🔀 :: (#658) 매핑 함수 private으로 전체 변환
  • Loading branch information
parkuiery authored Aug 21, 2024
2 parents 15a4ea9 + a42e1a4 commit d7f016b
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import team.aliens.dms.android.core.school.Features
import team.aliens.dms.android.network.auth.model.SignInResponse
import team.aliens.dms.android.shared.date.toLocalDateTime

fun SignInResponse.extractTokens(): Tokens = Tokens(
internal fun SignInResponse.extractTokens(): Tokens = Tokens(
accessToken = AccessToken(
value = this.accessToken,
expiration = this.accessTokenExpiration.toLocalDateTime(),
Expand All @@ -18,7 +18,7 @@ fun SignInResponse.extractTokens(): Tokens = Tokens(
),
)

fun SignInResponse.extractFeatures(): Features = Features(
internal fun SignInResponse.extractFeatures(): Features = Features(
mealService = this.features.mealService,
noticeService = this.features.noticeService,
pointService = this.features.pointService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal fun MealEntity.toModel() = Meal(

internal fun List<Meal>.toEntity() = this.map(Meal::toEntity)

internal fun Meal.toEntity() = MealEntity(
private fun Meal.toEntity() = MealEntity(
date = this.date,
breakfast = this.breakfast,
kcalOfBreakfast = this.kcalOfBreakfast,
Expand All @@ -29,10 +29,10 @@ internal fun Meal.toEntity() = MealEntity(

internal fun FetchMealsResponse.toModel(): List<Meal> = this.meals.toModel()

internal fun List<FetchMealsResponse.MealResponse>.toModel(): List<Meal> =
private fun List<FetchMealsResponse.MealResponse>.toModel(): List<Meal> =
this.map(FetchMealsResponse.MealResponse::toModel)

internal fun FetchMealsResponse.MealResponse.toModel(): Meal = Meal(
private fun FetchMealsResponse.MealResponse.toModel(): Meal = Meal(
date = this.date.toLocalDate(),
breakfast = this.breakfast.dropLast(1),
kcalOfBreakfast = this.breakfast.last(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,17 @@ import team.aliens.dms.android.shared.date.toLocalDateTime

internal fun List<NoticeEntity>.toModel() = this.map(NoticeEntity::toModel)

internal fun Notice.toEntity() = NoticeEntity(
private fun NoticeEntity.toModel() = Notice(
id = this.id,
title = this.title,
content = this.content,
createdAt = this.createdAt,
)

internal fun NoticeEntity.toModel() = Notice(
id = this.id,
title = this.title,
content = this.content,
createdAt = this.createdAt,
)

internal fun List<Notice>.toEntity() = this.map(Notice::toEntity)

internal fun FetchNoticesResponse.toModel(): List<Notice> =
this.notices.map(FetchNoticesResponse.NoticeResponse::toModel)

internal fun FetchNoticesResponse.NoticeResponse.toModel(): Notice = Notice(
private fun FetchNoticesResponse.NoticeResponse.toModel(): Notice = Notice(
id = this.id,
title = this.title,
content = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ internal fun FetchPointsResponse.toModel(): PointStatus = PointStatus(
points = this.pointResponses.toModel(),
)

internal fun List<FetchPointsResponse.PointResponse>.toModel(): List<Point> =
private fun List<FetchPointsResponse.PointResponse>.toModel(): List<Point> =
this.map(FetchPointsResponse.PointResponse::toModel)

internal fun FetchPointsResponse.PointResponse.toModel(): Point = Point(
private fun FetchPointsResponse.PointResponse.toModel(): Point = Point(
id = this.id,
date = this.date.toLocalDate(),
type = PointType.valueOf(this.type),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal fun FetchRemainsApplicationTimeResponse.toModel(): RemainsApplicationTi
internal fun FetchRemainsOptionsResponse.toModel(): List<RemainsOption> =
this.remainsOptionResponse.map(FetchRemainsOptionsResponse.RemainsOptionResponse::toModel)

internal fun FetchRemainsOptionsResponse.RemainsOptionResponse.toModel(): RemainsOption =
private fun FetchRemainsOptionsResponse.RemainsOptionResponse.toModel(): RemainsOption =
RemainsOption(
id = this.id,
title = this.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package team.aliens.dms.android.data.school.mapper
import team.aliens.dms.android.data.school.model.School
import team.aliens.dms.android.network.school.model.FetchSchoolsResponse

fun FetchSchoolsResponse.toModel(): List<School> =
internal fun FetchSchoolsResponse.toModel(): List<School> =
this.schools.map(FetchSchoolsResponse.SchoolResponse::toModel)

private fun FetchSchoolsResponse.SchoolResponse.toModel(): School = School(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import team.aliens.dms.android.data.student.model.MyPage
import team.aliens.dms.android.network.student.model.FetchMyPageResponse
import team.aliens.dms.android.shared.model.Sex

fun FetchMyPageResponse.toModel(): MyPage = MyPage(
internal fun FetchMyPageResponse.toModel(): MyPage = MyPage(
schoolName = this.schoolName,
studentName = this.studentName,
gradeClassNumber = this.gradeClassNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import team.aliens.dms.android.network.studyroom.model.FetchStudyRoomDetailsResp
import team.aliens.dms.android.network.studyroom.model.FetchStudyRoomsResponse
import team.aliens.dms.android.shared.model.Sex

fun FetchStudyRoomApplicationTimeResponse.toModel(): StudyRoomApplicationTime =
internal fun FetchStudyRoomApplicationTimeResponse.toModel(): StudyRoomApplicationTime =
StudyRoomApplicationTime(
startAt = this.startAt,
endAt = this.endAt,
)

fun FetchStudyRoomsResponse.toModel(): List<StudyRoom> =
internal fun FetchStudyRoomsResponse.toModel(): List<StudyRoom> =
this.studyRoomResponses.map(FetchStudyRoomsResponse.StudyRoomResponse::toModel)

fun FetchStudyRoomsResponse.StudyRoomResponse.toModel(): StudyRoom = StudyRoom(
private fun FetchStudyRoomsResponse.StudyRoomResponse.toModel(): StudyRoom = StudyRoom(
id = this.id,
floor = this.floor,
name = this.name,
Expand All @@ -32,7 +32,7 @@ fun FetchStudyRoomsResponse.StudyRoomResponse.toModel(): StudyRoom = StudyRoom(
isMine = this.isMine,
)

fun FetchStudyRoomDetailsResponse.toModel(): StudyRoom.Details = StudyRoom.Details(
internal fun FetchStudyRoomDetailsResponse.toModel(): StudyRoom.Details = StudyRoom.Details(
id = id,
floor = floor,
name = name,
Expand All @@ -51,10 +51,10 @@ fun FetchStudyRoomDetailsResponse.toModel(): StudyRoom.Details = StudyRoom.Detai
seats = seats.toModel(),
)

fun List<FetchStudyRoomDetailsResponse.SeatResponse>.toModel(): List<StudyRoom.Seat> =
private fun List<FetchStudyRoomDetailsResponse.SeatResponse>.toModel(): List<StudyRoom.Seat> =
this.map(FetchStudyRoomDetailsResponse.SeatResponse::toModel)

fun FetchStudyRoomDetailsResponse.SeatResponse.toModel(): StudyRoom.Seat = StudyRoom.Seat(
private fun FetchStudyRoomDetailsResponse.SeatResponse.toModel(): StudyRoom.Seat = StudyRoom.Seat(
id = this.id,
row = this.row,
column = this.column,
Expand All @@ -65,37 +65,37 @@ fun FetchStudyRoomDetailsResponse.SeatResponse.toModel(): StudyRoom.Seat = Study
student = this.student?.toModel(),
)

fun FetchStudyRoomDetailsResponse.SeatResponse.SeatTypeResponse.toModel(): StudyRoom.Seat.Type =
private fun FetchStudyRoomDetailsResponse.SeatResponse.SeatTypeResponse.toModel(): StudyRoom.Seat.Type =
StudyRoom.Seat.Type(
id = this.id,
name = this.name,
color = this.color,
)

fun FetchStudyRoomDetailsResponse.SeatResponse.StudentResponse.toModel(): StudyRoom.Seat.Student =
private fun FetchStudyRoomDetailsResponse.SeatResponse.StudentResponse.toModel(): StudyRoom.Seat.Student =
StudyRoom.Seat.Student(
id = this.id,
name = this.name,
)

fun FetchAppliedStudyRoomResponse.toModel(): AppliedStudyRoom = AppliedStudyRoom(
internal fun FetchAppliedStudyRoomResponse.toModel(): AppliedStudyRoom = AppliedStudyRoom(
floor = this.floor,
name = this.name,
)

fun FetchSeatTypesResponse.toModel(): List<StudyRoom.Seat.Type> =
internal fun FetchSeatTypesResponse.toModel(): List<StudyRoom.Seat.Type> =
this.types.map(FetchSeatTypesResponse.SeatTypeResponse::toModel)

fun FetchSeatTypesResponse.SeatTypeResponse.toModel(): StudyRoom.Seat.Type = StudyRoom.Seat.Type(
private fun FetchSeatTypesResponse.SeatTypeResponse.toModel(): StudyRoom.Seat.Type = StudyRoom.Seat.Type(
id = this.id,
name = this.name,
color = this.color,
)

fun FetchAvailableStudyRoomTimesResponse.toModel(): List<AvailableStudyRoomTime> =
internal fun FetchAvailableStudyRoomTimesResponse.toModel(): List<AvailableStudyRoomTime> =
this.availableStudyRoomTimes.map(FetchAvailableStudyRoomTimesResponse.AvailableStudyRoomTimeResponse::toModel)

fun FetchAvailableStudyRoomTimesResponse.AvailableStudyRoomTimeResponse.toModel(): AvailableStudyRoomTime =
private fun FetchAvailableStudyRoomTimesResponse.AvailableStudyRoomTimeResponse.toModel(): AvailableStudyRoomTime =
AvailableStudyRoomTime(
id = this.id,
startTime = this.startTime,
Expand Down

0 comments on commit d7f016b

Please sign in to comment.