PATCH /api/profile.
Read the student
GET /api/me returns the identity and the profile. The first call creates the student row.
The server takes the identity from the token, not from the request body. On the first call it
copies the e-mail, the phone number, the first name, the last name, and the avatar of the provider
into the profile. On every later call it writes the e-mail and the phone number again if the auth
identity changed. The names are copied one time only, so a correction that the student made with
PATCH /api/profile stays.
Write the profile
PATCH /api/profile is a partial update. The server writes only the fields that are present in
the body. A field that you omit keeps its value. A field that you send as null becomes null,
where the schema permits null.
Fields
A value outside these limits fails schema validation, and the request returns
400. A field that
the table does not list is dropped by schema validation.
Read-only fields
GET /api/me returns four fields that PATCH /api/profile does not accept:
A new e-mail or phone number reaches the profile on the next request with the new token. No
endpoint writes an address that the auth provider did not verify.
The server trims each subject string and converts it to lower case.
"Matematik " is stored as
"matematik". Compare in lower case when you highlight a chip in the user interface.The onboarding rule
onboardingComplete becomes true when the profile holds all of these:
- a non-empty
grade, and - an
examType, and - a
field, whenexamTypeisYKS.
field stays null and is not required. The flag never returns to false.
Show the onboarding screen while onboardingComplete is false. The chat works before onboarding
is complete. Lala then collects the same facts in conversation instead.
Lala also writes the profile
Lala can update the profile itself during a conversation, with an internal tool. If the student says “aslında sayısaldayım”, the profile changes without any client request. Lala also writespreferredName when the student asks for a different form of address. Lala never writes
firstName, lastName, email, or phone.
Because of this, the profile is not client-owned state:
- Read
GET /api/mewhen the application starts and when it returns to the foreground. - Do not cache the profile across sessions as the source of truth.
- Do not write back a whole profile object that you read earlier. Send only the fields that the student just changed.