How to check associations feathers-sequelize in service hook

I`am using feathersjs.

I have read the documentation.

How do I execute this method to check on the service hook feathers-hook, or tell me another method of check.

const { disallow } = require('feathers-hooks-common');

function include() {
  return function (hook) {
    const productPrice ='product-prices').Model;
    const currencies ='currencies').Model;
    const edizm ='edizm').Model;

    const pricesShema = { model: productPrice,
      include: [
          model: currencies,
          attributes: ['title', 'socr']

    const edizmShema = { model: edizm,
      attributes: ['title', 'detail']

    let association={include: [edizmShema, pricesShema]};
    hook.params.sequelize = Object.assign(association,{ raw: false });

    return Promise.resolve(hook);

module.exports = {



As explained here: Feathers hooks work with POJO's not with DB ORM's, and your raw: false returns an ORM.

If you really can't use raw: true then convert the ORM to a POJO:

const dehydrate = require('feathers-sequelize/hooks/dehydrate');
hooks.after.find = [dehydrate(), discard('password')]

You can convert back to an ORM (if you really need to).


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.