Overview
The GalleryPhoto model stores metadata for photos captured by smart glasses. It tracks ownership, storage locations, and photo attributes while the actual image files are stored in S3.Schema Structure
Core Fields
Field Purposes
userId (string)
Links the photo to its owner. Used for:- Access control and permissions
- Gallery filtering by user
- Storage quota management
filename (string)
The S3 object key where the photo is stored. Typically follows pattern:photos/{userId}/{timestamp}-{random}.jpg- Ensures unique storage paths
- Enables efficient S3 organization
photoUrl (string)
Pre-signed S3 URL or CDN link for accessing the photo:- Time-limited access for security
- Direct browser/app access without API calls
- CDN distribution for performance
requestId (string)
Tracks the original photo request:- Links to app’s photo request
- Enables request/response correlation
- Used for debugging capture issues
appId (string)
Identifies which app triggered the photo:- Analytics on app photo usage
- Per-app photo galleries
- Permission verification
metadata (object)
Optional technical details about the photo:- originalFilename: User-friendly name
- size: File size in bytes for quota tracking
- mimeType: Usually “image/jpeg” or “image/png”
- width/height: Dimensions for UI rendering
- deviceInfo: Glasses model that captured it
Usage Patterns
Photo Capture Flow
- App requests photo via PhotoManager
- Glasses capture and upload to S3
- GalleryPhoto record created with metadata
- Photo URL returned to requesting app
Gallery Display
Photo Deletion
Indexes
- userId: Primary index for user queries
- uploadDate: For chronological sorting
- appId: For app-specific galleries
Data Lifecycle
- Creation: When photo uploaded from glasses
- Access: Via pre-signed URLs with expiration
- Deletion: User-initiated or quota management
- Archival: Old photos may move to glacier storage