Adds a new endpoint GET /api/tasks/templates/by-region/?zip= that resolves ZIP codes to IECC climate regions and returns relevant home maintenance task templates. Includes climate region model, region lookup service with tests, seed data for all 8 climate zones with 50+ templates, and OpenAPI spec. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
1.3 KiB
SQL
22 lines
1.3 KiB
SQL
-- Seed the 8 IECC climate regions for regional task templates
|
|
-- Run after 003_task_templates.sql
|
|
|
|
INSERT INTO task_climateregion (id, created_at, updated_at, name, zone_number, description, is_active)
|
|
VALUES
|
|
(1, NOW(), NOW(), 'Hot-Humid', 1, 'South Florida, Hawaii, Gulf Coast lowlands', true),
|
|
(2, NOW(), NOW(), 'Hot-Dry', 2, 'Arizona, Southern Nevada, West Texas, Southern California deserts', true),
|
|
(3, NOW(), NOW(), 'Mixed-Humid', 3, 'Mid-Atlantic, North Carolina, Tennessee, Arkansas', true),
|
|
(4, NOW(), NOW(), 'Mixed-Dry', 4, 'Kansas, Missouri, Southern Illinois, Central Virginia', true),
|
|
(5, NOW(), NOW(), 'Cold', 5, 'Northern Illinois, Michigan, New York, Southern New England', true),
|
|
(6, NOW(), NOW(), 'Very Cold', 6, 'Buffalo NY, Northern Ohio, Northern Wisconsin, Minnesota', true),
|
|
(7, NOW(), NOW(), 'Subarctic', 7, 'Upper Peninsula MI, Northern Minnesota, Mountain regions', true),
|
|
(8, NOW(), NOW(), 'Arctic', 8, 'Alaska, Far Northern regions', true)
|
|
ON CONFLICT (id) DO UPDATE SET
|
|
name = EXCLUDED.name,
|
|
zone_number = EXCLUDED.zone_number,
|
|
description = EXCLUDED.description,
|
|
is_active = EXCLUDED.is_active,
|
|
updated_at = NOW();
|
|
|
|
SELECT setval('task_climateregion_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_climateregion), false);
|