Replace the FastAPI/SQLAlchemy/Alembic web service with a Django project
laid out like cumorah-build: manage.py at the root, settings in the
privatestudio.settings package (base/dev/production), and a
privatestudio.studio app.
- Studio model owns a unique bucket_name; access is granted through
membership in the studio's auth Group. Assets, profiles and jobs are
scoped to a studio; API keys and S3 credentials stay per user.
- JSON API via Django Ninja under /api/ (profiles and transcode jobs now
live under /api/studios/{bucket}/).
- S3-compatible interface as plain class-based views under /s3/,
supporting bearer tokens and AWS v4 signatures.
- create_studio and create_key management commands replace ps-serve.
- Fresh Django initial migration; tests ported to Django TestCase.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
679 B
Python
28 lines
679 B
Python
"""S3 credential generation endpoint."""
|
|
from ninja import Router, Schema
|
|
|
|
from privatestudio.studio.s3_credentials import create_s3_credential
|
|
|
|
router = Router()
|
|
|
|
|
|
class S3KeyResponse(Schema):
|
|
access_key: str
|
|
secret_key: str
|
|
expires_at: str
|
|
|
|
|
|
@router.post("/s3keys", response=S3KeyResponse)
|
|
def generate_s3_keys(request):
|
|
"""
|
|
Generate temporary AWS v4 signature credentials for S3 access.
|
|
|
|
The secret key is only returned here.
|
|
"""
|
|
credential = create_s3_credential(request.auth)
|
|
return {
|
|
"access_key": credential.access_key,
|
|
"secret_key": credential.secret_key,
|
|
"expires_at": credential.expires_at.isoformat(),
|
|
}
|