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

create archive with title, remove console log

parent c66cbedd
......@@ -7,7 +7,7 @@ const
os = require('os'),
multer = require('multer'),
send = require('@polka/send-type'),
{ Assert } = require('mbjs-utils')
{ Assert, ObjectUtil } = require('mbjs-utils')
module.exports.setupArchives = (app, mapService, annotationService) => {
const upload = multer({ dest: os.tmpdir() })
......@@ -129,7 +129,7 @@ module.exports.createArchive = async (data) => {
Assert.ok(Array.isArray(data.annotations), 'data.annotations must be array')
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()
await new Promise((resolve, reject) => {
......
......@@ -69,7 +69,6 @@ class Profiles extends TinyEmitter {
}
async getHandler (req, res) {
console.log(req.params)
const results = await this._client.find({ user: req.params.id }, req.params)
if (results.length) {
return this._response(req, res, results[0])
......@@ -78,7 +77,7 @@ class Profiles extends TinyEmitter {
}
_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 })
else if (typeof res === 'undefined') return Promise.resolve({ 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