Skip to content

Dynamic configuration of table resolvers based on context #31

@IlyaSemenov

Description

@IlyaSemenov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions