feat: add MVP demo seed files for users, apartments, and bid_requests#82
feat: add MVP demo seed files for users, apartments, and bid_requests#82Sundayabel222 wants to merge 1 commit intosafetrustcr:mainfrom
Conversation
📝 WalkthroughWalkthroughAdds three SQL seed files to the Hasura database that populate demo data for MVP: two user records with Firebase UID-style IDs, three apartment listings with generated UUIDs, and one bid request linking a tenant to an apartment with pending status. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@Sundayabel222 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
infra/hasura/seeds/safetrust/01_users_seed.sql (1)
3-4: Use reserved demo emails instead of realistic Gmail addresses.Line 3 and Line 4 use personal-style external emails in a committed seed file. Prefer
example.com-style addresses to reduce privacy/compliance risk and avoid accidental real-world targeting.Proposed tweak
- ('demo-tenant-uid-001', 'john_s@gmail.com', NOW()), - ('demo-owner-uid-002', 'albertoCasas100@gmail.com', NOW()) + ('demo-tenant-uid-001', 'demo.tenant@example.com', NOW()), + ('demo-owner-uid-002', 'demo.owner@example.com', NOW())🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@infra/hasura/seeds/safetrust/01_users_seed.sql` around lines 3 - 4, Replace the realistic Gmail addresses in the seed tuples ('demo-tenant-uid-001', 'john_s@gmail.com', NOW()) and ('demo-owner-uid-002', 'albertoCasas100@gmail.com', NOW()) with reserved example.com demo addresses (e.g., john_s@example.com and albertoCasas100@example.com or similar) so the seed file contains non-real external emails; update only the email values in those tuples in 01_users_seed.sql.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@infra/hasura/seeds/safetrust/02_apartments_seed.sql`:
- Around line 8-9: The seed currently uses uuid_generate_v4() for IDs (e.g. the
row with 'La sabana sur'), which produces new random IDs each run and causes
duplicate logical apartments; change each uuid_generate_v4() to a stable,
deterministic UUID literal for that apartment (pick fixed UUIDs for the three
apartments) and modify the INSERT to include an explicit conflict target (e.g.
ON CONFLICT (name) DO NOTHING or ON CONFLICT (unique_apartment_key) DO UPDATE
...) so rerunning the seed is idempotent; update the INSERT statement(s) that
reference uuid_generate_v4() and the apartment names to use the fixed UUIDs and
add the ON CONFLICT clause.
In `@infra/hasura/seeds/safetrust/03_bid_requests_seed.sql`:
- Around line 7-8: The seed uses uuid_generate_v4() and a non-deterministic
apartment lookup (SELECT id FROM apartments WHERE name = 'La sabana sur' LIMIT
1), which makes re-running seeds produce different/multiple bid_requests;
replace the generated UUID with a stable, hard-coded UUID value for the bid
request(s) and change the apartment lookup to a deterministic unique selector
(e.g., use the apartment's unique slug or external_id column or add additional
identifying predicates instead of name+LIMIT 1) so the INSERT consistently
references the same apartment row across runs; update both occurrences (the
uuid_generate_v4() usage and the SELECT id FROM apartments WHERE name = 'La
sabana sur' LIMIT 1) accordingly.
---
Nitpick comments:
In `@infra/hasura/seeds/safetrust/01_users_seed.sql`:
- Around line 3-4: Replace the realistic Gmail addresses in the seed tuples
('demo-tenant-uid-001', 'john_s@gmail.com', NOW()) and ('demo-owner-uid-002',
'albertoCasas100@gmail.com', NOW()) with reserved example.com demo addresses
(e.g., john_s@example.com and albertoCasas100@example.com or similar) so the
seed file contains non-real external emails; update only the email values in
those tuples in 01_users_seed.sql.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 064c3451-b8f7-4f9b-b7db-431fd98b0f80
📒 Files selected for processing (3)
infra/hasura/seeds/safetrust/01_users_seed.sqlinfra/hasura/seeds/safetrust/02_apartments_seed.sqlinfra/hasura/seeds/safetrust/03_bid_requests_seed.sql
Closes #81
Summary
Adds the three seed SQL files required by the MVP demo flow.
Files added
Acceptance criteria
infra/hasura/seeds/safetrust/01_,02_,03_to enforce correct run orderSELECT * FROM users;returns 2 rows after seedingSELECT * FROM apartments;returns 3 rows after seedingSELECT * FROM bid_requests;returns 1 row withcurrent_status = 'PENDING'ON CONFLICT DO NOTHING)Dependencies
Depends on issues #74, #77 — tables must exist before seeds run.
Summary by CodeRabbit