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

Self referencing relationships using a different resource url #34

Open
agri-pat opened this issue Feb 17, 2023 · 1 comment
Open

Self referencing relationships using a different resource url #34

agri-pat opened this issue Feb 17, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@agri-pat
Copy link

Is there any way to configure a relation that is the same model type to use a different resource url when using it as a relation. e.g. With the model below I want to the relationship url to be /api/paddocks/{paddock_id}/prior_paddocks/sync however the SDK attempting to use /api/paddocks/{paddock_id}/paddocks/sync

export default class Paddock extends Model<{
id: number
...
},
DefaultPersistedAttributes > {
public $resource (): string {
return 'paddocks'
}
...
public prior_paddocks (): BelongsToMany {
return new BelongsToMany(Paddock, this)
}
...}

@alexzarbn
Copy link
Member

Hello @agri-pat,

No, currently there is no way to customize the relation resource url. I will leave the issue open to see, if someone can pickup and make a PR for this. I may look into it once I have time for this.

@alexzarbn alexzarbn added the enhancement New feature or request label Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants