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

Dynamic configuration of table resolvers based on context #31

Open
IlyaSemenov opened this issue Aug 14, 2023 · 0 comments
Open

Dynamic configuration of table resolvers based on context #31

IlyaSemenov opened this issue Aug 14, 2023 · 0 comments

Comments

@IlyaSemenov
Copy link
Owner

Currently, a resolver only allows to modify a query based on context:

export const Org = r.table<ResolverContext>(db.org, {
	fields: {
		id: true,
		name: true,
		operator_id: 'operatorId',
		menu_variant: true,
		menu_variants: true,
	},
	modify: (q, { context }) =>
		context
			.bound_role!.allow_read_org(q as typeof db.org)
			.order({ name: 'ASC' }),
})

I would like to have a way to configure everything based on context — primarily, limit the set of allowed fields based on the request context.

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