'use strict'; async function get (ctx, next) { try { const models = ctx.fs.dc.models; const { limit, page, orderBy, orderDirection } = ctx.query const { userId } = ctx.fs.api const aa = await ctx.app.fs.axyRequest.get('structures/types', { query: { token: 'b11b7e6d-032e-4e3e-8973-931c2c5ada5a' } }) let findOption = { attributes: { exclude: ['delete', 'recycleTime',] }, where: { createUserId: userId, recycleTime: null, delete: false }, order: [ [orderBy || 'id', orderDirection || 'DESC'] ], include: [{ model: models.CameraAbility }, { model: models.CameraKind }] } if (limit) { findOption.limit = limit } if (page && limit) { findOption.offset = page * limit } const cameraRes = await models.Camera.findAll(findOption) ctx.status = 200; ctx.body = cameraRes } catch (error) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = {} } } module.exports = { get, };