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>
95 lines
2.0 KiB
TypeScript
95 lines
2.0 KiB
TypeScript
/** Shared test fixtures — Dashboard analytics (`GET /api/analytics/overview`). */
|
|
|
|
import type {
|
|
Age4Projection,
|
|
ParentalLeaveYearBalance,
|
|
ParentYearBalance,
|
|
VacationYearBalance,
|
|
WorkspaceOverview,
|
|
YearTotals,
|
|
} from '@/types'
|
|
|
|
export function makeVacationYearBalance(
|
|
overrides: Partial<VacationYearBalance> = {},
|
|
): VacationYearBalance {
|
|
return {
|
|
year: 2025,
|
|
earned: 25,
|
|
isAssumed: true,
|
|
carriedIn: 0,
|
|
plannedUse: 0,
|
|
left: 25,
|
|
carriedOut: 5,
|
|
expiring: 0,
|
|
expiringAge: 0,
|
|
expiringOverCap: 0,
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
export function makeParentalLeaveYearBalance(
|
|
overrides: Partial<ParentalLeaveYearBalance> = {},
|
|
): ParentalLeaveYearBalance {
|
|
return {
|
|
year: 2025,
|
|
sjukpenningUsed: 0,
|
|
lagstaUsed: 0,
|
|
sjukpenningLeft: 390,
|
|
lagstaLeft: 90,
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
export function makeParentYearBalance(
|
|
overrides: Partial<ParentYearBalance> = {},
|
|
): ParentYearBalance {
|
|
return {
|
|
personalDataUuid: 'pd-a',
|
|
childId: 'child-1',
|
|
year: 2025,
|
|
vacation: makeVacationYearBalance(),
|
|
parentalLeave: makeParentalLeaveYearBalance(),
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
export function makeYearTotals(overrides: Partial<YearTotals> = {}): YearTotals {
|
|
return {
|
|
year: 2025,
|
|
plLeft: 480,
|
|
vacationLeft: 25,
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
export function makeAge4Projection(overrides: Partial<Age4Projection> = {}): Age4Projection {
|
|
return {
|
|
personalDataUuid: 'pd-a',
|
|
childId: 'child-1',
|
|
birthDate: '2025-06-01',
|
|
fourthBirthday: '2029-06-01',
|
|
totalDays: 240,
|
|
daysUsed: 30,
|
|
plannedDaysBeforeB4: 10,
|
|
projectedLeftAtB4: 200,
|
|
savableAfterB4: 96,
|
|
expiringAtB4: 60,
|
|
savableCapAtB4: 96,
|
|
yearBalances: [],
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
export function makeWorkspaceOverview(overrides: Partial<WorkspaceOverview> = {}): WorkspaceOverview {
|
|
return {
|
|
workspaceId: 'ws-1',
|
|
childId: 'child-1',
|
|
parentProjections: [],
|
|
combinedDaysUsed: 30,
|
|
combinedDaysLeft: 270,
|
|
combinedExpiringAtB4: 100,
|
|
yearTotals: [],
|
|
...overrides,
|
|
}
|
|
}
|