feat(phase4): rich profiles, badges DB, block list

This commit is contained in:
2026-06-30 11:04:32 -04:00
parent 368172e3d6
commit 58ce09cc18
7 changed files with 375 additions and 11 deletions
+34
View File
@@ -14,14 +14,32 @@ export interface User {
status: UserStatus;
status_text: string;
created_at: string;
banner_url?: string;
tagline?: string;
pronouns?: string;
social_links?: { platform: string; url: string }[];
}
export interface PublicProfile extends User {
badges: { id: string; name: string; icon: string; description?: string; server_id?: string }[];
}
export type BlockedUser = {
id: string;
username: string;
created_at: string;
};
export interface UpdateProfilePayload {
display_name?: string;
bio?: string;
accent_color?: string;
status_text?: string;
status?: UserStatus;
banner_url?: string;
tagline?: string;
pronouns?: string;
social_links?: { platform: string; url: string }[];
}
interface AuthState {
@@ -43,6 +61,10 @@ interface AuthState {
currentPassword: string,
newPassword: string,
) => Promise<void>;
getPublicProfile: (userId: string) => Promise<PublicProfile>;
listBlocks: () => Promise<BlockedUser[]>;
blockUser: (userId: string) => Promise<void>;
unblockUser: (userId: string) => Promise<void>;
clearError: () => void;
}
@@ -156,4 +178,16 @@ export const useAuthStore = create<AuthState>((set) => ({
},
clearError: () => set({ error: null }),
getPublicProfile: async (userId) => api.get<PublicProfile>(`/users/${userId}/profile`),
listBlocks: async () => api.get<BlockedUser[]>('/users/me/blocks'),
blockUser: async (userId) => {
await api.post('/users/me/blocks', { user_id: userId });
},
unblockUser: async (userId) => {
await api.delete(`/users/me/blocks/${userId}`);
},
}));