/* global Venue */ 'use strict'; const _ = require('lodash'); const { generateService, parseParamsToFindOptions } = require('../../helpers/service.helper'); const models = require('../../core/models'); const extraMethods = { fetch: async (params, context) => { const type = context.type; const findOptions = parseParamsToFindOptions(params); findOptions.include.push({ model: models.EntityType, as: 'types', where: { alias: type }, attributes: [], }); try { return await models.Entity.findAll(findOptions); } catch (error) { throw error; } } }; module.exports = generateService(models.Entity, extraMethods);