Add top-level members list, primary member on account, member move, combined create flows

- GET /v1/members with search across all members (includes account name)
- POST /members/:id/move with optional accountId (creates new account if omitted)
- primary_member_id on account table, auto-set when first member added
- isMinor flag on member create (manual override when no DOB provided)
- Account search now includes member names
- New account form includes primary contact fields, auto-generates name
- Members page in sidebar with global search
This commit is contained in:
Ryan Moon
2026-03-28 09:08:06 -05:00
parent 7c64a928e1
commit 572af05a3f
16 changed files with 796 additions and 77 deletions

View File

@@ -3,9 +3,15 @@ import { api } from '@/lib/api-client'
import type { Member } from '@/types/account'
import type { PaginatedResponse, PaginationInput } from '@forte/shared/schemas'
interface MemberWithAccount extends Member {
accountName: string | null
}
export const memberKeys = {
all: (accountId: string) => ['accounts', accountId, 'members'] as const,
list: (accountId: string, params: PaginationInput) => [...memberKeys.all(accountId), params] as const,
globalAll: ['members'] as const,
globalList: (params: PaginationInput) => ['members', 'list', params] as const,
}
export function memberListOptions(accountId: string, params: PaginationInput) {
@@ -15,6 +21,13 @@ export function memberListOptions(accountId: string, params: PaginationInput) {
})
}
export function globalMemberListOptions(params: PaginationInput) {
return queryOptions({
queryKey: memberKeys.globalList(params),
queryFn: () => api.get<PaginatedResponse<MemberWithAccount>>('/v1/members', params),
})
}
export const memberMutations = {
create: (accountId: string, data: Record<string, unknown>) =>
api.post<Member>(`/v1/accounts/${accountId}/members`, data),
@@ -24,4 +37,9 @@ export const memberMutations = {
delete: (id: string) =>
api.del<Member>(`/v1/members/${id}`),
move: (id: string, accountId?: string) =>
api.post<Member>(`/v1/members/${id}/move`, accountId ? { accountId } : {}),
}
export type { MemberWithAccount }