Backend: UTC nel DB, +00:00 nelle API, ora italiana solo in presentazione (#42)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 11:41:22 +02:00
parent 0d004c43ff
commit 486e1288bf
24 changed files with 231 additions and 65 deletions
+2 -6
View File
@@ -1,7 +1,8 @@
"""Authentication service - password hashing, API key management."""
import hashlib
import secrets
from datetime import datetime, timedelta, timezone
from datetime import datetime, timedelta
from src.backend.utils.tempo import utcnow
import bcrypt
from fastapi import HTTPException, status
@@ -78,11 +79,6 @@ async def authorise_supervisor(db: AsyncSession, username: str, password: str) -
return supervisor
def utcnow() -> datetime:
"""Naive UTC now (the whole DB moves to naive UTC, #42)."""
return datetime.now(timezone.utc).replace(tzinfo=None)
def hash_api_key(key: str) -> str:
"""SHA-256 hex digest of an API key; this is all the DB ever stores."""
return hashlib.sha256(key.encode("utf-8")).hexdigest()