0e9b20ec37
Three strands of work that grew together across the same settings screen and
API client, so they land as one change.
Per-year preschool planning days ("studiedagar"): new table, repository
(SQLite + Postgres), service, router and migration 007, plus the hooks and
Settings UI to plan and record them per child and year. Allocation now
reserves the recorded figure for a year where one exists and only falls back
to the child-level estimate otherwise, marking that fallback as assumed.
Partner invitations: workspaces issue and list invitations, registration
accepts an invite token to join the inviter's workspace instead of creating a
personal one, and a /join/:token page plus the settings invite panel drive it.
Vacation forfeiture: tips and the dashboard now distinguish days a parent
genuinely loses from days that merely age, so the warning stops firing on
balances that were never at risk.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
/**
|
|
* Shared test fixtures — small ad hoc API response shapes that aren't a
|
|
* named type in `src/types/` (they're inline return-type object literals in
|
|
* `src/services/api.ts`). Derived via `Awaited<ReturnType<typeof fn>>`
|
|
* instead of redeclaring the shape, so a change to the real signature fails
|
|
* the fixture at compile time rather than drifting silently.
|
|
*/
|
|
|
|
import type { addPartner } from '@/services/api'
|
|
import type { Invitation, PreschoolPlanningDays } from '@/types'
|
|
|
|
/** Shared by `addPartner` and `updateParentSettings` — both return the same
|
|
* `{ uuid, name, salary_type, employment_status }` wire shape. */
|
|
export type PartnerMemberResponse = Awaited<ReturnType<typeof addPartner>>
|
|
|
|
export function makePartnerMemberResponse(
|
|
overrides: Partial<PartnerMemberResponse> = {},
|
|
): PartnerMemberResponse {
|
|
return {
|
|
uuid: 'pd-b',
|
|
name: 'Partner',
|
|
salary_type: 'monthly',
|
|
employment_status: 'employed',
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
export function makePreschoolPlanningDays(
|
|
overrides: Partial<PreschoolPlanningDays> = {},
|
|
): PreschoolPlanningDays {
|
|
return {
|
|
id: 'ppd-1',
|
|
childId: 'child-1',
|
|
year: 2025,
|
|
plannedDays: 5,
|
|
takenDays: null,
|
|
isDefault: false,
|
|
createdAt: '2025-01-01T00:00:00Z',
|
|
updatedAt: '2025-01-01T00:00:00Z',
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
export function makeInvitation(overrides: Partial<Invitation> = {}): Invitation {
|
|
return {
|
|
id: 'inv-1',
|
|
workspaceId: 'ws-1',
|
|
status: 'pending',
|
|
expiresAt: '2025-01-08T00:00:00Z',
|
|
createdAt: '2025-01-01T00:00:00Z',
|
|
...overrides,
|
|
}
|
|
}
|