Onboarding step 3 shell (#92)
CI / ci (push) Successful in 2m19s

Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
This commit was merged in pull request #92.
This commit is contained in:
2026-10-06 17:57:25 -04:00
committed by approver_agent
parent 0a5db6a9e6
commit 6a3f1f3936
10 changed files with 503 additions and 12 deletions
+11
View File
@@ -68,6 +68,11 @@ type SettingsPatch struct {
SuggestionsTime *string
ChatAutosendDow *int
ChatAutosendTime *string
// OnboardingCompleted, when true, records that the household finished
// onboarding: onboarding_completed_at becomes the time of the update,
// unless it is already set, when the first time is kept. Onboarding is
// never undone, so false is invalid.
OnboardingCompleted *bool
}
// Problem is one invalid field of a SettingsPatch, named by its JSON key.
@@ -208,6 +213,9 @@ func (s *SettingsService) Update(ctx context.Context, patch SettingsPatch, updat
setString(&p.SuggestionsTime, patch.SuggestionsTime)
setDow(&p.ChatAutosendDow, patch.ChatAutosendDow)
setString(&p.ChatAutosendTime, patch.ChatAutosendTime)
if patch.OnboardingCompleted != nil && !p.OnboardingCompletedAt.Valid {
p.OnboardingCompletedAt = sql.NullString{String: p.UpdatedAt, Valid: true}
}
row, err = q.UpsertHouseholdSettings(ctx, p)
if err != nil {
return fmt.Errorf("household: update settings: %w", err)
@@ -291,6 +299,9 @@ func (p SettingsPatch) validate() error {
fail(d.field, fmt.Sprintf("invalid day of the week %d (want 0-6, Sunday = 0)", *d.value))
}
}
if p.OnboardingCompleted != nil && !*p.OnboardingCompleted {
fail("onboarding_completed", "onboarding cannot be undone (want true)")
}
if len(problems) > 0 {
return &ValidationError{Problems: problems}
}