Commit a30114f7 authored by A. Koch's avatar A. Koch

create archive with title, remove console log

parent c66cbedd
...@@ -7,7 +7,7 @@ const ...@@ -7,7 +7,7 @@ const
os = require('os'), os = require('os'),
multer = require('multer'), multer = require('multer'),
send = require('@polka/send-type'), send = require('@polka/send-type'),
{ Assert } = require('mbjs-utils') { Assert, ObjectUtil } = require('mbjs-utils')
module.exports.setupArchives = (app, mapService, annotationService) => { module.exports.setupArchives = (app, mapService, annotationService) => {
const upload = multer({ dest: os.tmpdir() }) const upload = multer({ dest: os.tmpdir() })
...@@ -129,7 +129,7 @@ module.exports.createArchive = async (data) => { ...@@ -129,7 +129,7 @@ module.exports.createArchive = async (data) => {
Assert.ok(Array.isArray(data.annotations), 'data.annotations must be array') Assert.ok(Array.isArray(data.annotations), 'data.annotations must be array')
const const
dir = path.join(os.tmpdir(), `map_archive_${data.map.uuid}`), dir = path.join(os.tmpdir(), `archive_${ObjectUtil.slug(data.map.title)}_${data.map.uuid}`),
archive = new yazl.ZipFile() archive = new yazl.ZipFile()
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
......
...@@ -69,7 +69,6 @@ class Profiles extends TinyEmitter { ...@@ -69,7 +69,6 @@ class Profiles extends TinyEmitter {
} }
async getHandler (req, res) { async getHandler (req, res) {
console.log(req.params)
const results = await this._client.find({ user: req.params.id }, req.params) const results = await this._client.find({ user: req.params.id }, req.params)
if (results.length) { if (results.length) {
return this._response(req, res, results[0]) return this._response(req, res, results[0])
...@@ -78,7 +77,7 @@ class Profiles extends TinyEmitter { ...@@ -78,7 +77,7 @@ class Profiles extends TinyEmitter {
} }
_response (req, res, data = {}) { _response (req, res, data = {}) {
this.emit('message', { method: req.method, id: data.id }) this.emit('message', { method: req.method, id: data.uuid })
if (typeof res === 'function') res({ data }) if (typeof res === 'function') res({ data })
else if (typeof res === 'undefined') return Promise.resolve({ data }) else if (typeof res === 'undefined') return Promise.resolve({ data })
else send(res, 200, data) else send(res, 200, data)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment