wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
12.73k stars 1.13k forks source link

Allow users to send a plain `User` when calling authenticated operations on the server #2066

Open sodic opened 1 month ago

sodic commented 1 month ago

2044 closed #1909, but we're not yet quite where we wanted to be.

See the comment for the API's original specification: https://github.com/wasp-lang/wasp/issues/1909#issuecomment-2104476140.

We're still missing the feature that allows the user argument to be of type User (not only AuthUser):

// current type signature 
getFoo(payload: Input, { user }: { user: AuthUser })

// desired type signature
getFoo(payload: Input, { user }: { user: User | AuthUser })

The getFoo function should be overloaded and its implementation should figure out whether the caller sent a User or an AuthUser and act accordingly.

We want this feature because, outside of an operation, the User is much more easily attainable than an AuthUser.