Task #28 - copy of nodes for pages

This commit is contained in:
QiTao 2020-02-08 07:12:26 -06:00
parent 89a3386e97
commit e352c9806b

View File

@ -15,11 +15,14 @@ class Export extends Controller {
async json_export(req, res){
const Page = this.models.get('api:Page')
const user = req.user
const pages = await Page.find({OrgUserId:user._id})
const pages = await Page.find({OrgUserId:user.id})
const ExportData = {}
for (const page of pages ) {
const nodes = await Node.find({PageId:page.UUID})
const PageData = {...page}
PageData.Nodes = nodes.map( node => { return {...node} } )
ExportData[page.Name] = PageData
}
return res.api(ExportData)