Procedure get_user_jwt_info #61
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Create stored procedure
get_user_jwt_info(userid)Description
We need a new stored procedure to fetch the information required to build a JWT payload for a given user.
Requirements
Procedure name:
get_user_jwt_infoInput parameter:
userid(integer) — the ID of the user we want information for.Output: A single row containing:
userid— the user’s IDrole— the user’s role nameclubid— the ID of the club the user is coaching, orNULLif they are not a coachBehavior:
clubidof the club they are coaching.NULLforclubid.Usage: This procedure will be called by the backend to generate JWT payloads.
Acceptance criteria
CALL get_user_jwt_info(42)returns a row like:The procedure must never return multiple rows for a single user.
The procedure must handle users with no assigned club gracefully by returning NULL for clubid.
userid should be selected as
sub