Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Motion Bank
Services
Motion Bank API
Commits
24c3e962
Commit
24c3e962
authored
Apr 11, 2019
by
Anton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cells to archives
parent
cc9391f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
src/lib/archives.js
src/lib/archives.js
+16
-2
No files found.
src/lib/archives.js
View file @
24c3e962
...
...
@@ -9,9 +9,10 @@ const
send
=
require
(
'
@polka/send-type
'
),
config
=
require
(
'
config
'
),
Minio
=
require
(
'
minio
'
),
{
Assert
,
ObjectUtil
}
=
require
(
'
mbjs-utils
'
)
{
Assert
,
ObjectUtil
}
=
require
(
'
mbjs-utils
'
),
parseURI
=
require
(
'
mbjs-data-models/src/lib/parse-uri
'
)
module
.
exports
.
setupArchives
=
(
api
,
mapService
,
annotationService
)
=>
{
module
.
exports
.
setupArchives
=
(
api
,
mapService
,
annotationService
,
cellService
)
=>
{
const
upload
=
multer
({
dest
:
os
.
tmpdir
()
})
api
.
app
.
post
(
'
/archives/maps
'
,
async
(
req
,
res
)
=>
{
let
data
=
{}
...
...
@@ -33,6 +34,19 @@ module.exports.setupArchives = (api, mapService, annotationService) => {
await
annotationService
.
findHandler
(
request
,
async
result
=>
{
if
(
result
.
error
)
return
send
(
res
,
result
.
code
)
data
.
annotations
=
result
.
data
.
items
data
.
cells
=
[]
for
(
let
annotation
of
data
.
annotations
)
{
if
(
annotation
.
body
.
type
===
'
Cell
'
&&
annotation
.
body
.
source
)
{
const
cellRequest
=
{
query
:
{
uuid
:
parseURI
(
annotation
.
body
.
source
.
id
).
uuid
},
user
:
req
.
user
}
const
cell
=
await
cellService
.
getHandler
(
cellRequest
)
if
(
cell
)
data
.
cells
.
push
(
cell
)
}
}
const
url
=
await
exports
.
createArchive
(
api
,
data
)
send
(
res
,
200
,
url
)
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment