'use strict'; async function importIn (ctx) { try { const models = ctx.fs.dc.models; const { level } = ctx.query; const data = ctx.request.body; for (let d of data) { d.level = level; await models.User.create(d); } ctx.status = 204 } catch (error) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { message: typeof error == 'string' ? error : undefined } } } module.exports = { importIn };