crud icon indicating copy to clipboard operation
crud copied to clipboard

Add warning when using disallowed relation

Open bertyhell opened this issue 4 years ago • 1 comments

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?

bertyhell avatar Mar 18 '21 12:03 bertyhell

Merged on https://github.com/rewiko/crud/issues/5

rewiko avatar Nov 28 '21 09:11 rewiko