Skip to content

Request: Array of fields to return #15

@corepay

Description

@corepay

Thank you for making and publishing this hook. Saved me a ton of time and head scratching trying to other hooks and code to fetch associated data.

Have a request if you think worthy. How about an array on the target include that allows us to specify which fields to return? My postgres is a quite complex multi-tenant with a lot of relationships and useless associations and other fields that in these associations that is not relevant to the the response I need to return to the app.

I can discard the unnecessary data in an after hook but in my case would need to update and maintain 80+ tables - this option would save a ton of time and makes sense re: efficiency and compressing the response....

Whaddyathink?

const options = {
  include: {
    service: 'phones',
    nameAs: 'phone',
    keyHere: 'default_phone_id',
    keyThere: 'id'
    fields: ['name', 'number', 'extension', 'e164']     <-------- this
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions