I would assume that you would you use a function b...
# prisma-whats-new
d
I would assume that you would you use a function but I'm not clear on where to go from there and whether or not its even possible
d
Hey @David Yin, depending on what you want to achieve you can either use Resolvers, Functions and hooks as seen here https://docs-next.graph.cool/docs/reference/functions/overview-aiw4aimie9
d
@Dukuo right i looked at that specifically i want to apply a custom rule on resources such that when a user queries and endpoint and request that resource only the resources that satify the given rules will be returned. Can i do this with a subscription im not too clear on how that works
d
Maybe what you need to look for is Authorization. In Graphcool there are permission queries that are run before any query or mutation on your API, you can check whether the user is authenticated, has certain role and so on. https://docs-next.graph.cool/docs/reference/auth/authorization/overview-iegoo0heez
Quoting from the page above:
>>In general, permissions follow a whitelist approach:
- No operation is permitted unless explicitely allowed - A permission cannot be nullified by other permissions
d
@Dukuo I think this doesn't really solve my issue since the rules I have to deal with are more general and can be a relation of multiple resources. An example would be for a resource like Program I want that resource to show up in a user query only if another set of Programs are completed. The way i was thinking of implementing it was storing JSON blobs and using a rules engine to parse it when the query is made