loopbackio / loopbackio/loopback-next
Model level scope: include is not supported in LB4
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1.1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
### Describe the bug
In Loopback 3 it was possible to add a scope and include in model annotations on a model class :
`@model({
settings: {
strict: false,
scope: {
include: [
{relation: 'posts'}
]
}
})
`
If you do the same in LB4 an error is thrown that the relation cannot be found as loopback-datasource-juggler does not support LB4 includes.
I have made changes to support model level includes here:
https://github.com/SilexConsulting/loopback-next/tree/support-default-scope-include
I need some help to get this ready to submit a pull request.
### Logs
_No response_
### Additional information
_No response_
### Reproduction
https://github.com/SilexConsulting/loopback-next/tree/support-default-scope-include
Contributor guide
Research direction
Start by reviewing the support-default-scope-include branch and its reproduction in the linked LoopBack 4 repository, focusing on model annotations and loopback-datasource-juggler's handling of includes. Confirm the model-level scope include no longer raises a relation-not-found error and that the reproduced behavior works as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100