Skip to content

Commit

Permalink
[FEAT/#220] InternInfoMapper 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
arinming committed Sep 6, 2024
1 parent cc8b5d5 commit 2e3023e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.terning.data.dto.response

import com.terning.domain.entity.intern.InternInfo
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down Expand Up @@ -36,24 +35,4 @@ data class InternResponseDto(
val url: String,
@SerialName("scrapId")
val scrapId: Long? = null,
) {
fun toInternEntity(): InternInfo {
return InternInfo(
dDay = dDay,
title = title,
deadline = deadline,
workingPeriod = workingPeriod,
startDate = startDate,
scrapCount = scrapCount,
viewCount = viewCount,
company = company,
companyCategory = companyCategory,
companyImage = companyImage,
qualification = qualification,
jobType = jobType,
detail = detail,
url = url,
scrapId = scrapId
)
}
}
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.terning.data.mapper.intern

import com.terning.data.dto.response.InternResponseDto
import com.terning.domain.entity.intern.InternInfo

fun InternInfo.toInternInfo(): InternInfo =
fun InternResponseDto.toInternInfo(): InternInfo =
InternInfo(
dDay = dDay,
title = title,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.terning.data.repositoryimpl

import com.terning.data.datasource.InternDataSource
import com.terning.data.mapper.intern.toInternInfo
import com.terning.domain.entity.intern.InternInfo
import com.terning.domain.repository.InternRepository
import javax.inject.Inject

class InternRepositoryImpl @Inject constructor(
private val internDataSource: InternDataSource,
) : InternRepository {
override suspend fun getInternInfo(id: Long): Result<InternInfo> =
runCatching {
internDataSource.getInternInfo(id).result.toInternEntity()
}
override suspend fun getInternInfo(id: Long): Result<InternInfo> = runCatching {
internDataSource.getInternInfo(id).result.toInternInfo()
}
}

0 comments on commit 2e3023e

Please sign in to comment.