Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR/#220] 공고 상세 뷰 / 리팩토링 #230

Merged
merged 15 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.response.InternInfoModel
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(): InternInfoModel {
return InternInfoModel(
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
@@ -0,0 +1,23 @@
package com.terning.data.mapper.intern

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

fun InternResponseDto.toInternInfo(): InternInfo =
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,15 +1,15 @@
package com.terning.data.repositoryimpl

import com.terning.data.datasource.InternDataSource
import com.terning.domain.entity.response.InternInfoModel
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<InternInfoModel> =
runCatching {
internDataSource.getInternInfo(id).result.toInternEntity()
}
override suspend fun getInternInfo(id: Long): Result<InternInfo> = runCatching {
internDataSource.getInternInfo(id).result.toInternInfo()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terning.domain.entity.response
package com.terning.domain.entity.intern

data class InternInfoModel(
data class InternInfo(
val dDay: String,
val title: String,
val deadline: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terning.domain.repository

import com.terning.domain.entity.response.InternInfoModel
import com.terning.domain.entity.intern.InternInfo

interface InternRepository {
suspend fun getInternInfo(id: Long): Result<InternInfoModel>
suspend fun getInternInfo(id: Long): Result<InternInfo>
}
Loading
Loading