Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override suspend fun createRowTemplateById(
- company: Company,
- rowId: String,
- name: String,
- thumbnail: String,
- categories: List<String>
- ): RowSectionData {
- val pageRow = datastore.get(PageRow::class.java, ObjectId(rowId)) orNotFound "page row"
- val pageComponents = datastore.find(PageComponent::class.java).field("row").equal(pageRow).asList()
- val rowTemplate = PageRowSection()
- rowTemplate.team = company
- rowTemplate.name = name
- rowTemplate.thumbnail = thumbnail
- if (categories.isNotEmpty())rowTemplate.categories= ArrayList(categories.map { it.toLowerCase() })
- rowTemplate.setting = pageRow.setting
- datastore.save(rowTemplate)
- val res = pageComponents.map { pageComp ->
- val comp = PageComponentSection()
- comp.row = rowTemplate
- comp.type = pageComp.type
- comp.setting = pageComp.setting
- comp.colomorder = pageComp.colomorder
- comp.formId = pageComp.formId
- comp.html = pageComp.html
- comp.htmlCode = pageComp.htmlCode
- comp.order = pageComp.order
- comp.selected = pageComp.selected
- comp.source = pageComp.source
- comp.textHtml = pageComp.textHtml
- comp.title = pageComp.title
- comp.titleHtml = pageComp.titleHtml
- comp.rating = pageComp.rating
- comp.priceHtml = pageComp.priceHtml
- datastore.save(comp)
- comp
- }
- return RowSectionData(rowTemplate, res)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement