feat: social graph features

This commit is contained in:
gosangam
2026-06-04 19:30:50 +05:30
parent 0f433c5708
commit 684ea2ae97
16 changed files with 2504 additions and 119 deletions
+35 -10
View File
@@ -33,6 +33,22 @@ export type User = {
* the "Change password" modal and the "Set a password" flow.
*/
has_password: boolean;
/** Account country as an ISO-3166-1 alpha-2 code (e.g. "IN"), or null
* when unknown. Captured best-effort at signup; user-editable. */
country: string | null;
/** Devotional profile. */
/** Spiritual lineage code (e.g. "gaudiya"); new accounts default to
* "gaudiya" but it's optional, so null means "not specified". */
sampradaya: string | null;
gender: string | null;
initiated: boolean;
/** ISO date "YYYY-MM-DD" (or full timestamp from the DB), null if unset. */
initiated_at: string | null;
daily_chanting_rounds: number | null;
/** System-managed notification scheduling ("HH:MM"), set by the backend
* later — surfaced here for completeness, no UI edits them today. */
preferred_chanting_time: string | null;
peak_active_time: string | null;
created_at: string;
updated_at: string;
};
@@ -189,18 +205,27 @@ export const auth = {
}),
}),
updateProfile: (
name?: string,
avatarURL?: string | null,
handle?: string,
) =>
/**
* Partial profile patch. Only the keys present in `patch` are sent — an
* omitted key leaves that field unchanged; an explicit `""`/`null` (for
* the nullable fields) or `0` (for daily_chanting_rounds) clears it.
*/
updateProfile: (patch: {
name?: string;
avatar_url?: string | null;
handle?: string;
country?: string | null;
sampradaya?: string;
gender?: string | null;
initiated?: boolean;
initiated_at?: string | null;
daily_chanting_rounds?: number | null;
preferred_chanting_time?: string | null;
peak_active_time?: string | null;
}) =>
authFetch<User>("/users/me", {
method: "PATCH",
body: JSON.stringify({
name: name ?? undefined,
avatar_url: avatarURL === undefined ? undefined : avatarURL,
handle: handle ?? undefined,
}),
body: JSON.stringify(patch),
}),
/**