-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflatten.js
More file actions
71 lines (62 loc) · 1.55 KB
/
flatten.js
File metadata and controls
71 lines (62 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
export default pSpace => {
const {
spaceTools,
users,
tickets: pTickets,
milestones,
ticketStatuses,
tags,
customFields,
userRoles,
wikiPages: pWikiPages,
...space
} = pSpace
const tickets = []
const ticketComments = []
const ticketAssociations = []
const ticketAttachments = []
const ticketTags = []
// comments
// associations
// attachments
// tags
for ( let pTicket of pTickets ) {
const {
comments = [],
associations = [],
attachments = [],
tags = [],
...ticket
} = pTicket
tickets.push( ticket )
Array.prototype.push.apply(ticketComments, comments)
Array.prototype.push.apply(ticketAssociations, associations)
Array.prototype.push.apply(ticketAttachments, attachments)
Array.prototype.push.apply(ticketTags, tags)
}
const wikiPages = []
const wikiPageVersions = []
// wiki versions
for ( let pWikiPage of pWikiPages ) {
const { versions = [], ...wikiPage } = pWikiPage
wikiPages.push( wikiPage )
Array.prototype.push.apply(wikiPageVersions, versions)
}
return {
space,
spaceTools,
users,
tickets,
ticketComments,
ticketAssociations,
ticketAttachments,
ticketTags,
milestones,
ticketStatuses,
tags,
customFields,
userRoles,
wikiPages,
wikiPageVersions
}
}