Skip to content

📚docs: write docs/architecture/data-model.md #370

Description

@sotoJ24

Title: docs: write docs/architecture/data-model.md — PostgreSQL schema, entity relationships, and multi-tenant Hasura data layer

Issue Summary

docs/architecture/data-model.md must document the full PostgreSQL schema for both tenants (safetrust and hotel_industry), the entity relationships, and how Hasura exposes them as GraphQL. Content must be derived from reading the actual migration files — not invented or copied from OfferHub.

Type of Issue

  • Documentation

Branch strategy

✅ docs/issue-N-data-model → consolidation-pattern

Expected Content

The contributor must read these files before writing:

ls infra/backend/migrations/safetrust/
ls infra/backend/migrations/hotel_industry/
cat infra/backend/migrations/safetrust/1731908676359_create_users/up.sql
cat infra/backend/migrations/safetrust/1786000000000_create_user_roles/up.sql
cat infra/backend/migrations/safetrust/1771690624593_create_escrows_table/up.sql
cat infra/backend/migrations/hotel_industry/1745664202191_create_reservations/up.sql

The document must cover:

1. safetrust schema tablesusers, user_wallets, user_roles, roles, apartments, escrows, trustless_work_escrows, escrow_milestones, bid_requests, bid_status_histories

2. hotel_industry schema tableshotels, rooms, room_types, reservations, escrow_transactions, escrow_transaction_users, room_images, pricing_rules

3. Entity relationship diagram — ASCII or Mermaid showing FK relationships

4. Role systemroles table (guest=1, host=2, admin=3), user_roles join table, how resolveHighestRole works in middleware

5. Wallet modeluser_wallets with provider column (freighter vs pollar), chain_type, is_primary

6. Escrow state in DB — how trustless_work_escrows.status mirrors on-chain state

Files to create

File Content
docs/architecture/data-model.md Full schema doc ~200 lines

Make sure to follow the Git Guidelines for Atomic Commits and read Contributing Guide


Activity

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions