Add multi-image support for task completions and documents
- Add TaskCompletionImage and DocumentImage models with one-to-many relationships
- Update admin panel to display images for completions and documents
- Add image arrays to API request/response DTOs
- Update repositories with Preload("Images") for eager loading
- Fix seed SQL execution to use raw SQL instead of prepared statements
- Fix table names in seed file (admin_users, push_notifications_*)
- Add comprehensive seed test data with 34 completion images and 24 document images
- Add subscription limitations admin feature with toggle
- Update admin sidebar with limitations link
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,153 +1,605 @@
|
||||
-- Seed test data for MyCrib
|
||||
-- Run with: ./dev.sh seed-test
|
||||
-- Note: Run ./dev.sh seed first to populate lookup tables
|
||||
-- Run with: POST /api/admin/settings/seed-test-data
|
||||
-- Note: Run seed-lookups first to populate lookup tables
|
||||
|
||||
-- Test Users (password is 'password123' hashed with bcrypt)
|
||||
-- bcrypt hash for 'password123': $2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi
|
||||
INSERT INTO auth_user (id, username, password, email, first_name, last_name, is_active, is_staff, is_superuser, date_joined)
|
||||
-- =====================================================
|
||||
-- TEST USERS (password is 'password123' for all users)
|
||||
-- bcrypt hash: $2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi
|
||||
-- =====================================================
|
||||
INSERT INTO auth_user (id, username, password, email, first_name, last_name, is_active, is_staff, is_superuser, date_joined, last_login)
|
||||
VALUES
|
||||
(1, 'admin', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'admin@example.com', 'Admin', 'User', true, true, true, NOW()),
|
||||
(2, 'john', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'john@example.com', 'John', 'Doe', true, false, false, NOW()),
|
||||
(3, 'jane', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'jane@example.com', 'Jane', 'Smith', true, false, false, NOW()),
|
||||
(4, 'bob', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'bob@example.com', 'Bob', 'Wilson', true, false, false, NOW())
|
||||
(1, 'admin', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'admin@mycrib.com', 'Admin', 'User', true, true, true, NOW() - INTERVAL '1 year', NOW() - INTERVAL '1 hour'),
|
||||
(2, 'john.doe', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'john.doe@example.com', 'John', 'Doe', true, false, false, NOW() - INTERVAL '6 months', NOW() - INTERVAL '2 hours'),
|
||||
(3, 'jane.smith', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'jane.smith@example.com', 'Jane', 'Smith', true, false, false, NOW() - INTERVAL '5 months', NOW() - INTERVAL '1 day'),
|
||||
(4, 'bob.wilson', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'bob.wilson@example.com', 'Bob', 'Wilson', true, false, false, NOW() - INTERVAL '4 months', NOW() - INTERVAL '3 days'),
|
||||
(5, 'alice.johnson', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'alice.johnson@example.com', 'Alice', 'Johnson', true, false, false, NOW() - INTERVAL '3 months', NOW() - INTERVAL '1 week'),
|
||||
(6, 'charlie.brown', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'charlie.brown@example.com', 'Charlie', 'Brown', true, false, false, NOW() - INTERVAL '2 months', NOW() - INTERVAL '2 weeks'),
|
||||
(7, 'diana.ross', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'diana.ross@example.com', 'Diana', 'Ross', true, false, false, NOW() - INTERVAL '1 month', NULL),
|
||||
(8, 'edward.norton', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'edward.norton@example.com', 'Edward', 'Norton', true, false, false, NOW() - INTERVAL '2 weeks', NOW() - INTERVAL '5 days'),
|
||||
(9, 'fiona.apple', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'fiona.apple@example.com', 'Fiona', 'Apple', true, false, false, NOW() - INTERVAL '1 week', NOW()),
|
||||
(10, 'inactive.user', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'inactive@example.com', 'Inactive', 'User', false, false, false, NOW() - INTERVAL '1 year', NULL),
|
||||
(11, 'staff.member', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'staff@mycrib.com', 'Staff', 'Member', true, true, false, NOW() - INTERVAL '3 months', NOW() - INTERVAL '6 hours'),
|
||||
(12, 'george.harrison', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'george@example.com', 'George', 'Harrison', true, false, false, NOW() - INTERVAL '45 days', NOW() - INTERVAL '10 days')
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
username = EXCLUDED.username,
|
||||
password = EXCLUDED.password,
|
||||
email = EXCLUDED.email,
|
||||
first_name = EXCLUDED.first_name,
|
||||
last_name = EXCLUDED.last_name,
|
||||
is_active = EXCLUDED.is_active;
|
||||
username = EXCLUDED.username, password = EXCLUDED.password, email = EXCLUDED.email,
|
||||
first_name = EXCLUDED.first_name, last_name = EXCLUDED.last_name, is_active = EXCLUDED.is_active,
|
||||
is_staff = EXCLUDED.is_staff, is_superuser = EXCLUDED.is_superuser;
|
||||
|
||||
-- User Profiles (email verified)
|
||||
-- =====================================================
|
||||
-- USER PROFILES
|
||||
-- =====================================================
|
||||
INSERT INTO user_userprofile (id, created_at, updated_at, user_id, verified, bio, phone_number, date_of_birth, profile_picture)
|
||||
VALUES
|
||||
(1, NOW(), NOW(), 1, true, '', '', NULL, ''),
|
||||
(2, NOW(), NOW(), 2, true, '', '', NULL, ''),
|
||||
(3, NOW(), NOW(), 3, true, '', '', NULL, ''),
|
||||
(4, NOW(), NOW(), 4, true, '', '', NULL, '')
|
||||
ON CONFLICT (user_id) DO UPDATE SET
|
||||
verified = true,
|
||||
updated_at = NOW();
|
||||
(1, NOW(), NOW(), 1, true, 'System administrator', '+1-555-0001', '1985-01-15', 'https://picsum.photos/seed/admin/200'),
|
||||
(2, NOW(), NOW(), 2, true, 'Homeowner with multiple properties', '+1-555-0002', '1980-03-22', 'https://picsum.photos/seed/john/200'),
|
||||
(3, NOW(), NOW(), 3, true, 'First-time homeowner', '+1-555-0003', '1992-07-08', 'https://picsum.photos/seed/jane/200'),
|
||||
(4, NOW(), NOW(), 4, true, 'Real estate investor', '+1-555-0004', '1975-11-30', 'https://picsum.photos/seed/bob/200'),
|
||||
(5, NOW(), NOW(), 5, true, 'Property manager', '+1-555-0005', '1988-05-17', 'https://picsum.photos/seed/alice/200'),
|
||||
(6, NOW(), NOW(), 6, false, '', '+1-555-0006', NULL, ''),
|
||||
(7, NOW(), NOW(), 7, false, 'New to the app', '', NULL, ''),
|
||||
(8, NOW(), NOW(), 8, true, 'DIY enthusiast', '+1-555-0008', '1990-09-25', 'https://picsum.photos/seed/edward/200'),
|
||||
(9, NOW(), NOW(), 9, true, 'Interior designer', '+1-555-0009', '1995-02-14', 'https://picsum.photos/seed/fiona/200'),
|
||||
(10, NOW(), NOW(), 10, false, '', '', NULL, ''),
|
||||
(11, NOW(), NOW(), 11, true, 'Customer support', '+1-555-0011', '1987-06-20', 'https://picsum.photos/seed/staff/200'),
|
||||
(12, NOW(), NOW(), 12, true, 'Weekend warrior', '+1-555-0012', '1982-12-05', 'https://picsum.photos/seed/george/200')
|
||||
ON CONFLICT (user_id) DO UPDATE SET verified = EXCLUDED.verified, bio = EXCLUDED.bio, updated_at = NOW();
|
||||
|
||||
-- User Subscriptions
|
||||
INSERT INTO subscription_usersubscription (id, created_at, updated_at, user_id, tier, subscribed_at, expires_at, auto_renew, platform)
|
||||
-- =====================================================
|
||||
-- USER SUBSCRIPTIONS (mix of free and pro, various platforms)
|
||||
-- =====================================================
|
||||
INSERT INTO subscription_usersubscription (id, created_at, updated_at, user_id, tier, subscribed_at, expires_at, auto_renew, platform, cancelled_at)
|
||||
VALUES
|
||||
(1, NOW(), NOW(), 1, 'pro', NOW(), NOW() + INTERVAL '1 year', true, 'ios'),
|
||||
(2, NOW(), NOW(), 2, 'pro', NOW(), NOW() + INTERVAL '1 year', true, 'android'),
|
||||
(3, NOW(), NOW(), 3, 'free', NULL, NULL, false, NULL),
|
||||
(4, NOW(), NOW(), 4, 'free', NULL, NULL, false, NULL)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
tier = EXCLUDED.tier,
|
||||
updated_at = NOW();
|
||||
(1, NOW(), NOW(), 1, 'pro', NOW() - INTERVAL '11 months', NOW() + INTERVAL '1 month', true, 'ios', NULL),
|
||||
(2, NOW(), NOW(), 2, 'pro', NOW() - INTERVAL '6 months', NOW() + INTERVAL '6 months', true, 'android', NULL),
|
||||
(3, NOW(), NOW(), 3, 'free', NULL, NULL, false, NULL, NULL),
|
||||
(4, NOW(), NOW(), 4, 'pro', NOW() - INTERVAL '3 months', NOW() + INTERVAL '9 months', true, 'ios', NULL),
|
||||
(5, NOW(), NOW(), 5, 'pro', NOW() - INTERVAL '1 month', NOW() + INTERVAL '11 months', false, 'android', NULL),
|
||||
(6, NOW(), NOW(), 6, 'free', NULL, NULL, false, NULL, NULL),
|
||||
(7, NOW(), NOW(), 7, 'free', NULL, NULL, false, NULL, NULL),
|
||||
(8, NOW(), NOW(), 8, 'pro', NOW() - INTERVAL '2 months', NOW() - INTERVAL '1 month', false, 'ios', NOW() - INTERVAL '1 month'),
|
||||
(9, NOW(), NOW(), 9, 'pro', NOW() - INTERVAL '1 week', NOW() + INTERVAL '1 year', true, 'android', NULL),
|
||||
(10, NOW(), NOW(), 10, 'free', NULL, NULL, false, NULL, NULL),
|
||||
(11, NOW(), NOW(), 11, 'pro', NOW() - INTERVAL '6 months', NOW() + INTERVAL '6 months', true, 'ios', NULL),
|
||||
(12, NOW(), NOW(), 12, 'free', NULL, NULL, false, NULL, NULL)
|
||||
ON CONFLICT (id) DO UPDATE SET tier = EXCLUDED.tier, updated_at = NOW();
|
||||
|
||||
-- Test Residences (using Go/GORM schema: street_address, state_province, postal_code)
|
||||
INSERT INTO residence_residence (id, created_at, updated_at, owner_id, property_type_id, name, street_address, city, state_province, postal_code, country, is_active, is_primary)
|
||||
-- =====================================================
|
||||
-- RESIDENCES (all property types, various locations)
|
||||
-- Property types: 1=House, 2=Apartment, 3=Condo, 4=Townhouse, 5=Mobile Home, 6=Multi-Family, 7=Vacation Home
|
||||
-- =====================================================
|
||||
INSERT INTO residence_residence (id, created_at, updated_at, owner_id, property_type_id, name, street_address, apartment_unit, city, state_province, postal_code, country, bedrooms, bathrooms, square_footage, year_built, description, is_active, is_primary)
|
||||
VALUES
|
||||
(1, NOW(), NOW(), 2, 1, 'Main House', '123 Main Street', 'Springfield', 'IL', '62701', 'USA', true, true),
|
||||
(2, NOW(), NOW(), 2, 7, 'Beach House', '456 Ocean Drive', 'Miami', 'FL', '33139', 'USA', true, false),
|
||||
(3, NOW(), NOW(), 3, 2, 'Downtown Apartment', '789 City Center', 'Los Angeles', 'CA', '90012', 'USA', true, true),
|
||||
(4, NOW(), NOW(), 4, 3, 'Mountain Condo', '321 Peak View', 'Denver', 'CO', '80202', 'USA', true, true)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
street_address = EXCLUDED.street_address,
|
||||
updated_at = NOW();
|
||||
-- John's properties (user 2)
|
||||
(1, NOW() - INTERVAL '6 months', NOW(), 2, 1, 'Main Family Home', '123 Oak Street', NULL, 'Springfield', 'IL', '62701', 'USA', 4, 3, 2500, 1995, 'Beautiful colonial style home with large backyard', true, true),
|
||||
(2, NOW() - INTERVAL '5 months', NOW(), 2, 7, 'Beach Getaway', '456 Ocean Boulevard', NULL, 'Miami Beach', 'FL', '33139', 'USA', 3, 2, 1800, 2010, 'Oceanfront vacation property', true, false),
|
||||
(3, NOW() - INTERVAL '4 months', NOW(), 2, 6, 'Investment Duplex', '789 Rental Road', NULL, 'Chicago', 'IL', '60601', 'USA', 4, 2, 2200, 1985, 'Duplex rental property', true, false),
|
||||
|
||||
-- Share residence 1 with user 3
|
||||
-- Jane's properties (user 3)
|
||||
(4, NOW() - INTERVAL '5 months', NOW(), 3, 2, 'Downtown Loft', '100 City Center', 'Unit 15B', 'Los Angeles', 'CA', '90012', 'USA', 2, 2, 1200, 2018, 'Modern loft in downtown LA', true, true),
|
||||
|
||||
-- Bob's properties (user 4)
|
||||
(5, NOW() - INTERVAL '4 months', NOW(), 4, 3, 'Mountain View Condo', '321 Peak Drive', 'Unit 8', 'Denver', 'CO', '80202', 'USA', 2, 2, 1500, 2015, 'Ski-in/ski-out condo', true, true),
|
||||
(6, NOW() - INTERVAL '3 months', NOW(), 4, 4, 'Suburban Townhouse', '555 Maple Lane', NULL, 'Aurora', 'CO', '80010', 'USA', 3, 3, 1900, 2008, 'End-unit townhouse with garage', true, false),
|
||||
(7, NOW() - INTERVAL '2 months', NOW(), 4, 1, 'Rental House', '777 Income Ave', NULL, 'Boulder', 'CO', '80301', 'USA', 3, 2, 1600, 1990, 'Single family rental', true, false),
|
||||
|
||||
-- Alice's properties (user 5)
|
||||
(8, NOW() - INTERVAL '3 months', NOW(), 5, 1, 'Craftsman Bungalow', '888 Artisan Way', NULL, 'Portland', 'OR', '97201', 'USA', 3, 2, 1700, 1925, 'Historic craftsman with modern updates', true, true),
|
||||
(9, NOW() - INTERVAL '2 months', NOW(), 5, 2, 'River View Apartment', '999 Waterfront Dr', 'Apt 22', 'Portland', 'OR', '97209', 'USA', 1, 1, 750, 2020, 'Luxury apartment with river views', true, false),
|
||||
|
||||
-- Charlie's property (user 6)
|
||||
(10, NOW() - INTERVAL '2 months', NOW(), 6, 5, 'Lakeside Mobile', '111 Lakeshore Park', 'Lot 45', 'Austin', 'TX', '78701', 'USA', 2, 1, 900, 2005, 'Mobile home in lakeside community', true, true),
|
||||
|
||||
-- Edward's property (user 8)
|
||||
(11, NOW() - INTERVAL '2 weeks', NOW(), 8, 1, 'Fixer Upper', '222 Project Street', NULL, 'Seattle', 'WA', '98101', 'USA', 3, 1, 1400, 1970, 'Renovation project in progress', true, true),
|
||||
|
||||
-- Fiona's property (user 9)
|
||||
(12, NOW() - INTERVAL '1 week', NOW(), 9, 2, 'Designer Studio', '333 Arts District', 'Studio 7', 'San Francisco', 'CA', '94102', 'USA', 0, 1, 600, 2022, 'Modern studio in arts district', true, true),
|
||||
|
||||
-- George's property (user 12)
|
||||
(13, NOW() - INTERVAL '45 days', NOW(), 12, 4, 'Quiet Townhome', '444 Suburban Way', NULL, 'Scottsdale', 'AZ', '85251', 'USA', 3, 3, 2000, 2012, 'Family-friendly townhome', true, true),
|
||||
|
||||
-- Inactive residence
|
||||
(14, NOW() - INTERVAL '1 year', NOW(), 4, 1, 'Sold Property', '666 Former Home', NULL, 'Phoenix', 'AZ', '85001', 'USA', 2, 1, 1100, 1980, 'Previously owned', false, false)
|
||||
ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name, updated_at = NOW();
|
||||
|
||||
-- =====================================================
|
||||
-- RESIDENCE SHARING (multi-user access)
|
||||
-- =====================================================
|
||||
INSERT INTO residence_residence_users (residence_id, user_id)
|
||||
VALUES (1, 3)
|
||||
VALUES
|
||||
(1, 3), -- Jane has access to John's main home
|
||||
(1, 5), -- Alice has access to John's main home
|
||||
(2, 3), -- Jane has access to Beach house
|
||||
(5, 12), -- George has access to Bob's condo
|
||||
(8, 9) -- Fiona has access to Alice's bungalow
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
-- Test Contractors
|
||||
INSERT INTO task_contractor (id, created_at, updated_at, residence_id, created_by_id, name, company, phone, email, website, notes, is_favorite, is_active)
|
||||
-- =====================================================
|
||||
-- CONTRACTORS (all specialties, various ratings and details)
|
||||
-- Specialties: 1=Plumber, 2=Electrician, 3=HVAC, 4=Handyman, 5=Roofer, 6=Painter, 7=Landscaper, 8=Carpenter, 9=Appliance Repair, 10=Locksmith
|
||||
-- =====================================================
|
||||
INSERT INTO task_contractor (id, created_at, updated_at, residence_id, created_by_id, name, company, phone, email, website, notes, street_address, city, state_province, postal_code, rating, is_favorite, is_active)
|
||||
VALUES
|
||||
(1, NOW(), NOW(), 1, 2, 'Mike the Plumber', 'Mike''s Plumbing Co.', '+1-555-1001', 'mike@plumbing.com', 'https://mikesplumbing.com', 'Great service, always on time', true, true),
|
||||
(2, NOW(), NOW(), 1, 2, 'Sparky Electric', 'Sparky Electrical Services', '+1-555-1002', 'info@sparky.com', NULL, 'Licensed and insured', false, true),
|
||||
(3, NOW(), NOW(), 1, 2, 'Cool Air HVAC', 'Cool Air Heating & Cooling', '+1-555-1003', 'service@coolair.com', 'https://coolair.com', '24/7 emergency service', true, true),
|
||||
(4, NOW(), NOW(), 3, 3, 'Handy Andy', NULL, '+1-555-1004', 'andy@handyman.com', NULL, 'General repairs', false, true)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
company = EXCLUDED.company,
|
||||
updated_at = NOW();
|
||||
-- John's contractors (residence 1)
|
||||
(1, NOW(), NOW(), 1, 2, 'Mike Johnson', 'Mike''s Plumbing Pro', '+1-555-1001', 'mike@plumbingpro.com', 'https://mikesplumbingpro.com', 'Best plumber in town. Always on time. 24/7 emergency service available.', '100 Trade Center', 'Springfield', 'IL', '62702', 4.9, true, true),
|
||||
(2, NOW(), NOW(), 1, 2, 'Sarah Electric', 'Sparky Electrical Services', '+1-555-1002', 'sarah@sparkyelectric.com', 'https://sparkyelectric.com', 'Licensed master electrician. Specializes in panel upgrades.', '200 Industrial Blvd', 'Springfield', 'IL', '62703', 4.7, false, true),
|
||||
(3, NOW(), NOW(), 1, 2, 'Cool Air Team', 'Arctic Comfort HVAC', '+1-555-1003', 'service@arcticcomfort.com', 'https://arcticcomfort.com', 'Annual maintenance contract available. Fast response time.', '300 Climate Way', 'Springfield', 'IL', '62704', 4.8, true, true),
|
||||
(4, NOW(), NOW(), 1, 2, 'Tom the Handyman', NULL, '+1-555-1004', 'tom.handyman@gmail.com', NULL, 'Jack of all trades. Great for small jobs.', NULL, 'Springfield', 'IL', NULL, 4.5, false, true),
|
||||
(5, NOW(), NOW(), 1, 2, 'Green Thumb Landscaping', 'Green Thumb LLC', '+1-555-1005', 'info@greenthumbland.com', 'https://greenthumbland.com', 'Weekly lawn service and seasonal plantings.', '400 Garden Path', 'Springfield', 'IL', '62705', 4.6, true, true),
|
||||
|
||||
-- Beach house contractors (residence 2)
|
||||
(6, NOW(), NOW(), 2, 2, 'Beach Plumbing Co', 'Coastal Plumbing', '+1-305-2001', 'coastal@plumbing.com', NULL, 'Specializes in salt-water corrosion issues.', '500 Shore Dr', 'Miami Beach', 'FL', '33140', 4.4, false, true),
|
||||
(7, NOW(), NOW(), 2, 2, 'Hurricane Shutters Pro', 'Storm Ready Inc', '+1-305-2002', 'ready@stormready.com', 'https://stormready.com', 'Hurricane prep and shutter installation.', '600 Storm Lane', 'Miami', 'FL', '33141', 4.9, true, true),
|
||||
|
||||
-- Jane's contractors (residence 4)
|
||||
(8, NOW(), NOW(), 4, 3, 'LA Maintenance', 'Downtown Services LLC', '+1-213-3001', 'support@dtservices.com', NULL, 'Building-approved contractor for condo repairs.', '700 Commerce St', 'Los Angeles', 'CA', '90013', 4.3, false, true),
|
||||
(9, NOW(), NOW(), 4, 3, 'Appliance Doctor', 'Fix-It Appliances', '+1-213-3002', 'fixit@appliances.com', 'https://fixitappliances.com', 'All major brands. Same-day service available.', '800 Repair Rd', 'Los Angeles', 'CA', '90014', 4.7, true, true),
|
||||
|
||||
-- Bob's contractors (residences 5, 6, 7)
|
||||
(10, NOW(), NOW(), 5, 4, 'Mountain Roof Experts', 'Peak Roofing', '+1-303-4001', 'peak@roofing.com', 'https://peakroofing.com', 'Snow load specialists. Emergency repairs.', '900 Summit Ave', 'Denver', 'CO', '80203', 4.8, true, true),
|
||||
(11, NOW(), NOW(), 5, 4, 'Colorado Paint Crew', 'Altitude Painters', '+1-303-4002', 'paint@altitudepainters.com', NULL, 'Interior and exterior. Color consultation included.', '1000 Brush St', 'Denver', 'CO', '80204', 4.5, false, true),
|
||||
(12, NOW(), NOW(), 6, 4, 'Garage Door Kings', 'Royal Doors Inc', '+1-303-4003', 'royal@doorsking.com', 'https://royaldoors.com', 'Installation and repair of all garage door types.', '1100 Entry Way', 'Aurora', 'CO', '80011', 4.6, false, true),
|
||||
|
||||
-- Alice's contractors (residences 8, 9)
|
||||
(13, NOW(), NOW(), 8, 5, 'Historic Home Specialist', 'Preservation Builders', '+1-503-5001', 'info@preservationbuilders.com', 'https://preservationbuilders.com', 'Specializes in historic home restoration and repairs.', '1200 Heritage Ln', 'Portland', 'OR', '97202', 4.9, true, true),
|
||||
(14, NOW(), NOW(), 8, 5, 'Eco Plumbing', 'Green Flow Plumbing', '+1-503-5002', 'green@flowplumbing.com', NULL, 'Eco-friendly solutions. Water conservation experts.', '1300 Eco Way', 'Portland', 'OR', '97203', 4.4, false, true),
|
||||
|
||||
-- Edward's contractors (residence 11)
|
||||
(15, NOW(), NOW(), 11, 8, 'Demo Dave', 'Demolition & Renovation', '+1-206-6001', 'dave@demoreno.com', NULL, 'Demolition and structural work for renovations.', '1400 Build St', 'Seattle', 'WA', '98102', 4.2, false, true),
|
||||
(16, NOW(), NOW(), 11, 8, 'Master Carpenter', 'Woodworks Plus', '+1-206-6002', 'craft@woodworksplus.com', 'https://woodworksplus.com', 'Custom cabinetry and finish carpentry.', '1500 Timber Rd', 'Seattle', 'WA', '98103', 4.8, true, true),
|
||||
|
||||
-- Fiona's contractors (residence 12)
|
||||
(17, NOW(), NOW(), 12, 9, 'Smart Home Installer', 'Tech Home Solutions', '+1-415-7001', 'smart@techhome.com', 'https://techhome.com', 'Smart home device installation and setup.', '1600 Digital Dr', 'San Francisco', 'CA', '94103', 4.6, true, true),
|
||||
|
||||
-- George's contractors (residence 13)
|
||||
(18, NOW(), NOW(), 13, 12, 'Desert Cooling', 'Cactus HVAC', '+1-480-8001', 'cool@cactushvac.com', 'https://cactushvac.com', 'Experts in desert climate cooling systems.', '1700 Heat Wave Ave', 'Scottsdale', 'AZ', '85252', 4.7, true, true),
|
||||
(19, NOW(), NOW(), 13, 12, 'Pool Pro AZ', 'Aqua Services', '+1-480-8002', 'pool@aquaservices.com', NULL, 'Pool maintenance and equipment repair.', '1800 Splash Ln', 'Scottsdale', 'AZ', '85253', 4.5, false, true),
|
||||
|
||||
-- Inactive contractor
|
||||
(20, NOW(), NOW(), 1, 2, 'Retired Roofer', 'Old Roof Co', '+1-555-9999', NULL, NULL, 'No longer in business', NULL, 'Springfield', 'IL', NULL, 3.5, false, false)
|
||||
ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name, updated_at = NOW();
|
||||
|
||||
-- Contractor Specialties (many-to-many)
|
||||
INSERT INTO task_contractor_specialties (contractor_id, contractor_specialty_id)
|
||||
VALUES
|
||||
(1, 1), -- Mike: Plumber
|
||||
(2, 2), -- Sparky: Electrician
|
||||
(3, 3), -- Cool Air: HVAC
|
||||
(4, 4), -- Andy: Handyman
|
||||
(4, 6) -- Andy: Also Painter
|
||||
(1, 1), -- Mike: Plumber
|
||||
(2, 2), -- Sarah: Electrician
|
||||
(3, 3), -- Cool Air: HVAC
|
||||
(4, 4), (4, 6), (4, 8), -- Tom: Handyman, Painter, Carpenter
|
||||
(5, 7), -- Green Thumb: Landscaper
|
||||
(6, 1), -- Beach Plumbing: Plumber
|
||||
(7, 4), (7, 8), -- Hurricane: Handyman, Carpenter
|
||||
(8, 4), (8, 1), (8, 2), -- LA Maintenance: Handyman, Plumber, Electrician
|
||||
(9, 9), -- Appliance Doctor: Appliance Repair
|
||||
(10, 5), -- Mountain Roof: Roofer
|
||||
(11, 6), -- Colorado Paint: Painter
|
||||
(12, 4), (12, 8), -- Garage Door: Handyman, Carpenter
|
||||
(13, 8), (13, 6), -- Historic: Carpenter, Painter
|
||||
(14, 1), -- Eco Plumbing: Plumber
|
||||
(15, 4), (15, 8), -- Demo Dave: Handyman, Carpenter
|
||||
(16, 8), -- Master Carpenter: Carpenter
|
||||
(17, 2), (17, 4), -- Smart Home: Electrician, Handyman
|
||||
(18, 3), -- Desert Cooling: HVAC
|
||||
(19, 4), -- Pool Pro: Handyman
|
||||
(20, 5) -- Retired Roofer: Roofer
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
-- Test Tasks
|
||||
-- =====================================================
|
||||
-- TASKS (comprehensive coverage of all categories, priorities, statuses, frequencies)
|
||||
-- Categories: 1=Plumbing, 2=Electrical, 3=HVAC, 4=Appliances, 5=Outdoor/Landscaping, 6=Structural, 7=Safety, 8=Cleaning, 9=Pest Control, 10=Other
|
||||
-- Priorities: 1=Low, 2=Medium, 3=High, 4=Urgent
|
||||
-- Statuses: 1=Pending, 2=In Progress, 3=Completed, 4=On Hold, 5=Cancelled
|
||||
-- Frequencies: 1=Once, 2=Daily, 3=Weekly, 4=Bi-Weekly, 5=Monthly, 6=Quarterly, 7=Semi-Annual, 8=Annual
|
||||
-- =====================================================
|
||||
INSERT INTO task_task (id, created_at, updated_at, residence_id, created_by_id, assigned_to_id, title, description, category_id, priority_id, status_id, frequency_id, due_date, estimated_cost, contractor_id, is_cancelled, is_archived)
|
||||
VALUES
|
||||
-- Residence 1 tasks
|
||||
(1, NOW(), NOW(), 1, 2, 2, 'Fix leaky faucet', 'Kitchen faucet is dripping', 1, 2, 1, 1, CURRENT_DATE + INTERVAL '7 days', 150.00, 1, false, false),
|
||||
(2, NOW(), NOW(), 1, 2, NULL, 'Replace smoke detector batteries', 'Annual battery replacement', 7, 3, 1, 8, CURRENT_DATE + INTERVAL '30 days', 25.00, NULL, false, false),
|
||||
(3, NOW(), NOW(), 1, 2, 2, 'HVAC filter replacement', 'Replace air filters', 3, 2, 2, 5, CURRENT_DATE + INTERVAL '14 days', 50.00, 3, false, false),
|
||||
(4, NOW(), NOW(), 1, 2, 3, 'Mow lawn', 'Weekly lawn maintenance', 5, 1, 3, 3, CURRENT_DATE - INTERVAL '2 days', NULL, NULL, false, false),
|
||||
(5, NOW(), NOW(), 1, 2, NULL, 'Clean gutters', 'Remove leaves and debris', 5, 2, 1, 7, CURRENT_DATE + INTERVAL '60 days', 200.00, NULL, false, false),
|
||||
-- ===== RESIDENCE 1 (John's Main Home) - 15 tasks =====
|
||||
-- Plumbing tasks
|
||||
(1, NOW() - INTERVAL '30 days', NOW(), 1, 2, 2, 'Fix leaky kitchen faucet', 'Kitchen faucet has been dripping for a week. Washer may need replacement.', 1, 2, 1, 1, CURRENT_DATE + INTERVAL '7 days', 150.00, 1, false, false),
|
||||
(2, NOW() - INTERVAL '60 days', NOW(), 1, 2, 3, 'Unclog bathroom drain', 'Master bathroom sink draining slowly. Tried Drano with no success.', 1, 3, 3, 1, CURRENT_DATE - INTERVAL '45 days', 85.00, 1, false, false),
|
||||
(3, NOW() - INTERVAL '15 days', NOW(), 1, 2, NULL, 'Water heater inspection', 'Annual inspection and flush of water heater tank', 1, 1, 1, 8, CURRENT_DATE + INTERVAL '30 days', 175.00, 1, false, false),
|
||||
|
||||
-- Residence 2 tasks
|
||||
(6, NOW(), NOW(), 2, 2, 2, 'Check pool chemicals', 'Test and balance pool water', 10, 2, 1, 3, CURRENT_DATE + INTERVAL '3 days', NULL, NULL, false, false),
|
||||
(7, NOW(), NOW(), 2, 2, NULL, 'Hurricane shutters inspection', 'Annual inspection before hurricane season', 7, 3, 1, 8, CURRENT_DATE + INTERVAL '90 days', NULL, NULL, false, false),
|
||||
-- Electrical tasks
|
||||
(4, NOW() - INTERVAL '20 days', NOW(), 1, 2, 2, 'Install ceiling fan', 'Replace light fixture in master bedroom with ceiling fan', 2, 2, 2, 1, CURRENT_DATE + INTERVAL '14 days', 350.00, 2, false, false),
|
||||
(5, NOW() - INTERVAL '90 days', NOW(), 1, 2, NULL, 'Replace smoke detector batteries', 'Replace batteries in all 6 smoke detectors', 7, 3, 3, 8, CURRENT_DATE - INTERVAL '60 days', 30.00, NULL, false, false),
|
||||
(6, NOW() - INTERVAL '5 days', NOW(), 1, 2, NULL, 'Fix flickering lights', 'Living room lights flicker occasionally. May need new switch.', 2, 2, 1, 1, CURRENT_DATE + INTERVAL '10 days', 125.00, 2, false, false),
|
||||
|
||||
-- Residence 3 tasks
|
||||
(8, NOW(), NOW(), 3, 3, 3, 'Fix garbage disposal', 'Disposal is jammed', 4, 3, 1, 1, CURRENT_DATE + INTERVAL '2 days', 100.00, NULL, false, false),
|
||||
(9, NOW(), NOW(), 3, 3, NULL, 'Deep clean apartment', 'Quarterly deep cleaning', 8, 1, 1, 6, CURRENT_DATE + INTERVAL '45 days', 300.00, NULL, false, false),
|
||||
-- HVAC tasks
|
||||
(7, NOW() - INTERVAL '45 days', NOW(), 1, 2, 2, 'Replace HVAC filters', 'Monthly filter replacement for central air system', 3, 2, 3, 5, CURRENT_DATE - INTERVAL '15 days', 45.00, 3, false, false),
|
||||
(8, NOW() - INTERVAL '10 days', NOW(), 1, 2, NULL, 'Schedule AC tune-up', 'Pre-summer AC maintenance and coolant check', 3, 2, 1, 8, CURRENT_DATE + INTERVAL '60 days', 200.00, 3, false, false),
|
||||
|
||||
-- Residence 4 tasks
|
||||
(10, NOW(), NOW(), 4, 4, 4, 'Winterize pipes', 'Prepare plumbing for winter', 1, 3, 1, 8, CURRENT_DATE + INTERVAL '120 days', 250.00, NULL, false, false)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
title = EXCLUDED.title,
|
||||
description = EXCLUDED.description,
|
||||
updated_at = NOW();
|
||||
-- Outdoor/Landscaping tasks
|
||||
(9, NOW() - INTERVAL '7 days', NOW(), 1, 2, 3, 'Mow lawn', 'Weekly lawn mowing and edging', 5, 1, 3, 3, CURRENT_DATE - INTERVAL '2 days', 50.00, 5, false, false),
|
||||
(10, NOW() - INTERVAL '25 days', NOW(), 1, 2, NULL, 'Trim hedges', 'Trim front and back yard hedges', 5, 1, 1, 6, CURRENT_DATE + INTERVAL '20 days', 150.00, 5, false, false),
|
||||
(11, NOW() - INTERVAL '100 days', NOW(), 1, 2, 5, 'Clean gutters', 'Remove leaves and debris from all gutters', 5, 2, 3, 7, CURRENT_DATE - INTERVAL '70 days', 175.00, NULL, false, false),
|
||||
(12, NOW() - INTERVAL '3 days', NOW(), 1, 2, NULL, 'Fertilize lawn', 'Apply spring fertilizer treatment', 5, 1, 1, 6, CURRENT_DATE + INTERVAL '5 days', 75.00, 5, false, false),
|
||||
|
||||
-- Test Task Completions
|
||||
INSERT INTO task_taskcompletion (id, created_at, updated_at, task_id, completed_by_id, completed_at, notes, actual_cost)
|
||||
-- Safety tasks
|
||||
(13, NOW() - INTERVAL '180 days', NOW(), 1, 2, 2, 'Test fire extinguishers', 'Annual inspection of all fire extinguishers', 7, 3, 3, 8, CURRENT_DATE - INTERVAL '150 days', 0.00, NULL, false, false),
|
||||
|
||||
-- Cleaning tasks
|
||||
(14, NOW() - INTERVAL '40 days', NOW(), 1, 2, 3, 'Deep clean carpets', 'Professional carpet cleaning for all rooms', 8, 1, 3, 8, CURRENT_DATE - INTERVAL '25 days', 350.00, NULL, false, false),
|
||||
|
||||
-- On hold task
|
||||
(15, NOW() - INTERVAL '50 days', NOW(), 1, 2, NULL, 'Paint exterior', 'Repaint exterior trim and shutters', 6, 2, 4, 1, CURRENT_DATE + INTERVAL '90 days', 2500.00, NULL, false, false),
|
||||
|
||||
-- ===== RESIDENCE 2 (Beach House) - 8 tasks =====
|
||||
(16, NOW() - INTERVAL '20 days', NOW(), 2, 2, 2, 'Check pool chemicals', 'Weekly pool water testing and chemical balance', 10, 2, 3, 3, CURRENT_DATE - INTERVAL '6 days', 50.00, NULL, false, false),
|
||||
(17, NOW() - INTERVAL '15 days', NOW(), 2, 2, NULL, 'Hurricane shutter inspection', 'Annual inspection before hurricane season', 7, 3, 1, 8, CURRENT_DATE + INTERVAL '45 days', 300.00, 7, false, false),
|
||||
(18, NOW() - INTERVAL '30 days', NOW(), 2, 2, NULL, 'AC filter change', 'Replace AC filters - salt air requires more frequent changes', 3, 2, 1, 5, CURRENT_DATE + INTERVAL '5 days', 60.00, NULL, false, false),
|
||||
(19, NOW() - INTERVAL '60 days', NOW(), 2, 2, 2, 'Fix outdoor shower', 'Outdoor shower has low pressure', 1, 2, 3, 1, CURRENT_DATE - INTERVAL '40 days', 200.00, 6, false, false),
|
||||
(20, NOW() - INTERVAL '5 days', NOW(), 2, 2, NULL, 'Pressure wash deck', 'Clean salt buildup from deck and railings', 8, 1, 1, 6, CURRENT_DATE + INTERVAL '30 days', 250.00, NULL, false, false),
|
||||
(21, NOW() - INTERVAL '90 days', NOW(), 2, 2, NULL, 'Pest control treatment', 'Quarterly pest control for beach property', 9, 2, 3, 6, CURRENT_DATE - INTERVAL '60 days', 150.00, NULL, false, false),
|
||||
(22, NOW() - INTERVAL '10 days', NOW(), 2, 2, NULL, 'Replace patio furniture', 'Sun-damaged furniture needs replacement', 10, 1, 4, 1, CURRENT_DATE + INTERVAL '60 days', 1200.00, NULL, false, false),
|
||||
(23, NOW() - INTERVAL '180 days', NOW(), 2, 2, 2, 'Install security cameras', 'Add 4 outdoor security cameras', 7, 2, 3, 1, CURRENT_DATE - INTERVAL '150 days', 800.00, NULL, false, false),
|
||||
|
||||
-- ===== RESIDENCE 3 (Investment Duplex) - 5 tasks =====
|
||||
(24, NOW() - INTERVAL '25 days', NOW(), 3, 2, NULL, 'Unit A - Repair drywall', 'Patch and paint drywall damage from tenant', 6, 2, 1, 1, CURRENT_DATE + INTERVAL '14 days', 400.00, NULL, false, false),
|
||||
(25, NOW() - INTERVAL '10 days', NOW(), 3, 2, NULL, 'Unit B - Replace dishwasher', 'Dishwasher not draining properly', 4, 3, 2, 1, CURRENT_DATE + INTERVAL '3 days', 650.00, NULL, false, false),
|
||||
(26, NOW() - INTERVAL '45 days', NOW(), 3, 2, 2, 'Annual fire inspection', 'Required annual fire safety inspection', 7, 3, 3, 8, CURRENT_DATE - INTERVAL '30 days', 150.00, NULL, false, false),
|
||||
(27, NOW() - INTERVAL '5 days', NOW(), 3, 2, NULL, 'Replace hallway carpet', 'Common area carpet showing wear', 6, 1, 1, 1, CURRENT_DATE + INTERVAL '45 days', 1500.00, NULL, false, false),
|
||||
(28, NOW() - INTERVAL '200 days', NOW(), 3, 2, NULL, 'Roof inspection', 'Annual roof inspection', 6, 2, 3, 8, CURRENT_DATE - INTERVAL '170 days', 250.00, NULL, false, true),
|
||||
|
||||
-- ===== RESIDENCE 4 (Jane's Downtown Loft) - 7 tasks =====
|
||||
(29, NOW() - INTERVAL '15 days', NOW(), 4, 3, 3, 'Fix garbage disposal', 'Disposal is jammed and making noise', 4, 3, 2, 1, CURRENT_DATE + INTERVAL '2 days', 150.00, 8, false, false),
|
||||
(30, NOW() - INTERVAL '30 days', NOW(), 4, 3, NULL, 'Clean dryer vent', 'Annual dryer vent cleaning for fire safety', 7, 3, 1, 8, CURRENT_DATE + INTERVAL '30 days', 125.00, NULL, false, false),
|
||||
(31, NOW() - INTERVAL '60 days', NOW(), 4, 3, 3, 'Touch up paint', 'Touch up scuff marks on walls', 6, 1, 3, 1, CURRENT_DATE - INTERVAL '45 days', 0.00, NULL, false, false),
|
||||
(32, NOW() - INTERVAL '7 days', NOW(), 4, 3, NULL, 'Replace refrigerator water filter', 'Bi-annual filter replacement', 4, 1, 1, 7, CURRENT_DATE + INTERVAL '14 days', 50.00, 9, false, false),
|
||||
(33, NOW() - INTERVAL '90 days', NOW(), 4, 3, NULL, 'Deep clean oven', 'Professional oven cleaning', 8, 1, 3, 8, CURRENT_DATE - INTERVAL '60 days', 100.00, NULL, false, false),
|
||||
(34, NOW() - INTERVAL '120 days', NOW(), 4, 3, 3, 'Install smart thermostat', 'Replace old thermostat with Nest', 3, 2, 3, 1, CURRENT_DATE - INTERVAL '100 days', 250.00, NULL, false, false),
|
||||
(35, NOW() - INTERVAL '3 days', NOW(), 4, 3, NULL, 'Repair window blinds', 'Bedroom blinds cord is broken', 10, 1, 1, 1, CURRENT_DATE + INTERVAL '21 days', 75.00, NULL, false, false),
|
||||
|
||||
-- ===== RESIDENCE 5 (Bob's Mountain Condo) - 6 tasks =====
|
||||
(36, NOW() - INTERVAL '20 days', NOW(), 5, 4, 4, 'Winterize pipes', 'Prepare plumbing for winter freeze', 1, 3, 3, 8, CURRENT_DATE - INTERVAL '10 days', 200.00, NULL, false, false),
|
||||
(37, NOW() - INTERVAL '40 days', NOW(), 5, 4, NULL, 'Check roof for snow damage', 'Inspect after heavy snowfall', 6, 3, 3, 1, CURRENT_DATE - INTERVAL '35 days', 0.00, 10, false, false),
|
||||
(38, NOW() - INTERVAL '10 days', NOW(), 5, 4, 12, 'Tune ski equipment storage', 'Organize ski room and check equipment', 10, 1, 2, 8, CURRENT_DATE + INTERVAL '7 days', 0.00, NULL, false, false),
|
||||
(39, NOW() - INTERVAL '5 days', NOW(), 5, 4, NULL, 'Replace entry door weatherstrip', 'Cold air leaking around front door', 6, 2, 1, 1, CURRENT_DATE + INTERVAL '10 days', 100.00, NULL, false, false),
|
||||
(40, NOW() - INTERVAL '90 days', NOW(), 5, 4, 4, 'HOA deck staining', 'Required deck maintenance per HOA', 5, 2, 3, 8, CURRENT_DATE - INTERVAL '60 days', 500.00, NULL, false, false),
|
||||
(41, NOW() - INTERVAL '180 days', NOW(), 5, 4, NULL, 'Fireplace inspection', 'Annual chimney and fireplace check', 7, 3, 3, 8, CURRENT_DATE - INTERVAL '150 days', 175.00, NULL, false, false),
|
||||
|
||||
-- ===== RESIDENCE 8 (Alice's Craftsman) - 6 tasks =====
|
||||
(42, NOW() - INTERVAL '25 days', NOW(), 8, 5, 5, 'Refinish hardwood floors', 'Sand and refinish original hardwood in living room', 6, 2, 2, 1, CURRENT_DATE + INTERVAL '30 days', 2000.00, 13, false, false),
|
||||
(43, NOW() - INTERVAL '50 days', NOW(), 8, 5, 9, 'Repair original windows', 'Restore and weatherproof historic windows', 6, 2, 3, 1, CURRENT_DATE - INTERVAL '20 days', 1500.00, 13, false, false),
|
||||
(44, NOW() - INTERVAL '15 days', NOW(), 8, 5, NULL, 'Update knob and tube wiring', 'Replace section of old wiring in attic', 2, 4, 1, 1, CURRENT_DATE + INTERVAL '14 days', 3000.00, NULL, false, false),
|
||||
(45, NOW() - INTERVAL '30 days', NOW(), 8, 5, 5, 'Garden maintenance', 'Weekly garden care and weeding', 5, 1, 3, 3, CURRENT_DATE - INTERVAL '7 days', 75.00, NULL, false, false),
|
||||
(46, NOW() - INTERVAL '7 days', NOW(), 8, 5, NULL, 'Fix porch swing', 'Chains need tightening and wood needs oiling', 10, 1, 1, 1, CURRENT_DATE + INTERVAL '21 days', 50.00, 13, false, false),
|
||||
(47, NOW() - INTERVAL '60 days', NOW(), 8, 5, 5, 'Clean rain gutters', 'Clear leaves from craftsman-style gutters', 5, 2, 3, 7, CURRENT_DATE - INTERVAL '30 days', 200.00, NULL, false, false),
|
||||
|
||||
-- ===== RESIDENCE 11 (Edward's Fixer Upper) - 5 tasks =====
|
||||
(48, NOW() - INTERVAL '14 days', NOW(), 11, 8, 8, 'Demo bathroom tile', 'Remove old tile in master bathroom', 6, 3, 2, 1, CURRENT_DATE + INTERVAL '7 days', 500.00, 15, false, false),
|
||||
(49, NOW() - INTERVAL '10 days', NOW(), 11, 8, NULL, 'Install new cabinets', 'Kitchen cabinet installation', 6, 3, 1, 1, CURRENT_DATE + INTERVAL '21 days', 5000.00, 16, false, false),
|
||||
(50, NOW() - INTERVAL '7 days', NOW(), 11, 8, 8, 'Run new electrical', 'Additional outlets for kitchen', 2, 3, 2, 1, CURRENT_DATE + INTERVAL '14 days', 1200.00, NULL, false, false),
|
||||
(51, NOW() - INTERVAL '3 days', NOW(), 11, 8, NULL, 'Plumbing rough-in', 'Rough plumbing for bathroom remodel', 1, 3, 1, 1, CURRENT_DATE + INTERVAL '10 days', 2500.00, NULL, false, false),
|
||||
(52, NOW() - INTERVAL '1 day', NOW(), 11, 8, 8, 'Order new appliances', 'Select and order kitchen appliances', 4, 2, 2, 1, CURRENT_DATE + INTERVAL '5 days', 4000.00, NULL, false, false),
|
||||
|
||||
-- ===== RESIDENCE 12 (Fiona's Studio) - 4 tasks =====
|
||||
(53, NOW() - INTERVAL '7 days', NOW(), 12, 9, 9, 'Setup smart lights', 'Install Philips Hue throughout studio', 2, 1, 3, 1, CURRENT_DATE - INTERVAL '3 days', 400.00, 17, false, false),
|
||||
(54, NOW() - INTERVAL '5 days', NOW(), 12, 9, NULL, 'Mount TV on wall', 'Install TV mount and hide cables', 2, 1, 1, 1, CURRENT_DATE + INTERVAL '10 days', 200.00, 17, false, false),
|
||||
(55, NOW() - INTERVAL '3 days', NOW(), 12, 9, 9, 'Organize closet', 'Install closet organization system', 10, 1, 2, 1, CURRENT_DATE + INTERVAL '7 days', 300.00, NULL, false, false),
|
||||
(56, NOW() - INTERVAL '1 day', NOW(), 12, 9, NULL, 'Replace faucet aerator', 'Low water pressure in bathroom sink', 1, 1, 1, 1, CURRENT_DATE + INTERVAL '14 days', 15.00, NULL, false, false),
|
||||
|
||||
-- ===== RESIDENCE 13 (George's Townhome) - 5 tasks =====
|
||||
(57, NOW() - INTERVAL '30 days', NOW(), 13, 12, 12, 'Service pool equipment', 'Quarterly pool pump and filter service', 10, 2, 3, 6, CURRENT_DATE - INTERVAL '15 days', 175.00, 19, false, false),
|
||||
(58, NOW() - INTERVAL '20 days', NOW(), 13, 12, NULL, 'HVAC maintenance', 'Pre-summer AC tune-up', 3, 2, 1, 8, CURRENT_DATE + INTERVAL '30 days', 200.00, 18, false, false),
|
||||
(59, NOW() - INTERVAL '10 days', NOW(), 13, 12, 12, 'Trim desert landscaping', 'Prune cacti and desert plants', 5, 1, 2, 6, CURRENT_DATE + INTERVAL '5 days', 100.00, NULL, false, false),
|
||||
(60, NOW() - INTERVAL '45 days', NOW(), 13, 12, 12, 'Check irrigation system', 'Test all drip irrigation zones', 5, 2, 3, 5, CURRENT_DATE - INTERVAL '30 days', 50.00, NULL, false, false),
|
||||
(61, NOW() - INTERVAL '5 days', NOW(), 13, 12, NULL, 'Replace garage door opener', 'Old opener failing', 4, 2, 1, 1, CURRENT_DATE + INTERVAL '14 days', 400.00, NULL, false, false),
|
||||
|
||||
-- Cancelled task
|
||||
(62, NOW() - INTERVAL '60 days', NOW(), 1, 2, NULL, 'Build treehouse', 'Cancelled - tree not suitable', 6, 1, 5, 1, CURRENT_DATE - INTERVAL '30 days', 2000.00, NULL, true, false)
|
||||
ON CONFLICT (id) DO UPDATE SET title = EXCLUDED.title, updated_at = NOW();
|
||||
|
||||
-- =====================================================
|
||||
-- TASK COMPLETIONS WITH IMAGES
|
||||
-- =====================================================
|
||||
INSERT INTO task_taskcompletion (id, created_at, updated_at, task_id, completed_by_id, completed_at, notes, actual_cost, rating)
|
||||
VALUES
|
||||
(1, NOW() - INTERVAL '2 days', NOW() - INTERVAL '2 days', 4, 3, NOW() - INTERVAL '2 days', 'Lawn looks great!', NULL)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
notes = EXCLUDED.notes,
|
||||
updated_at = NOW();
|
||||
-- Completed tasks from above with various ratings and costs
|
||||
(1, NOW() - INTERVAL '45 days', NOW(), 2, 3, NOW() - INTERVAL '45 days', 'Used drain snake and cleared hair clog. Recommend drain cover.', 75.00, 5),
|
||||
(2, NOW() - INTERVAL '60 days', NOW(), 5, 2, NOW() - INTERVAL '60 days', 'All 6 detectors updated with fresh 9V batteries.', 25.00, 4),
|
||||
(3, NOW() - INTERVAL '15 days', NOW(), 7, 2, NOW() - INTERVAL '15 days', 'Replaced with MERV 13 filters. System running great.', 55.00, 5),
|
||||
(4, NOW() - INTERVAL '2 days', NOW(), 9, 3, NOW() - INTERVAL '2 days', 'Lawn looks perfect. Edged along sidewalks and driveway.', 50.00, 5),
|
||||
(5, NOW() - INTERVAL '70 days', NOW(), 11, 5, NOW() - INTERVAL '70 days', 'Removed significant leaf buildup. Found minor gutter damage on north side - will need repair next year.', 200.00, 4),
|
||||
(6, NOW() - INTERVAL '150 days', NOW(), 13, 2, NOW() - INTERVAL '150 days', 'All extinguishers passed inspection. Kitchen one expires next year.', 0.00, 5),
|
||||
(7, NOW() - INTERVAL '25 days', NOW(), 14, 3, NOW() - INTERVAL '25 days', 'Steam cleaned all carpets. Looks like new! Recommend annual cleaning.', 375.00, 5),
|
||||
(8, NOW() - INTERVAL '6 days', NOW(), 16, 2, NOW() - INTERVAL '6 days', 'pH balanced. Added chlorine. Water crystal clear.', 45.00, 4),
|
||||
(9, NOW() - INTERVAL '40 days', NOW(), 19, 2, NOW() - INTERVAL '40 days', 'Fixed low pressure issue - was a clogged showerhead. Replaced with rain showerhead.', 150.00, 5),
|
||||
(10, NOW() - INTERVAL '60 days', NOW(), 21, 2, NOW() - INTERVAL '60 days', 'Interior and exterior treatment completed. No signs of pests.', 150.00, 4),
|
||||
(11, NOW() - INTERVAL '150 days', NOW(), 23, 2, NOW() - INTERVAL '150 days', 'Installed 4 Arlo cameras. App configured and working great. Can view remotely.', 950.00, 5),
|
||||
(12, NOW() - INTERVAL '30 days', NOW(), 26, 2, NOW() - INTERVAL '30 days', 'Passed inspection. All smoke detectors and fire extinguishers compliant.', 150.00, 5),
|
||||
(13, NOW() - INTERVAL '170 days', NOW(), 28, 2, NOW() - INTERVAL '170 days', 'No damage found. Roof in good condition for another 5+ years.', 200.00, 4),
|
||||
(14, NOW() - INTERVAL '45 days', NOW(), 31, 3, NOW() - INTERVAL '45 days', 'Touched up all scuffs in hallway and bedroom. Used matching Benjamin Moore paint.', 0.00, 5),
|
||||
(15, NOW() - INTERVAL '60 days', NOW(), 33, 3, NOW() - INTERVAL '60 days', 'Oven sparkling clean. Removed years of baked-on grease.', 100.00, 4),
|
||||
(16, NOW() - INTERVAL '100 days', NOW(), 34, 3, NOW() - INTERVAL '100 days', 'Nest installed and configured. Already seeing energy savings!', 275.00, 5),
|
||||
(17, NOW() - INTERVAL '10 days', NOW(), 36, 4, NOW() - INTERVAL '10 days', 'All pipes insulated. Outdoor spigots covered. Ready for winter.', 225.00, 5),
|
||||
(18, NOW() - INTERVAL '35 days', NOW(), 37, 4, NOW() - INTERVAL '35 days', 'No damage from snow. Cleared some accumulated ice from valleys.', 0.00, 4),
|
||||
(19, NOW() - INTERVAL '60 days', NOW(), 40, 4, NOW() - INTERVAL '60 days', 'Applied two coats of deck stain. Looks beautiful. HOA approved.', 550.00, 5),
|
||||
(20, NOW() - INTERVAL '150 days', NOW(), 41, 4, NOW() - INTERVAL '150 days', 'Chimney swept. Damper working properly. Ready for ski season!', 175.00, 5),
|
||||
(21, NOW() - INTERVAL '20 days', NOW(), 43, 9, NOW() - INTERVAL '20 days', 'Beautiful restoration work. Windows operate smoothly and seal properly now.', 1650.00, 5),
|
||||
(22, NOW() - INTERVAL '7 days', NOW(), 45, 5, NOW() - INTERVAL '7 days', 'Weeded all beds. Pruned roses. Garden looking great for spring.', 75.00, 4),
|
||||
(23, NOW() - INTERVAL '30 days', NOW(), 47, 5, NOW() - INTERVAL '30 days', 'Cleared all gutters and downspouts. Historic copper gutters in good shape.', 225.00, 5),
|
||||
(24, NOW() - INTERVAL '3 days', NOW(), 53, 9, NOW() - INTERVAL '3 days', 'All 12 Hue bulbs installed. Set up scenes for work, relax, and party modes!', 420.00, 5),
|
||||
(25, NOW() - INTERVAL '15 days', NOW(), 57, 12, NOW() - INTERVAL '15 days', 'Pump running great. Filter cleaned. Water sparkling.', 175.00, 4),
|
||||
(26, NOW() - INTERVAL '30 days', NOW(), 60, 12, NOW() - INTERVAL '30 days', 'All 8 zones tested. Replaced 3 emitters. System efficient.', 65.00, 5)
|
||||
ON CONFLICT (id) DO UPDATE SET notes = EXCLUDED.notes, updated_at = NOW();
|
||||
|
||||
-- Test Documents (using Go/GORM schema)
|
||||
INSERT INTO task_document (id, created_at, updated_at, residence_id, created_by_id, title, description, document_type, file_url, file_name, purchase_date, expiry_date, purchase_price, vendor, serial_number, is_active)
|
||||
-- =====================================================
|
||||
-- TASK COMPLETION IMAGES
|
||||
-- =====================================================
|
||||
INSERT INTO task_taskcompletionimage (id, created_at, updated_at, completion_id, image_url, caption)
|
||||
VALUES
|
||||
(1, NOW(), NOW(), 1, 2, 'HVAC Warranty', 'Warranty for central air system', 'warranty', '/uploads/docs/hvac_warranty.pdf', 'hvac_warranty.pdf', '2023-06-15', '2028-06-15', 5000.00, 'Cool Air HVAC', 'HVAC-2023-001', true),
|
||||
(2, NOW(), NOW(), 1, 2, 'Home Insurance Policy', 'Annual home insurance', 'insurance', '/uploads/docs/insurance.pdf', 'insurance.pdf', '2024-01-01', '2025-01-01', 1200.00, 'State Farm', NULL, true),
|
||||
(3, NOW(), NOW(), 1, 2, 'Refrigerator Manual', 'User manual for kitchen fridge', 'manual', '/uploads/docs/fridge_manual.pdf', 'fridge_manual.pdf', '2022-03-20', NULL, 1500.00, 'Best Buy', 'LG-RF-2022', true),
|
||||
(4, NOW(), NOW(), 3, 3, 'Lease Agreement', 'Apartment lease contract', 'contract', '/uploads/docs/lease.pdf', 'lease.pdf', '2024-01-01', '2025-01-01', NULL, 'Downtown Properties LLC', NULL, true)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
title = EXCLUDED.title,
|
||||
description = EXCLUDED.description,
|
||||
updated_at = NOW();
|
||||
-- Completion 1 (Drain unclog) - 2 images
|
||||
(1, NOW() - INTERVAL '45 days', NOW(), 1, 'https://picsum.photos/seed/drain1/800/600', 'Before - slow draining sink'),
|
||||
(2, NOW() - INTERVAL '45 days', NOW(), 1, 'https://picsum.photos/seed/drain2/800/600', 'After - drain cleared and flowing'),
|
||||
|
||||
-- Test Notifications
|
||||
INSERT INTO notifications_notification (id, created_at, updated_at, user_id, notification_type, title, body, task_id, sent, read)
|
||||
-- Completion 3 (HVAC filters) - 3 images
|
||||
(3, NOW() - INTERVAL '15 days', NOW(), 3, 'https://picsum.photos/seed/filter1/800/600', 'Old dirty filter'),
|
||||
(4, NOW() - INTERVAL '15 days', NOW(), 3, 'https://picsum.photos/seed/filter2/800/600', 'New MERV 13 filter installed'),
|
||||
(5, NOW() - INTERVAL '15 days', NOW(), 3, 'https://picsum.photos/seed/filter3/800/600', 'HVAC system running'),
|
||||
|
||||
-- Completion 4 (Lawn mowing) - 4 images
|
||||
(6, NOW() - INTERVAL '2 days', NOW(), 4, 'https://picsum.photos/seed/lawn1/800/600', 'Front yard before'),
|
||||
(7, NOW() - INTERVAL '2 days', NOW(), 4, 'https://picsum.photos/seed/lawn2/800/600', 'Front yard after'),
|
||||
(8, NOW() - INTERVAL '2 days', NOW(), 4, 'https://picsum.photos/seed/lawn3/800/600', 'Back yard completed'),
|
||||
(9, NOW() - INTERVAL '2 days', NOW(), 4, 'https://picsum.photos/seed/lawn4/800/600', 'Clean edging along driveway'),
|
||||
|
||||
-- Completion 5 (Gutter cleaning) - 2 images
|
||||
(10, NOW() - INTERVAL '70 days', NOW(), 5, 'https://picsum.photos/seed/gutter1/800/600', 'Leaves removed from gutters'),
|
||||
(11, NOW() - INTERVAL '70 days', NOW(), 5, 'https://picsum.photos/seed/gutter2/800/600', 'Minor damage found - north side'),
|
||||
|
||||
-- Completion 7 (Carpet cleaning) - 3 images
|
||||
(12, NOW() - INTERVAL '25 days', NOW(), 7, 'https://picsum.photos/seed/carpet1/800/600', 'Living room before'),
|
||||
(13, NOW() - INTERVAL '25 days', NOW(), 7, 'https://picsum.photos/seed/carpet2/800/600', 'Living room after'),
|
||||
(14, NOW() - INTERVAL '25 days', NOW(), 7, 'https://picsum.photos/seed/carpet3/800/600', 'Bedroom carpet fresh'),
|
||||
|
||||
-- Completion 9 (Outdoor shower) - 2 images
|
||||
(15, NOW() - INTERVAL '40 days', NOW(), 9, 'https://picsum.photos/seed/shower1/800/600', 'New rain showerhead installed'),
|
||||
(16, NOW() - INTERVAL '40 days', NOW(), 9, 'https://picsum.photos/seed/shower2/800/600', 'Full water pressure restored'),
|
||||
|
||||
-- Completion 11 (Security cameras) - 4 images
|
||||
(17, NOW() - INTERVAL '150 days', NOW(), 11, 'https://picsum.photos/seed/cam1/800/600', 'Front door camera'),
|
||||
(18, NOW() - INTERVAL '150 days', NOW(), 11, 'https://picsum.photos/seed/cam2/800/600', 'Driveway camera'),
|
||||
(19, NOW() - INTERVAL '150 days', NOW(), 11, 'https://picsum.photos/seed/cam3/800/600', 'Backyard camera'),
|
||||
(20, NOW() - INTERVAL '150 days', NOW(), 11, 'https://picsum.photos/seed/cam4/800/600', 'Pool area camera'),
|
||||
|
||||
-- Completion 16 (Smart thermostat) - 2 images
|
||||
(21, NOW() - INTERVAL '100 days', NOW(), 16, 'https://picsum.photos/seed/nest1/800/600', 'Old thermostat removed'),
|
||||
(22, NOW() - INTERVAL '100 days', NOW(), 16, 'https://picsum.photos/seed/nest2/800/600', 'New Nest installed and configured'),
|
||||
|
||||
-- Completion 17 (Winterize pipes) - 3 images
|
||||
(23, NOW() - INTERVAL '10 days', NOW(), 17, 'https://picsum.photos/seed/winter1/800/600', 'Pipe insulation applied'),
|
||||
(24, NOW() - INTERVAL '10 days', NOW(), 17, 'https://picsum.photos/seed/winter2/800/600', 'Outdoor spigot cover'),
|
||||
(25, NOW() - INTERVAL '10 days', NOW(), 17, 'https://picsum.photos/seed/winter3/800/600', 'Heat tape on exposed pipes'),
|
||||
|
||||
-- Completion 19 (Deck staining) - 4 images
|
||||
(26, NOW() - INTERVAL '60 days', NOW(), 19, 'https://picsum.photos/seed/deck1/800/600', 'Deck before staining'),
|
||||
(27, NOW() - INTERVAL '60 days', NOW(), 19, 'https://picsum.photos/seed/deck2/800/600', 'First coat applied'),
|
||||
(28, NOW() - INTERVAL '60 days', NOW(), 19, 'https://picsum.photos/seed/deck3/800/600', 'Second coat complete'),
|
||||
(29, NOW() - INTERVAL '60 days', NOW(), 19, 'https://picsum.photos/seed/deck4/800/600', 'Final result - beautiful!'),
|
||||
|
||||
-- Completion 21 (Window restoration) - 3 images
|
||||
(30, NOW() - INTERVAL '20 days', NOW(), 21, 'https://picsum.photos/seed/window1/800/600', 'Original window before'),
|
||||
(31, NOW() - INTERVAL '20 days', NOW(), 21, 'https://picsum.photos/seed/window2/800/600', 'Restoration in progress'),
|
||||
(32, NOW() - INTERVAL '20 days', NOW(), 21, 'https://picsum.photos/seed/window3/800/600', 'Restored window - good as new'),
|
||||
|
||||
-- Completion 24 (Smart lights) - 2 images
|
||||
(33, NOW() - INTERVAL '3 days', NOW(), 24, 'https://picsum.photos/seed/hue1/800/600', 'Hue lights in work mode'),
|
||||
(34, NOW() - INTERVAL '3 days', NOW(), 24, 'https://picsum.photos/seed/hue2/800/600', 'Hue lights in relax mode')
|
||||
ON CONFLICT (id) DO UPDATE SET image_url = EXCLUDED.image_url, caption = EXCLUDED.caption;
|
||||
|
||||
-- =====================================================
|
||||
-- DOCUMENTS WITH IMAGES (all document types)
|
||||
-- Document types: general, warranty, receipt, contract, insurance, manual
|
||||
-- =====================================================
|
||||
INSERT INTO task_document (id, created_at, updated_at, residence_id, created_by_id, task_id, title, description, document_type, file_url, file_name, file_size, mime_type, purchase_date, expiry_date, purchase_price, vendor, serial_number, model_number, is_active)
|
||||
VALUES
|
||||
(1, NOW() - INTERVAL '1 day', NOW() - INTERVAL '1 day', 2, 'task_due_soon', 'Task Due Soon', 'Fix leaky faucet is due in 7 days', 1, true, false),
|
||||
(2, NOW() - INTERVAL '2 days', NOW() - INTERVAL '2 days', 2, 'task_completed', 'Task Completed', 'Mow lawn has been marked as completed', 4, true, true),
|
||||
(3, NOW() - INTERVAL '3 days', NOW() - INTERVAL '3 days', 3, 'task_assigned', 'Task Assigned', 'You have been assigned to: Mow lawn', 4, true, true)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
title = EXCLUDED.title,
|
||||
body = EXCLUDED.body,
|
||||
updated_at = NOW();
|
||||
-- ===== RESIDENCE 1 - Warranties and documents =====
|
||||
(1, NOW() - INTERVAL '6 months', NOW(), 1, 2, NULL, 'HVAC System Warranty', '5-year warranty on Carrier central air system', 'warranty', 'https://example.com/docs/hvac_warranty.pdf', 'hvac_warranty.pdf', 245000, 'application/pdf', '2023-06-15', '2028-06-15', 5500.00, 'Arctic Comfort HVAC', 'CARRIER-2023-45892', '24ACC636A003', true),
|
||||
(2, NOW() - INTERVAL '5 months', NOW(), 1, 2, NULL, 'Water Heater Warranty', '6-year warranty on Rheem water heater', 'warranty', 'https://example.com/docs/water_heater.pdf', 'water_heater_warranty.pdf', 189000, 'application/pdf', '2022-03-10', '2028-03-10', 1200.00, 'Home Depot', 'RHEEM-22-78456', 'PROG50-38N RH67', true),
|
||||
(3, NOW() - INTERVAL '4 months', NOW(), 1, 2, NULL, 'Refrigerator Warranty', '2-year manufacturer warranty on LG refrigerator', 'warranty', 'https://example.com/docs/fridge_warranty.pdf', 'lg_fridge_warranty.pdf', 156000, 'application/pdf', '2024-01-20', '2026-01-20', 2800.00, 'Best Buy', 'LG-RF-2024-11234', 'LRMVS3006S', true),
|
||||
(4, NOW() - INTERVAL '3 months', NOW(), 1, 2, NULL, 'Dishwasher Warranty', '1-year warranty - expiring soon!', 'warranty', 'https://example.com/docs/dishwasher.pdf', 'bosch_dishwasher.pdf', 134000, 'application/pdf', '2023-08-05', '2024-08-05', 950.00, 'Lowes', 'BOSCH-DW-89012', 'SHPM88Z75N', true),
|
||||
(5, NOW() - INTERVAL '1 year', NOW(), 1, 2, NULL, 'Home Insurance Policy', 'Annual homeowners insurance - State Farm', 'insurance', 'https://example.com/docs/insurance_2024.pdf', 'home_insurance_2024.pdf', 890000, 'application/pdf', '2024-01-01', '2025-01-01', 1450.00, 'State Farm', NULL, NULL, true),
|
||||
(6, NOW() - INTERVAL '6 months', NOW(), 1, 2, NULL, 'Refrigerator User Manual', 'LG French Door Refrigerator manual', 'manual', 'https://example.com/docs/lg_manual.pdf', 'lg_fridge_manual.pdf', 4500000, 'application/pdf', NULL, NULL, NULL, 'LG Electronics', NULL, 'LRMVS3006S', true),
|
||||
(7, NOW() - INTERVAL '2 months', NOW(), 1, 2, 7, 'HVAC Filter Receipt', 'Receipt for MERV 13 filters', 'receipt', 'https://example.com/docs/filter_receipt.pdf', 'hvac_filters_receipt.pdf', 45000, 'application/pdf', '2024-10-15', NULL, 55.00, 'Amazon', NULL, NULL, true),
|
||||
(8, NOW() - INTERVAL '3 years', NOW(), 1, 2, NULL, 'Roof Inspection Report', 'Annual roof inspection certificate', 'general', 'https://example.com/docs/roof_inspection.pdf', 'roof_inspection_2024.pdf', 320000, 'application/pdf', '2024-04-20', NULL, 250.00, 'Peak Roofing', NULL, NULL, true),
|
||||
|
||||
-- Notification Preferences
|
||||
-- ===== RESIDENCE 2 - Beach house documents =====
|
||||
(9, NOW() - INTERVAL '4 months', NOW(), 2, 2, NULL, 'Hurricane Shutters Warranty', '10-year warranty on accordion shutters', 'warranty', 'https://example.com/docs/shutters_warranty.pdf', 'hurricane_shutters.pdf', 278000, 'application/pdf', '2023-05-01', '2033-05-01', 8500.00, 'Storm Ready Inc', 'STORM-2023-456', 'ACC-200', true),
|
||||
(10, NOW() - INTERVAL '3 months', NOW(), 2, 2, NULL, 'Pool Equipment Warranty', '3-year warranty on pool pump and filter', 'warranty', 'https://example.com/docs/pool_warranty.pdf', 'pool_equipment_warranty.pdf', 167000, 'application/pdf', '2024-02-15', '2027-02-15', 2200.00, 'Pool Supply World', 'PSW-PUMP-78123', 'Pentair 342001', true),
|
||||
(11, NOW() - INTERVAL '6 months', NOW(), 2, 2, 23, 'Security Camera Receipt', 'Arlo Pro 4 cameras purchase receipt', 'receipt', 'https://example.com/docs/camera_receipt.pdf', 'arlo_cameras_receipt.pdf', 89000, 'application/pdf', '2024-07-10', NULL, 950.00, 'Amazon', NULL, 'VMC4050P', true),
|
||||
(12, NOW() - INTERVAL '1 year', NOW(), 2, 2, NULL, 'Flood Insurance Policy', 'FEMA flood insurance for coastal property', 'insurance', 'https://example.com/docs/flood_insurance.pdf', 'flood_insurance_2024.pdf', 456000, 'application/pdf', '2024-06-01', '2025-06-01', 2800.00, 'FEMA NFIP', NULL, NULL, true),
|
||||
|
||||
-- ===== RESIDENCE 3 - Investment duplex =====
|
||||
(13, NOW() - INTERVAL '5 months', NOW(), 3, 2, NULL, 'Rental Property Insurance', 'Landlord insurance policy', 'insurance', 'https://example.com/docs/rental_insurance.pdf', 'landlord_insurance.pdf', 567000, 'application/pdf', '2024-03-01', '2025-03-01', 1800.00, 'Allstate', NULL, NULL, true),
|
||||
(14, NOW() - INTERVAL '4 months', NOW(), 3, 2, NULL, 'Unit A Lease Agreement', 'Current tenant lease - Unit A', 'contract', 'https://example.com/docs/lease_a.pdf', 'unit_a_lease.pdf', 234000, 'application/pdf', '2024-04-01', '2025-03-31', NULL, NULL, NULL, NULL, true),
|
||||
(15, NOW() - INTERVAL '3 months', NOW(), 3, 2, NULL, 'Unit B Lease Agreement', 'Current tenant lease - Unit B', 'contract', 'https://example.com/docs/lease_b.pdf', 'unit_b_lease.pdf', 234000, 'application/pdf', '2024-06-01', '2025-05-31', NULL, NULL, NULL, NULL, true),
|
||||
(16, NOW() - INTERVAL '6 months', NOW(), 3, 2, 26, 'Fire Inspection Certificate', 'Annual fire safety compliance', 'general', 'https://example.com/docs/fire_cert.pdf', 'fire_inspection_2024.pdf', 123000, 'application/pdf', '2024-09-15', '2025-09-15', 150.00, 'City Fire Department', NULL, NULL, true),
|
||||
|
||||
-- ===== RESIDENCE 4 - Jane's loft =====
|
||||
(17, NOW() - INTERVAL '5 months', NOW(), 4, 3, NULL, 'Condo HOA Agreement', 'HOA rules and regulations', 'contract', 'https://example.com/docs/hoa_agreement.pdf', 'hoa_agreement.pdf', 890000, 'application/pdf', '2024-01-15', NULL, NULL, 'Downtown Towers HOA', NULL, NULL, true),
|
||||
(18, NOW() - INTERVAL '4 months', NOW(), 4, 3, NULL, 'Nest Thermostat Warranty', '2-year Google warranty', 'warranty', 'https://example.com/docs/nest_warranty.pdf', 'nest_warranty.pdf', 145000, 'application/pdf', '2024-08-01', '2026-08-01', 275.00, 'Google Store', 'NEST-2024-99887', 'T3007ES', true),
|
||||
(19, NOW() - INTERVAL '3 months', NOW(), 4, 3, NULL, 'Renters Insurance', 'Personal property coverage', 'insurance', 'https://example.com/docs/renters.pdf', 'renters_insurance.pdf', 234000, 'application/pdf', '2024-07-01', '2025-07-01', 240.00, 'Lemonade', NULL, NULL, true),
|
||||
(20, NOW() - INTERVAL '2 months', NOW(), 4, 3, 29, 'Garbage Disposal Manual', 'InSinkErator installation guide', 'manual', 'https://example.com/docs/disposal_manual.pdf', 'disposal_manual.pdf', 2300000, 'application/pdf', NULL, NULL, NULL, 'InSinkErator', NULL, 'Evolution Excel', true),
|
||||
|
||||
-- ===== RESIDENCE 5 - Bob's condo =====
|
||||
(21, NOW() - INTERVAL '4 months', NOW(), 5, 4, NULL, 'Fireplace Warranty', 'Gas fireplace 5-year warranty', 'warranty', 'https://example.com/docs/fireplace.pdf', 'fireplace_warranty.pdf', 189000, 'application/pdf', '2022-11-10', '2027-11-10', 3500.00, 'Heat & Glo', 'HG-2022-45678', 'SL-750TRS-IPI', true),
|
||||
(22, NOW() - INTERVAL '3 months', NOW(), 5, 4, NULL, 'Ski Condo HOA Docs', 'Mountain Village HOA documents', 'contract', 'https://example.com/docs/ski_hoa.pdf', 'mountain_village_hoa.pdf', 1200000, 'application/pdf', '2024-01-01', NULL, NULL, 'Mountain Village HOA', NULL, NULL, true),
|
||||
(23, NOW() - INTERVAL '5 months', NOW(), 5, 4, 40, 'Deck Stain Receipt', 'Thompson''s WaterSeal purchase', 'receipt', 'https://example.com/docs/stain_receipt.pdf', 'deck_stain_receipt.pdf', 67000, 'application/pdf', '2024-08-20', NULL, 125.00, 'Home Depot', NULL, NULL, true),
|
||||
|
||||
-- ===== RESIDENCE 8 - Alice's craftsman =====
|
||||
(24, NOW() - INTERVAL '3 months', NOW(), 8, 5, NULL, 'Historic Home Certificate', 'National Register listing certificate', 'general', 'https://example.com/docs/historic_cert.pdf', 'historic_certificate.pdf', 456000, 'application/pdf', '1985-06-15', NULL, NULL, 'National Park Service', NULL, NULL, true),
|
||||
(25, NOW() - INTERVAL '2 months', NOW(), 8, 5, 43, 'Window Restoration Invoice', 'Historic window restoration work', 'receipt', 'https://example.com/docs/window_invoice.pdf', 'window_restoration.pdf', 123000, 'application/pdf', '2024-10-01', NULL, 1650.00, 'Preservation Builders', NULL, NULL, true),
|
||||
(26, NOW() - INTERVAL '4 months', NOW(), 8, 5, NULL, 'Vintage Stove Manual', '1920s O''Keefe & Merritt restoration guide', 'manual', 'https://example.com/docs/vintage_stove.pdf', 'okeefe_merritt_manual.pdf', 3400000, 'application/pdf', NULL, NULL, NULL, 'Antique Stove Hospital', NULL, 'Model 600', true),
|
||||
|
||||
-- ===== RESIDENCE 11 - Edward's fixer upper =====
|
||||
(27, NOW() - INTERVAL '2 weeks', NOW(), 11, 8, NULL, 'Renovation Permit', 'City building permit for renovation', 'general', 'https://example.com/docs/permit.pdf', 'building_permit.pdf', 234000, 'application/pdf', '2024-11-01', '2025-11-01', 850.00, 'City of Seattle', 'PERMIT-2024-78901', NULL, true),
|
||||
(28, NOW() - INTERVAL '1 week', NOW(), 11, 8, 49, 'Cabinet Quote', 'Custom kitchen cabinet estimate', 'general', 'https://example.com/docs/cabinet_quote.pdf', 'cabinet_quote.pdf', 178000, 'application/pdf', '2024-11-20', NULL, 5000.00, 'Woodworks Plus', NULL, NULL, true),
|
||||
(29, NOW() - INTERVAL '5 days', NOW(), 11, 8, NULL, 'Contractor Agreement', 'Renovation contract with Demo Dave', 'contract', 'https://example.com/docs/contractor.pdf', 'contractor_agreement.pdf', 345000, 'application/pdf', '2024-11-15', '2025-03-15', 15000.00, 'Demolition & Renovation', NULL, NULL, true),
|
||||
|
||||
-- ===== RESIDENCE 12 - Fiona's studio =====
|
||||
(30, NOW() - INTERVAL '1 week', NOW(), 12, 9, 53, 'Smart Lights Receipt', 'Philips Hue starter kit receipt', 'receipt', 'https://example.com/docs/hue_receipt.pdf', 'philips_hue_receipt.pdf', 89000, 'application/pdf', '2024-11-18', NULL, 420.00, 'Best Buy', NULL, 'Hue White and Color Ambiance', true),
|
||||
(31, NOW() - INTERVAL '5 days', NOW(), 12, 9, NULL, 'Studio Lease', 'Apartment lease agreement', 'contract', 'https://example.com/docs/studio_lease.pdf', 'studio_lease.pdf', 456000, 'application/pdf', '2024-11-15', '2025-11-14', NULL, 'Arts District Properties', NULL, NULL, true),
|
||||
|
||||
-- ===== RESIDENCE 13 - George's townhome =====
|
||||
(32, NOW() - INTERVAL '2 months', NOW(), 13, 12, NULL, 'Pool Heater Warranty', '3-year warranty on Jandy pool heater', 'warranty', 'https://example.com/docs/pool_heater.pdf', 'pool_heater_warranty.pdf', 198000, 'application/pdf', '2024-03-01', '2027-03-01', 1800.00, 'Pool Supply Arizona', 'JANDY-2024-34567', 'JXi400N', true),
|
||||
(33, NOW() - INTERVAL '1 month', NOW(), 13, 12, NULL, 'HOA CC&Rs', 'Townhome community rules', 'contract', 'https://example.com/docs/townhome_ccr.pdf', 'ccr_documents.pdf', 2100000, 'application/pdf', NULL, NULL, NULL, 'Desert Palms HOA', NULL, NULL, true),
|
||||
|
||||
-- Expired warranty
|
||||
(34, NOW() - INTERVAL '3 years', NOW(), 1, 2, NULL, 'Old Washer Warranty', 'Expired washing machine warranty', 'warranty', 'https://example.com/docs/old_washer.pdf', 'washer_warranty_expired.pdf', 145000, 'application/pdf', '2020-05-15', '2023-05-15', 800.00, 'Sears', 'WH-2020-11111', 'WTW5000DW', false)
|
||||
ON CONFLICT (id) DO UPDATE SET title = EXCLUDED.title, updated_at = NOW();
|
||||
|
||||
-- =====================================================
|
||||
-- DOCUMENT IMAGES
|
||||
-- =====================================================
|
||||
INSERT INTO task_documentimage (id, created_at, updated_at, document_id, image_url, caption)
|
||||
VALUES
|
||||
-- HVAC System (doc 1)
|
||||
(1, NOW(), NOW(), 1, 'https://picsum.photos/seed/hvac1/800/600', 'HVAC unit exterior'),
|
||||
(2, NOW(), NOW(), 1, 'https://picsum.photos/seed/hvac2/800/600', 'Serial number plate'),
|
||||
(3, NOW(), NOW(), 1, 'https://picsum.photos/seed/hvac3/800/600', 'Installation complete'),
|
||||
|
||||
-- Water Heater (doc 2)
|
||||
(4, NOW(), NOW(), 2, 'https://picsum.photos/seed/waterheater1/800/600', 'Water heater installed'),
|
||||
(5, NOW(), NOW(), 2, 'https://picsum.photos/seed/waterheater2/800/600', 'Model and serial info'),
|
||||
|
||||
-- Refrigerator (doc 3)
|
||||
(6, NOW(), NOW(), 3, 'https://picsum.photos/seed/fridge1/800/600', 'LG French Door refrigerator'),
|
||||
(7, NOW(), NOW(), 3, 'https://picsum.photos/seed/fridge2/800/600', 'Interior view'),
|
||||
|
||||
-- Hurricane Shutters (doc 9)
|
||||
(8, NOW(), NOW(), 9, 'https://picsum.photos/seed/shutter1/800/600', 'Accordion shutters closed'),
|
||||
(9, NOW(), NOW(), 9, 'https://picsum.photos/seed/shutter2/800/600', 'Shutters open position'),
|
||||
(10, NOW(), NOW(), 9, 'https://picsum.photos/seed/shutter3/800/600', 'Window protection detail'),
|
||||
|
||||
-- Pool Equipment (doc 10)
|
||||
(11, NOW(), NOW(), 10, 'https://picsum.photos/seed/pool1/800/600', 'Pool pump installation'),
|
||||
(12, NOW(), NOW(), 10, 'https://picsum.photos/seed/pool2/800/600', 'Filter system'),
|
||||
|
||||
-- Security Cameras (doc 11)
|
||||
(13, NOW(), NOW(), 11, 'https://picsum.photos/seed/arlo1/800/600', 'Arlo camera box'),
|
||||
(14, NOW(), NOW(), 11, 'https://picsum.photos/seed/arlo2/800/600', 'Camera mounted on wall'),
|
||||
|
||||
-- Historic Certificate (doc 24)
|
||||
(15, NOW(), NOW(), 24, 'https://picsum.photos/seed/historic1/800/600', 'Historic plaque on house'),
|
||||
(16, NOW(), NOW(), 24, 'https://picsum.photos/seed/historic2/800/600', 'Original craftsman details'),
|
||||
|
||||
-- Window Restoration (doc 25)
|
||||
(17, NOW(), NOW(), 25, 'https://picsum.photos/seed/restore1/800/600', 'Before restoration'),
|
||||
(18, NOW(), NOW(), 25, 'https://picsum.photos/seed/restore2/800/600', 'After restoration'),
|
||||
(19, NOW(), NOW(), 25, 'https://picsum.photos/seed/restore3/800/600', 'Detail work complete'),
|
||||
|
||||
-- Smart Lights (doc 30)
|
||||
(20, NOW(), NOW(), 30, 'https://picsum.photos/seed/huelight1/800/600', 'Hue starter kit'),
|
||||
(21, NOW(), NOW(), 30, 'https://picsum.photos/seed/huelight2/800/600', 'Bulbs installed'),
|
||||
|
||||
-- Pool Heater (doc 32)
|
||||
(22, NOW(), NOW(), 32, 'https://picsum.photos/seed/poolheat1/800/600', 'Jandy pool heater'),
|
||||
(23, NOW(), NOW(), 32, 'https://picsum.photos/seed/poolheat2/800/600', 'Control panel'),
|
||||
|
||||
-- Renovation Permit (doc 27)
|
||||
(24, NOW(), NOW(), 27, 'https://picsum.photos/seed/permit1/800/600', 'Permit posted on site')
|
||||
ON CONFLICT (id) DO UPDATE SET image_url = EXCLUDED.image_url, caption = EXCLUDED.caption;
|
||||
|
||||
-- =====================================================
|
||||
-- NOTIFICATIONS (various types and states)
|
||||
-- Types: task_due_soon, task_overdue, task_completed, task_assigned, residence_shared, warranty_expiring
|
||||
-- =====================================================
|
||||
INSERT INTO notifications_notification (id, created_at, updated_at, user_id, notification_type, title, body, task_id, sent, sent_at, read, read_at)
|
||||
VALUES
|
||||
-- John's notifications (user 2)
|
||||
(1, NOW() - INTERVAL '1 hour', NOW(), 2, 'task_due_soon', 'Task Due Soon', 'Fix leaky kitchen faucet is due in 7 days', 1, true, NOW() - INTERVAL '1 hour', false, NULL),
|
||||
(2, NOW() - INTERVAL '3 hours', NOW(), 2, 'task_due_soon', 'Task Due Soon', 'Install ceiling fan is due in 14 days', 4, true, NOW() - INTERVAL '3 hours', true, NOW() - INTERVAL '2 hours'),
|
||||
(3, NOW() - INTERVAL '1 day', NOW(), 2, 'task_completed', 'Task Completed', 'Mow lawn has been marked as completed by Jane', 9, true, NOW() - INTERVAL '1 day', true, NOW() - INTERVAL '20 hours'),
|
||||
(4, NOW() - INTERVAL '2 days', NOW(), 2, 'warranty_expiring', 'Warranty Expiring Soon', 'Your Dishwasher Warranty expires in 60 days', NULL, true, NOW() - INTERVAL '2 days', false, NULL),
|
||||
(5, NOW() - INTERVAL '3 days', NOW(), 2, 'task_overdue', 'Task Overdue', 'Check pool chemicals is overdue by 3 days', 16, true, NOW() - INTERVAL '3 days', true, NOW() - INTERVAL '3 days'),
|
||||
|
||||
-- Jane's notifications (user 3)
|
||||
(6, NOW() - INTERVAL '2 hours', NOW(), 3, 'task_assigned', 'New Task Assigned', 'You have been assigned to: Fix garbage disposal', 29, true, NOW() - INTERVAL '2 hours', false, NULL),
|
||||
(7, NOW() - INTERVAL '1 day', NOW(), 3, 'residence_shared', 'Residence Access Granted', 'John Doe has shared Main Family Home with you', NULL, true, NOW() - INTERVAL '1 day', true, NOW() - INTERVAL '22 hours'),
|
||||
(8, NOW() - INTERVAL '4 days', NOW(), 3, 'task_completed', 'Task Completed', 'Unclog bathroom drain has been completed', 2, true, NOW() - INTERVAL '4 days', true, NOW() - INTERVAL '4 days'),
|
||||
|
||||
-- Bob's notifications (user 4)
|
||||
(9, NOW() - INTERVAL '30 minutes', NOW(), 4, 'task_due_soon', 'Task Due Soon', 'Replace entry door weatherstrip is due in 10 days', 39, true, NOW() - INTERVAL '30 minutes', false, NULL),
|
||||
(10, NOW() - INTERVAL '6 hours', NOW(), 4, 'task_completed', 'Task Completed', 'Winterize pipes completed successfully', 36, true, NOW() - INTERVAL '6 hours', true, NOW() - INTERVAL '5 hours'),
|
||||
(11, NOW() - INTERVAL '2 days', NOW(), 4, 'task_due_soon', 'Task Due Soon', 'Tune ski equipment storage is due soon', 38, true, NOW() - INTERVAL '2 days', false, NULL),
|
||||
|
||||
-- Alice's notifications (user 5)
|
||||
(12, NOW() - INTERVAL '4 hours', NOW(), 5, 'task_assigned', 'New Task Assigned', 'You have been assigned to: Refinish hardwood floors', 42, true, NOW() - INTERVAL '4 hours', true, NOW() - INTERVAL '3 hours'),
|
||||
(13, NOW() - INTERVAL '1 day', NOW(), 5, 'warranty_expiring', 'Warranty Alert', 'Check your document warranties for upcoming expirations', NULL, true, NOW() - INTERVAL '1 day', false, NULL),
|
||||
|
||||
-- Edward's notifications (user 8)
|
||||
(14, NOW() - INTERVAL '2 hours', NOW(), 8, 'task_due_soon', 'Task Due Soon', 'Demo bathroom tile is due in 7 days', 48, true, NOW() - INTERVAL '2 hours', false, NULL),
|
||||
(15, NOW() - INTERVAL '5 hours', NOW(), 8, 'task_assigned', 'New Task Assigned', 'You have been assigned to: Run new electrical', 50, true, NOW() - INTERVAL '5 hours', true, NOW() - INTERVAL '4 hours'),
|
||||
|
||||
-- Fiona's notifications (user 9)
|
||||
(16, NOW() - INTERVAL '1 hour', NOW(), 9, 'task_completed', 'Task Completed', 'Setup smart lights has been completed', 53, true, NOW() - INTERVAL '1 hour', true, NOW() - INTERVAL '45 minutes'),
|
||||
(17, NOW() - INTERVAL '3 days', NOW(), 9, 'residence_shared', 'Shared Access', 'Alice has shared Craftsman Bungalow with you', NULL, true, NOW() - INTERVAL '3 days', true, NOW() - INTERVAL '3 days'),
|
||||
|
||||
-- George's notifications (user 12)
|
||||
(18, NOW() - INTERVAL '5 hours', NOW(), 12, 'task_due_soon', 'Task Due Soon', 'Trim desert landscaping is due in 5 days', 59, true, NOW() - INTERVAL '5 hours', false, NULL),
|
||||
(19, NOW() - INTERVAL '1 day', NOW(), 12, 'task_completed', 'Task Completed', 'Service pool equipment completed', 57, true, NOW() - INTERVAL '1 day', true, NOW() - INTERVAL '20 hours'),
|
||||
|
||||
-- Pending notifications (not yet sent)
|
||||
(20, NOW() - INTERVAL '10 minutes', NOW(), 2, 'task_overdue', 'Task Overdue', 'Fertilize lawn is now overdue', 12, false, NULL, false, NULL),
|
||||
(21, NOW() - INTERVAL '5 minutes', NOW(), 5, 'task_due_soon', 'Task Due Soon', 'Fix porch swing is due in 21 days', 46, false, NULL, false, NULL)
|
||||
ON CONFLICT (id) DO UPDATE SET title = EXCLUDED.title, updated_at = NOW();
|
||||
|
||||
-- =====================================================
|
||||
-- NOTIFICATION PREFERENCES
|
||||
-- =====================================================
|
||||
INSERT INTO notifications_notificationpreference (id, created_at, updated_at, user_id, task_due_soon, task_overdue, task_completed, task_assigned, residence_shared, warranty_expiring)
|
||||
VALUES
|
||||
(1, NOW(), NOW(), 1, true, true, true, true, true, true),
|
||||
(2, NOW(), NOW(), 2, true, true, true, true, true, true),
|
||||
(3, NOW(), NOW(), 3, true, true, false, true, true, false),
|
||||
(4, NOW(), NOW(), 4, false, false, false, false, false, false)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
task_due_soon = EXCLUDED.task_due_soon,
|
||||
task_overdue = EXCLUDED.task_overdue,
|
||||
updated_at = NOW();
|
||||
(4, NOW(), NOW(), 4, true, true, true, true, true, true),
|
||||
(5, NOW(), NOW(), 5, true, true, true, true, true, true),
|
||||
(6, NOW(), NOW(), 6, false, false, false, false, false, false),
|
||||
(7, NOW(), NOW(), 7, true, false, false, true, true, false),
|
||||
(8, NOW(), NOW(), 8, true, true, true, true, false, true),
|
||||
(9, NOW(), NOW(), 9, true, true, true, true, true, true),
|
||||
(10, NOW(), NOW(), 10, false, false, false, false, false, false),
|
||||
(11, NOW(), NOW(), 11, true, true, true, true, true, true),
|
||||
(12, NOW(), NOW(), 12, true, true, true, false, true, true)
|
||||
ON CONFLICT (id) DO UPDATE SET task_due_soon = EXCLUDED.task_due_soon, updated_at = NOW();
|
||||
|
||||
-- Reset sequences
|
||||
-- =====================================================
|
||||
-- PUSH DEVICES (APNs and GCM)
|
||||
-- =====================================================
|
||||
INSERT INTO push_notifications_apnsdevice (id, user_id, name, device_id, registration_id, active, date_created)
|
||||
VALUES
|
||||
(1, 1, 'Admin iPhone 15 Pro', 'admin-device-001', 'apns-token-admin-001-xxxx', true, NOW() - INTERVAL '6 months'),
|
||||
(2, 2, 'John iPhone 14', 'john-device-001', 'apns-token-john-001-xxxx', true, NOW() - INTERVAL '5 months'),
|
||||
(3, 2, 'John iPad Pro', 'john-device-002', 'apns-token-john-002-xxxx', true, NOW() - INTERVAL '4 months'),
|
||||
(4, 4, 'Bob iPhone 13', 'bob-device-001', 'apns-token-bob-001-xxxx', true, NOW() - INTERVAL '3 months'),
|
||||
(5, 5, 'Alice iPhone 15', 'alice-device-001', 'apns-token-alice-001-xxxx', true, NOW() - INTERVAL '2 months'),
|
||||
(6, 9, 'Fiona iPhone 14 Pro', 'fiona-device-001', 'apns-token-fiona-001-xxxx', true, NOW() - INTERVAL '1 month'),
|
||||
(7, 10, 'Inactive iPhone', 'inactive-device-001', 'apns-token-inactive-xxxx', false, NOW() - INTERVAL '1 year')
|
||||
ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name, active = EXCLUDED.active;
|
||||
|
||||
INSERT INTO push_notifications_gcmdevice (id, user_id, name, device_id, registration_id, active, cloud_message_type, date_created)
|
||||
VALUES
|
||||
(1, 3, 'Jane Pixel 8', 'jane-device-001', 'gcm-token-jane-001-xxxx', true, 'FCM', NOW() - INTERVAL '5 months'),
|
||||
(2, 6, 'Charlie Galaxy S24', 'charlie-device-001', 'gcm-token-charlie-001-xxxx', true, 'FCM', NOW() - INTERVAL '4 months'),
|
||||
(3, 8, 'Edward Pixel 7', 'edward-device-001', 'gcm-token-edward-001-xxxx', true, 'FCM', NOW() - INTERVAL '3 months'),
|
||||
(4, 12, 'George Galaxy S23', 'george-device-001', 'gcm-token-george-001-xxxx', true, 'FCM', NOW() - INTERVAL '2 months'),
|
||||
(5, 7, 'Diana old Android', 'diana-device-001', 'gcm-token-diana-001-xxxx', false, 'FCM', NOW() - INTERVAL '1 year')
|
||||
ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name, active = EXCLUDED.active;
|
||||
|
||||
-- =====================================================
|
||||
-- ADMIN USERS
|
||||
-- =====================================================
|
||||
INSERT INTO admin_users (id, created_at, updated_at, email, password, first_name, last_name, role, is_active, last_login)
|
||||
VALUES
|
||||
(1, NOW() - INTERVAL '1 year', NOW(), 'superadmin@mycrib.com', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'Super', 'Admin', 'super_admin', true, NOW() - INTERVAL '1 hour'),
|
||||
(2, NOW() - INTERVAL '6 months', NOW(), 'admin@mycrib.com', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'Regular', 'Admin', 'admin', true, NOW() - INTERVAL '2 hours'),
|
||||
(3, NOW() - INTERVAL '3 months', NOW(), 'support@mycrib.com', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'Support', 'Staff', 'admin', true, NOW() - INTERVAL '1 day'),
|
||||
(4, NOW() - INTERVAL '1 month', NOW(), 'inactive.admin@mycrib.com', '$2a$10$KB4rf2NNj0a80lwlwJhaFukE2/THJXbcGZMks7vR3zykyN4zkF6xi', 'Former', 'Admin', 'admin', false, NOW() - INTERVAL '2 months')
|
||||
ON CONFLICT (email) DO UPDATE SET role = EXCLUDED.role, is_active = EXCLUDED.is_active, updated_at = NOW();
|
||||
|
||||
-- =====================================================
|
||||
-- RESET SEQUENCES
|
||||
-- =====================================================
|
||||
SELECT setval('auth_user_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM auth_user), false);
|
||||
SELECT setval('user_userprofile_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM user_userprofile), false);
|
||||
SELECT setval('subscription_usersubscription_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM subscription_usersubscription), false);
|
||||
@@ -155,12 +607,36 @@ SELECT setval('residence_residence_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FRO
|
||||
SELECT setval('task_contractor_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_contractor), false);
|
||||
SELECT setval('task_task_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_task), false);
|
||||
SELECT setval('task_taskcompletion_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_taskcompletion), false);
|
||||
SELECT setval('task_taskcompletionimage_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_taskcompletionimage), false);
|
||||
SELECT setval('task_document_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_document), false);
|
||||
SELECT setval('task_documentimage_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM task_documentimage), false);
|
||||
SELECT setval('notifications_notification_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM notifications_notification), false);
|
||||
SELECT setval('notifications_notificationpreference_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM notifications_notificationpreference), false);
|
||||
SELECT setval('push_notifications_apnsdevice_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM push_notifications_apnsdevice), false);
|
||||
SELECT setval('push_notifications_gcmdevice_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM push_notifications_gcmdevice), false);
|
||||
SELECT setval('admin_users_id_seq', (SELECT COALESCE(MAX(id), 0) + 1 FROM admin_users), false);
|
||||
|
||||
-- =====================================================
|
||||
-- TEST DATA SUMMARY
|
||||
-- =====================================================
|
||||
-- Users: 12 (including admin, staff, inactive)
|
||||
-- User Profiles: 12
|
||||
-- Subscriptions: 12 (mix of free/pro, ios/android)
|
||||
-- Residences: 14 (all property types)
|
||||
-- Shared Residences: 5 sharing relationships
|
||||
-- Contractors: 20 (all specialties, various ratings)
|
||||
-- Tasks: 62 (all categories, priorities, statuses, frequencies)
|
||||
-- Task Completions: 26 (with ratings 4-5)
|
||||
-- Task Completion Images: 34
|
||||
-- Documents: 34 (all types: warranty, insurance, contract, manual, receipt, general)
|
||||
-- Document Images: 24
|
||||
-- Notifications: 21 (all types, sent/pending, read/unread)
|
||||
-- Notification Preferences: 12
|
||||
-- APNs Devices: 7 (iOS devices)
|
||||
-- GCM Devices: 5 (Android devices)
|
||||
-- Admin Users: 4
|
||||
|
||||
-- Test Login Credentials:
|
||||
-- Regular users: password123
|
||||
-- Admin panel: superadmin@mycrib.com / password123
|
||||
|
||||
-- Test Users (password: password123):
|
||||
-- - admin (admin@example.com) - Admin, Pro tier
|
||||
-- - john (john@example.com) - Pro tier, owns 2 residences
|
||||
-- - jane (jane@example.com) - Free tier, owns 1 residence, shared access to residence 1
|
||||
-- - bob (bob@example.com) - Free tier
|
||||
|
||||
Reference in New Issue
Block a user