Research: Checklist Data Layer
Date: 2026-03-22 Status: Complete
Decision 1: preferred_types Storage Strategy
- Decision: Use
ARRAY(String)forpreferred_typesinUserScanandJSONBfor generalfilters. - Rationale:
preferred_typesis a simple list of campsite types (e.g., ["TENT", "RV"]). PostgreSQLARRAYallows for efficient native filtering using the&&or@>operators. Other filters (likemin_stay_length) will be separate columns for direct access, but any highly dynamic filters will useJSONB. - Alternatives Considered:
JSONBfor everything was considered, but separate columns for core filters provide better indexing and type safety.
Decision 2: UniqueTarget Hashing Strategy
- Decision: Hash =
SHA256(provider_id + campground_id + start_date.isoformat() + end_date.isoformat()). - Rationale: This combination uniquely identifies a "pollable unit". Using ISO format strings for dates ensures consistency regardless of input format.
- Alternatives Considered: Composite primary key on all four fields. SHA256 is preferred because it's a single, fixed-length string that's easy to index and reference.
Decision 3: User Authentication Integration
- Decision: Implement the
Usermodel withauth0_idas an optional/nullable field for now, with ausernameoremailas the primary identifier for local development. - Rationale: Phase 1 (current focus) includes "Local-Only" auth mode. By making
auth0_idnullable, we can support both modes without breaking the schema later. - Alternatives Considered: Requiring Auth0 IDs from the start. This was rejected to ensure developers can run the stack offline/locally without an Auth0 tenant.
Decision 4: Result Caching (ScanResult)
- Decision:
ScanResultwill storefound_atas a timestamp andavailable_datesas aJSONBarray of ISO date strings. - Rationale: Availability data from providers often comes as a list of dates.
JSONBallows us to store these flexibly while maintaining the ability to query them if needed. - Alternatives Considered: Separate rows for every available date. Rejected due to row-explosion concerns (one poll could return 30+ dates for 100+ sites).