Task #28 - copy of nodes for pages
This commit is contained in:
parent
89a3386e97
commit
e352c9806b
@ -15,11 +15,14 @@ class Export extends Controller {
|
|||||||
async json_export(req, res){
|
async json_export(req, res){
|
||||||
const Page = this.models.get('api:Page')
|
const Page = this.models.get('api:Page')
|
||||||
const user = req.user
|
const user = req.user
|
||||||
const pages = await Page.find({OrgUserId:user._id})
|
const pages = await Page.find({OrgUserId:user.id})
|
||||||
|
|
||||||
const ExportData = {}
|
const ExportData = {}
|
||||||
for (const page of pages ) {
|
for (const page of pages ) {
|
||||||
|
const nodes = await Node.find({PageId:page.UUID})
|
||||||
|
|
||||||
const PageData = {...page}
|
const PageData = {...page}
|
||||||
|
PageData.Nodes = nodes.map( node => { return {...node} } )
|
||||||
ExportData[page.Name] = PageData
|
ExportData[page.Name] = PageData
|
||||||
}
|
}
|
||||||
return res.api(ExportData)
|
return res.api(ExportData)
|
||||||
|
Loading…
Reference in New Issue
Block a user