Skip to content

Commit

Permalink
refcator
Browse files Browse the repository at this point in the history
  • Loading branch information
PruthiviRaj27 committed Apr 6, 2023
1 parent 73d81ab commit 45369b9
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions course/src/main/java/in/testpress/course/domain/DomainContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -203,36 +203,32 @@ fun createDomainContent(content: Content): DomainContent {
)
}

fun createDomainContent(content: ContentEntityLite): DomainContent {
fun ContentEntityLite.asDomainContent(): DomainContent {
return DomainContent(
id = content.id,
order = content.order,
chapterId = content.chapterId,
freePreview = content.freePreview,
title = content.title,
courseId = content.courseId,
examId = content.examId,
videoId = content.videoId,
attachmentId = content.attachmentId,
contentType = content.contentType,
start = content.start,
end = content.end,
treePath = content.treePath,
icon = content.icon,
id = this.id,
order = this.order,
chapterId = this.chapterId,
freePreview = this.freePreview,
title = this.title,
courseId = this.courseId,
examId = this.examId,
videoId = this.videoId,
attachmentId = this.attachmentId,
contentType = this.contentType,
start = this.start,
end = this.end,
treePath = this.treePath,
icon = this.icon,
isLocked = null,
isScheduled = null,
active = null,
hasEnded = null,
isCourseAvailable = null,
hasStarted = null,
type = content.type
type = this.type
)
}

fun <T>T.asDomainContent(): DomainContent {
return createDomainContent(this as ContentEntityLite)
}

fun ContentEntity.asDomainContent(): DomainContent {
return createDomainContent(this)
}
Expand Down

0 comments on commit 45369b9

Please sign in to comment.