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 ability to filter fk results #54

Open
jamienicholls opened this issue Nov 4, 2021 · 0 comments
Open

Add ability to filter fk results #54

jamienicholls opened this issue Nov 4, 2021 · 0 comments

Comments

@jamienicholls
Copy link
Contributor

You can currently add a foreign key (fk) to a schema, it would be nice to filter that fk on a field that is present as another key in the fk's schema.

i.e. Schema two can only access schema ones data on condition of filter
`
const schemaOne = Joi.object({
schemaOneId: joi.string().pk().required(),
schemaOneCategory: Joi.string(),
isActive: Joi.boolen().meta({}),
};

const schemaTwo = Joi.object({
schemaTwoId: joi.string().pk().required(),
schemaOneItem: Joi.string().fk('schemaOne.[].schemaOneId').meta({{ isActive: { isActive: true } }}),
}

const schema = Joi.object({
schemaOne: Joi.array().items(schemaOne).optional().uniqueOnPks(),
schemaTwo: Joi.array().items(schemaTwo).optional().uniqueOnPks(),
}
`

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

No branches or pull requests

1 participant