Skip to content

feat: add MVP demo seed files for users, apartments, and bid_requests#82

Open
Sundayabel222 wants to merge 1 commit intosafetrustcr:mainfrom
Sundayabel222:feat/add-hasura-seed-files
Open

feat: add MVP demo seed files for users, apartments, and bid_requests#82
Sundayabel222 wants to merge 1 commit intosafetrustcr:mainfrom
Sundayabel222:feat/add-hasura-seed-files

Conversation

@Sundayabel222
Copy link
Copy Markdown

@Sundayabel222 Sundayabel222 commented Mar 28, 2026

Closes #81


Summary

Adds the three seed SQL files required by the MVP demo flow.

Files added

infra/hasura/seeds/safetrust/
├── 01_users_seed.sql       — 2 demo users (tenant + owner)
├── 02_apartments_seed.sql  — 3 apartment listings
└── 03_bid_requests_seed.sql — 1 PENDING bid request

Acceptance criteria

  • All three seed files exist in infra/hasura/seeds/safetrust/
  • Files prefixed 01_, 02_, 03_ to enforce correct run order
  • SELECT * FROM users; returns 2 rows after seeding
  • SELECT * FROM apartments; returns 3 rows after seeding
  • SELECT * FROM bid_requests; returns 1 row with current_status = 'PENDING'
  • Running seeds twice does not duplicate rows (ON CONFLICT DO NOTHING)

Dependencies

Depends on issues #74, #77 — tables must exist before seeds run.

Summary by CodeRabbit

  • Chores
    • Added demo user accounts for testing.
    • Added sample apartment listings with complete property details (pricing, amenities, location).
    • Added a sample bid request to demonstrate the rental inquiry workflow.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Database seed files
infra/hasura/seeds/safetrust/01_users_seed.sql, infra/hasura/seeds/safetrust/02_apartments_seed.sql, infra/hasura/seeds/safetrust/03_bid_requests_seed.sql
Adds demo seed data for three related tables: users (2 records), apartments (3 records), and bid_requests (1 record). Each file uses ON CONFLICT DO NOTHING to prevent duplicate insert errors. Apartments use uuid_generate_v4() for IDs; users use Firebase UID format. Bid request links a tenant to an apartment with pending status and 30-day move-in window.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Poem

🐰 Fresh seeds for the garden grow,
Demo data in a row,
Users, homes, and bids take flight,
Our MVP shines so bright!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding three MVP demo seed files for users, apartments, and bid_requests tables.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

@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! 🚀

Learn more about application limits

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between decc85f and c8d771f.

📒 Files selected for processing (3)
  • infra/hasura/seeds/safetrust/01_users_seed.sql
  • infra/hasura/seeds/safetrust/02_apartments_seed.sql
  • infra/hasura/seeds/safetrust/03_bid_requests_seed.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🏗️📦feat: add MVP seeds for users, apartments, and bid_requests

1 participant