Licensed to be used in conjunction with basebox, only.
@bb_user directive establishes a mapping between a GraphQL/database user and the corresponding user in the Identity Provider (IdP). This informs the compiler that, upon the creation of a user record in the database, it should associate this record with a user from the IdP. This process is automated by the compiler, additionally, the compiler enforces a unique constraint between the database user and the IdP user, guaranteeing a one-to-one mapping between the two users and preventing any duplicates.
In this example, the PatientUser is a patient but also a user in the application. So, for example, if we have a patient monitoring app where patients will register, you might want to create a
PatientUser in the database with some measurement data for the patient. The
@bb_user directive will associate the IdP user with the internal PatientUser.