typescript-rest icon indicating copy to clipboard operation
typescript-rest copied to clipboard

@UserParam Support

Open jackghicks opened this issue 6 years ago • 0 comments

I find myself quite often needing to reference the currently authenticated user, meaning you need to ensure you have a ServiceContext so that you can do context.request.user.xyz

It seems that it would be cleaner to be able to include a @UserParam user: MyUserType in the arguments for any method where you need a reference to the user - that way, the method definition explicitly shows that the user itself is a critically important input to the method. Using the context works for now, but it is quite vague.

I'm happy to create a PR and implement this if others think it's a good idea!

jackghicks avatar Jun 03 '19 10:06 jackghicks