video-accessibility/backend/app/models/share_token.py
Vadym Samoilenko abf81515a4 feat(pm15): share read-only link for client preview
Backend:
- ShareToken model (share_tokens collection)
- POST /jobs/{id}/share — create token (PM/PROD/ADMIN)
- GET /jobs/{id}/share — list active tokens
- DELETE /jobs/{id}/share/{token_id} — revoke token
- GET /public/share/{token} — unauthenticated preview with signed GCS URLs (6h TTL)
  Returns video, captions, AD for all languages

Frontend:
- ShareView.tsx — public page at /share/:token with language switcher, video player, download tiles
- App.tsx — /share/:token route (no auth wrapper)
- QCDetail.tsx — "↗ Share link" button in header → modal to generate + copy link

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 18:56:44 +01:00

27 lines
791 B
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel
class ShareToken(BaseModel):
id: Optional[str] = None # token itself (32 hex chars), used as _id
job_id: str
organization_id: str
created_by_user_id: str
created_by_email: str
created_at: Optional[datetime] = None
expires_at: Optional[datetime] = None
is_active: bool = True
label: Optional[str] = None # human-readable note e.g. "Sent to ACME 2026-05-01"
class ShareTokenResponse(BaseModel):
id: str
job_id: str
created_by_email: str
created_at: datetime
expires_at: Optional[datetime] = None
is_active: bool
label: Optional[str] = None
share_url: str # full public URL, assembled server-side