Initial commit: MyCrib API in Go

Complete rewrite of Django REST API to Go with:
- Gin web framework for HTTP routing
- GORM for database operations
- GoAdmin for admin panel
- Gorush integration for push notifications
- Redis for caching and job queues

Features implemented:
- User authentication (login, register, logout, password reset)
- Residence management (CRUD, sharing, share codes)
- Task management (CRUD, kanban board, completions)
- Contractor management (CRUD, specialties)
- Document management (CRUD, warranties)
- Notifications (preferences, push notifications)
- Subscription management (tiers, limits)

Infrastructure:
- Docker Compose for local development
- Database migrations and seed data
- Admin panel for data management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-11-26 20:07:16 -06:00
commit 1f12f3f62a
78 changed files with 13821 additions and 0 deletions

166
seeds/001_lookups.sql Normal file
View File

@@ -0,0 +1,166 @@
-- Seed lookup data for MyCrib
-- Run with: ./dev.sh seed
-- Residence Types (only has: id, created_at, updated_at, name)
INSERT INTO residence_residencetype (id, created_at, updated_at, name)
VALUES
(1, NOW(), NOW(), 'House'),
(2, NOW(), NOW(), 'Apartment'),
(3, NOW(), NOW(), 'Condo'),
(4, NOW(), NOW(), 'Townhouse'),
(5, NOW(), NOW(), 'Duplex'),
(6, NOW(), NOW(), 'Mobile Home'),
(7, NOW(), NOW(), 'Vacation Home'),
(8, NOW(), NOW(), 'Other')
ON CONFLICT (id) DO UPDATE SET
name = EXCLUDED.name,
updated_at = NOW();
-- Task Categories (has: name, description, icon, color, display_order)
INSERT INTO task_taskcategory (id, created_at, updated_at, name, description, icon, color, display_order)
VALUES
(1, NOW(), NOW(), 'Plumbing', 'Plumbing related tasks', 'wrench', '#3498db', 1),
(2, NOW(), NOW(), 'Electrical', 'Electrical work and repairs', 'bolt', '#f1c40f', 2),
(3, NOW(), NOW(), 'HVAC', 'Heating, ventilation, and air conditioning', 'thermometer', '#e74c3c', 3),
(4, NOW(), NOW(), 'Appliances', 'Appliance maintenance and repair', 'cog', '#9b59b6', 4),
(5, NOW(), NOW(), 'Exterior', 'Exterior maintenance and landscaping', 'tree', '#27ae60', 5),
(6, NOW(), NOW(), 'Interior', 'Interior maintenance and repairs', 'home', '#e67e22', 6),
(7, NOW(), NOW(), 'Safety', 'Safety and security tasks', 'shield', '#c0392b', 7),
(8, NOW(), NOW(), 'Cleaning', 'Cleaning and sanitation', 'broom', '#1abc9c', 8),
(9, NOW(), NOW(), 'Pest Control', 'Pest prevention and control', 'bug', '#8e44ad', 9),
(10, NOW(), NOW(), 'General', 'General maintenance tasks', 'tools', '#7f8c8d', 99)
ON CONFLICT (id) DO UPDATE SET
name = EXCLUDED.name,
description = EXCLUDED.description,
icon = EXCLUDED.icon,
color = EXCLUDED.color,
display_order = EXCLUDED.display_order,
updated_at = NOW();
-- Task Priorities (has: name, level, color, display_order - NO description)
INSERT INTO task_taskpriority (id, created_at, updated_at, name, level, color, display_order)
VALUES
(1, NOW(), NOW(), 'Low', 1, '#27ae60', 1),
(2, NOW(), NOW(), 'Medium', 2, '#f39c12', 2),
(3, NOW(), NOW(), 'High', 3, '#e74c3c', 3),
(4, NOW(), NOW(), 'Urgent', 4, '#c0392b', 4)
ON CONFLICT (id) DO UPDATE SET
name = EXCLUDED.name,
level = EXCLUDED.level,
color = EXCLUDED.color,
display_order = EXCLUDED.display_order,
updated_at = NOW();
-- Task Statuses (has: name, description, color, display_order - NO is_terminal)
INSERT INTO task_taskstatus (id, created_at, updated_at, name, description, color, display_order)
VALUES
(1, NOW(), NOW(), 'Pending', 'Task has not been started', '#95a5a6', 1),
(2, NOW(), NOW(), 'In Progress', 'Task is currently being worked on', '#3498db', 2),
(3, NOW(), NOW(), 'Completed', 'Task has been completed', '#27ae60', 3),
(4, NOW(), NOW(), 'Cancelled', 'Task has been cancelled', '#e74c3c', 4),
(5, NOW(), NOW(), 'On Hold', 'Task is on hold', '#f39c12', 5)
ON CONFLICT (id) DO UPDATE SET
name = EXCLUDED.name,
description = EXCLUDED.description,
color = EXCLUDED.color,
display_order = EXCLUDED.display_order,
updated_at = NOW();
-- Task Frequencies (has: name, days, display_order)
INSERT INTO task_taskfrequency (id, created_at, updated_at, name, days, display_order)
VALUES
(1, NOW(), NOW(), 'Once', NULL, 1),
(2, NOW(), NOW(), 'Daily', 1, 2),
(3, NOW(), NOW(), 'Weekly', 7, 3),
(4, NOW(), NOW(), 'Bi-Weekly', 14, 4),
(5, NOW(), NOW(), 'Monthly', 30, 5),
(6, NOW(), NOW(), 'Quarterly', 90, 6),
(7, NOW(), NOW(), 'Semi-Annually', 180, 7),
(8, NOW(), NOW(), 'Annually', 365, 8)
ON CONFLICT (id) DO UPDATE SET
name = EXCLUDED.name,
days = EXCLUDED.days,
display_order = EXCLUDED.display_order,
updated_at = NOW();
-- Contractor Specialties (check actual columns)
INSERT INTO task_contractorspecialty (id, created_at, updated_at, name)
VALUES
(1, NOW(), NOW(), 'Plumber'),
(2, NOW(), NOW(), 'Electrician'),
(3, NOW(), NOW(), 'HVAC Technician'),
(4, NOW(), NOW(), 'Handyman'),
(5, NOW(), NOW(), 'Landscaper'),
(6, NOW(), NOW(), 'Painter'),
(7, NOW(), NOW(), 'Roofer'),
(8, NOW(), NOW(), 'Carpenter'),
(9, NOW(), NOW(), 'Appliance Repair'),
(10, NOW(), NOW(), 'Pest Control'),
(11, NOW(), NOW(), 'Cleaner'),
(12, NOW(), NOW(), 'Pool Service'),
(13, NOW(), NOW(), 'Locksmith'),
(14, NOW(), NOW(), 'General Contractor')
ON CONFLICT (id) DO UPDATE SET
name = EXCLUDED.name,
updated_at = NOW();
-- Subscription Settings (singleton)
INSERT INTO subscription_subscriptionsettings (id, enable_limitations)
VALUES (1, false)
ON CONFLICT (id) DO NOTHING;
-- Tier Limits
INSERT INTO subscription_tierlimits (id, created_at, updated_at, tier, properties_limit, tasks_limit, contractors_limit, documents_limit)
VALUES
(1, NOW(), NOW(), 'free', 1, 10, 0, 0),
(2, NOW(), NOW(), 'pro', NULL, NULL, NULL, NULL)
ON CONFLICT (id) DO UPDATE SET
tier = EXCLUDED.tier,
properties_limit = EXCLUDED.properties_limit,
tasks_limit = EXCLUDED.tasks_limit,
contractors_limit = EXCLUDED.contractors_limit,
documents_limit = EXCLUDED.documents_limit,
updated_at = NOW();
-- Feature Benefits
INSERT INTO subscription_featurebenefit (id, created_at, updated_at, feature_name, free_tier_text, pro_tier_text, display_order, is_active)
VALUES
(1, NOW(), NOW(), 'Properties', '1 property', 'Unlimited properties', 1, true),
(2, NOW(), NOW(), 'Tasks', '10 tasks', 'Unlimited tasks', 2, true),
(3, NOW(), NOW(), 'Contractors', 'Not available', 'Unlimited contractors', 3, true),
(4, NOW(), NOW(), 'Documents', 'Not available', 'Unlimited documents', 4, true),
(5, NOW(), NOW(), 'PDF Reports', 'Not available', 'Generate PDF reports', 5, true),
(6, NOW(), NOW(), 'Priority Support', 'Community support', 'Priority email support', 6, true)
ON CONFLICT (id) DO UPDATE SET
feature_name = EXCLUDED.feature_name,
free_tier_text = EXCLUDED.free_tier_text,
pro_tier_text = EXCLUDED.pro_tier_text,
display_order = EXCLUDED.display_order,
is_active = EXCLUDED.is_active,
updated_at = NOW();
-- Upgrade Triggers
INSERT INTO subscription_upgradetrigger (id, created_at, updated_at, trigger_key, title, message, button_text, is_active)
VALUES
(1, NOW(), NOW(), 'property_limit', 'Upgrade to Add More Properties', 'You''ve reached the free tier limit of 1 property. Upgrade to Pro to add unlimited properties.', 'Upgrade to Pro', true),
(2, NOW(), NOW(), 'task_limit', 'Upgrade for More Tasks', 'You''ve reached the free tier limit of 10 tasks. Upgrade to Pro for unlimited tasks.', 'Upgrade to Pro', true),
(3, NOW(), NOW(), 'contractor_access', 'Unlock Contractor Management', 'Contractor management is a Pro feature. Upgrade to keep track of your service providers.', 'Upgrade to Pro', true),
(4, NOW(), NOW(), 'document_access', 'Unlock Document Storage', 'Document storage is a Pro feature. Upgrade to store warranties, manuals, and more.', 'Upgrade to Pro', true)
ON CONFLICT (id) DO UPDATE SET
trigger_key = EXCLUDED.trigger_key,
title = EXCLUDED.title,
message = EXCLUDED.message,
button_text = EXCLUDED.button_text,
is_active = EXCLUDED.is_active,
updated_at = NOW();
-- Reset sequences to max id + 1
SELECT setval('residence_residencetype_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM residence_residencetype), false);
SELECT setval('task_taskcategory_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_taskcategory), false);
SELECT setval('task_taskpriority_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_taskpriority), false);
SELECT setval('task_taskstatus_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_taskstatus), false);
SELECT setval('task_taskfrequency_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_taskfrequency), false);
SELECT setval('task_contractorspecialty_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_contractorspecialty), false);
SELECT setval('subscription_tierlimits_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM subscription_tierlimits), false);
SELECT setval('subscription_featurebenefit_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM subscription_featurebenefit), false);
SELECT setval('subscription_upgradetrigger_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM subscription_upgradetrigger), false);