Smart onboarding: residence home profile + suggestion engine
14 new optional residence fields (heating, cooling, water heater, roof, pool, sprinkler, septic, fireplace, garage, basement, attic, exterior, flooring, landscaping) with JSONB conditions on templates. Suggestion engine scores templates against home profile: string match +0.25, bool +0.3, property type +0.15, universal base 0.3. Graceful degradation from minimal to full profile info. GET /api/tasks/suggestions/?residence_id=X returns ranked templates. 54 template conditions across 44 templates in seed data. 8 suggestion service tests.
This commit is contained in:
@@ -47,6 +47,22 @@ type Residence struct {
|
||||
PurchaseDate *time.Time `gorm:"column:purchase_date;type:date" json:"purchase_date"`
|
||||
PurchasePrice *decimal.Decimal `gorm:"column:purchase_price;type:decimal(12,2)" json:"purchase_price"`
|
||||
|
||||
// Home Profile (for smart onboarding suggestions)
|
||||
HeatingType *string `gorm:"column:heating_type;size:50" json:"heating_type"`
|
||||
CoolingType *string `gorm:"column:cooling_type;size:50" json:"cooling_type"`
|
||||
WaterHeaterType *string `gorm:"column:water_heater_type;size:50" json:"water_heater_type"`
|
||||
RoofType *string `gorm:"column:roof_type;size:50" json:"roof_type"`
|
||||
HasPool bool `gorm:"column:has_pool;default:false" json:"has_pool"`
|
||||
HasSprinklerSystem bool `gorm:"column:has_sprinkler_system;default:false" json:"has_sprinkler_system"`
|
||||
HasSeptic bool `gorm:"column:has_septic;default:false" json:"has_septic"`
|
||||
HasFireplace bool `gorm:"column:has_fireplace;default:false" json:"has_fireplace"`
|
||||
HasGarage bool `gorm:"column:has_garage;default:false" json:"has_garage"`
|
||||
HasBasement bool `gorm:"column:has_basement;default:false" json:"has_basement"`
|
||||
HasAttic bool `gorm:"column:has_attic;default:false" json:"has_attic"`
|
||||
ExteriorType *string `gorm:"column:exterior_type;size:50" json:"exterior_type"`
|
||||
FlooringPrimary *string `gorm:"column:flooring_primary;size:50" json:"flooring_primary"`
|
||||
LandscapingType *string `gorm:"column:landscaping_type;size:50" json:"landscaping_type"`
|
||||
|
||||
IsPrimary bool `gorm:"column:is_primary;default:true" json:"is_primary"`
|
||||
IsActive bool `gorm:"column:is_active;default:true;index" json:"is_active"` // Soft delete flag
|
||||
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
package models
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// TaskTemplate represents a predefined task template that users can select when creating tasks
|
||||
type TaskTemplate struct {
|
||||
BaseModel
|
||||
Title string `gorm:"column:title;size:200;not null" json:"title"`
|
||||
Description string `gorm:"column:description;type:text" json:"description"`
|
||||
CategoryID *uint `gorm:"column:category_id;index" json:"category_id"`
|
||||
Category *TaskCategory `gorm:"foreignKey:CategoryID" json:"category,omitempty"`
|
||||
FrequencyID *uint `gorm:"column:frequency_id;index" json:"frequency_id"`
|
||||
Frequency *TaskFrequency `gorm:"foreignKey:FrequencyID" json:"frequency,omitempty"`
|
||||
IconIOS string `gorm:"column:icon_ios;size:100" json:"icon_ios"`
|
||||
IconAndroid string `gorm:"column:icon_android;size:100" json:"icon_android"`
|
||||
Tags string `gorm:"column:tags;type:text" json:"tags"` // Comma-separated tags for search
|
||||
DisplayOrder int `gorm:"column:display_order;default:0" json:"display_order"`
|
||||
Title string `gorm:"column:title;size:200;not null" json:"title"`
|
||||
Description string `gorm:"column:description;type:text" json:"description"`
|
||||
CategoryID *uint `gorm:"column:category_id;index" json:"category_id"`
|
||||
Category *TaskCategory `gorm:"foreignKey:CategoryID" json:"category,omitempty"`
|
||||
FrequencyID *uint `gorm:"column:frequency_id;index" json:"frequency_id"`
|
||||
Frequency *TaskFrequency `gorm:"foreignKey:FrequencyID" json:"frequency,omitempty"`
|
||||
IconIOS string `gorm:"column:icon_ios;size:100" json:"icon_ios"`
|
||||
IconAndroid string `gorm:"column:icon_android;size:100" json:"icon_android"`
|
||||
Tags string `gorm:"column:tags;type:text" json:"tags"` // Comma-separated tags for search
|
||||
DisplayOrder int `gorm:"column:display_order;default:0" json:"display_order"`
|
||||
IsActive bool `gorm:"column:is_active;default:true;index" json:"is_active"`
|
||||
Conditions json.RawMessage `gorm:"column:conditions;type:jsonb;default:'{}'" json:"conditions"`
|
||||
Regions []ClimateRegion `gorm:"many2many:task_tasktemplate_regions;" json:"regions,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user