Created
January 12, 2021 18:31
-
-
Save mitchtabian/5426d2311230e8fb0329b04456642a4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun mapFromEntity(entity: OrganisationCacheEntity): OrganisationModel { | |
return OrganisationModel( | |
children = entity.children, | |
// organisation = entity.organisation, | |
organisation = Organisation( | |
_attachments = entity.organisation._attachments, | |
_etag = entity.organisation._etag, | |
_rid = entity.organisation._rid, | |
_self = entity.organisation._self, | |
_ts = entity.organisation._ts, | |
allowOnboarding = entity.organisation.allowOnboarding, | |
calendar_url = entity.organisation.calendar_url, | |
certificate_from = entity.organisation.certificate_from, | |
code = entity.organisation.code, | |
groups = entity.organisation.groups.map { cacheGroupToDomainGroup(it) }, | |
id = entity.organisation._attachments, | |
isPublic = entity.organisation.isPublic, | |
layoutPayload = LayoutPayload( | |
sections = entity.organisation.layoutPayload.sections | |
.map{ Section( | |
id = it.sectionId, | |
itemLayout = ItemLayout( | |
columnCount = it.itemLayout.columnCount | |
), | |
order = it.order, | |
tiles = it.tiles.map{Tile( | |
backgroundColor = it.backgroundColor, | |
image = it.image, | |
itemLayout = ItemLayoutX( | |
columnSpace = it.itemLayout.columnSpace | |
), | |
metaData = MetaData( | |
isPremium = it.metadata.isPremium, | |
payloadData = PayloadData( | |
address = it.metadata.payloadData.address?: "Unknown Address", | |
contacts = it.metadata.payloadData.contacts.map { Contact( | |
email = it.email, | |
location = it.location, | |
name = it.name, | |
office = it.office, | |
telephone = it.telephone, | |
title = it.title, | |
) }, | |
courseGroup = CourseGroup( | |
courses = it.metadata.payloadData.courseGroup?.courses?.map { Course( | |
color = , // No color available in EmbeddedCourse | |
courseName = it.courseName, | |
icon = it.icon, | |
modules = it.modules.map{ Module( | |
color = it.color, | |
moduleCode = it.moduleCode, | |
moduleName = it.moduleName, | |
pages = it.pages.map { Page( | |
contentItems = it.contentItems.map { ContentItem( | |
headerImageUrl = it.headerImageUrl, | |
role = it.role, | |
url = it.url, | |
videoId = , // No videoId available in EmbeddedContentItem | |
) }, | |
icon = it.icon, | |
title = it.title | |
) }, | |
quiz = it.quiz.map { Quiz( | |
icon = it.icon, | |
quizContentItems = it.quizContentItems.map { QuizContentItem( | |
ConfidenceTest = it.ConfidenceTest.map { ConfidenceTest( | |
answer = it.answer, | |
explanationText = it.explanationText, | |
imageName = it.imageName, | |
questionText = it.questionText | |
) }, | |
DigitalCertificate = , // No DigitalCertificate in EmbeddedQuizContentItem | |
role = it.role, | |
) }, | |
title = it.title, | |
type = it.type, | |
) }, | |
)} | |
) }, | |
name = it.metadata.payloadData.courseGroup?.name ?: "Unknown course group name" | |
), | |
headerImage = it.metadata.payloadData.headerImage, // nullable? | |
latitude = it.metadata.payloadData.latitude, // nullable? | |
longitude = it.metadata.payloadData.longitude, // nullable? | |
name = it.metadata.payloadData.name, // nullable? | |
playlistId = , // No playlist id?? | |
surveys = , // no surveys? | |
twitterId = , // no twitter id? | |
url = it.metadata.payloadData.url, // nullable? | |
), | |
type = it.metadata.type | |
), | |
)}, | |
title = , | |
) }, | |
theme = entity.organisation.layoutPayload.theme, | |
), | |
name = entity.organisation.name, | |
news_url = entity.organisation.news_url, | |
organisation_surveys = entity.organisation.surveys, | |
parent_id = entity.organisation.parent_id, | |
roles = entity.organisation.roles, | |
schema = entity.organisation.schema, | |
url = entity.organisation.url, | |
), | |
parent = entity.parent | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment