Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning when using disallowed relation #683

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bertyhell
Copy link

This will output a warning if you're trying to join a relation that isn't allowed by the controller.

example:
The controller config:

@Crud({
  model: {
    type: StoreEntity,
  },
  query: {
    join: {
      users: {},
      departments: {},
    },
  },
})

This call:

/api/stores?fields=name&join=user&join=departments

Would log this warning:

relation 'user' not found in allowed relations in the controller. Did you mean to use one of these? [users, departments]

I'm not sure if logging this to the console is the best idea. We might need to put this behind a verbose flag somewhere?

@rewiko rewiko mentioned this pull request Nov 28, 2021
19 tasks
@rewiko
Copy link
Collaborator

rewiko commented Nov 28, 2021

Merged on rewiko#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants