Skip to content

Add warning when using disallowed relation#683

Open
bertyhell wants to merge 1 commit into
nestjsx:masterfrom
bertyhell:patch-1
Open

Add warning when using disallowed relation#683
bertyhell wants to merge 1 commit into
nestjsx:masterfrom
bertyhell:patch-1

Conversation

@bertyhell
Copy link
Copy Markdown

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
Copy Markdown
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.

2 participants