ekzyis d237861ff5
Use module path aliases (#938)
* Use module path aliases

* fix broken refactor

* path mapping for svgs, style, and remaining places (bonus: lose babel dep)

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-03-19 19:37:31 -05:00

14 lines
444 B
JavaScript

import models from '@/api/models'
export default async function handler (req, res) {
const item = await models.item.findUnique({ where: { id: Number(req.query.id) } })
if (!item || !item.otsFile) {
res.status(404).end()
}
res.setHeader('Content-Type', 'application/octet-stream')
res.setHeader('Content-Disposition', `attachment; filename="sn-item-${req.query.id}.json.ots"`)
res.write(item.otsFile)
res.status(200).end()
}