Appearance
MongoDB Data Model
VideoSphere stores application data in MongoDB via Mongoose models in lib/models.
Collections
user_profilesdraftsupload_jobsplatform_uploadsconnected_accountsupload_usageprocessed_webhook_events
ID and Timestamp Conventions
- Document IDs are strings (
_id: String) to match existing app-level IDs. - Mongoose
timestamps: trueprovidescreatedAtandupdatedAt. - Shared API/repository output continues to expose
$createdAtand$updatedAtas ISO strings for compatibility.
Draft and Platform Upload Document Payloads
drafts.documentstores JSON string payload for draft metadata.platform_uploads.documentstores JSON snapshot captured at distribution time.
See draft-document-and-upload-testing.md for full payload shape and manual upload flow.
Encryption at Rest for Connected Account Secrets
Connected account tokens and SFTP credentials are encrypted before persistence.
- Key env var:
TOKEN_ENCRYPTION_KEY - Algorithm: AES-256-GCM
- Implementation: lib/crypto/token-encryption.ts
Supported connected_accounts.platform values: youtube, vimeo, google_drive, sftp.
Migration Notes
If you are migrating existing datasets, keep the same string IDs and unique constraints used by the models so route/repository behavior remains unchanged.