feat(validation): complete validation editor and master data modules

This commit is contained in:
Schubert Ferenc 2026-07-10 22:42:03 +02:00
parent 2b5c765e41
commit f73a24df13
73 changed files with 10194 additions and 0 deletions

View file

@ -0,0 +1,24 @@
from __future__ import annotations
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
app_name: str = "Validation Suite"
environment: str = "local"
database_url: str = Field(
default="postgresql+psycopg://validation:validation123@postgres:5432/validation_suite",
alias="DATABASE_URL",
)
jwt_secret: str = Field(default="change-me-in-production", alias="JWT_SECRET")
jwt_algorithm: str = "HS256"
access_token_minutes: int = 60 * 8
cors_origins: list[str] = ["http://localhost:3000"]
admin_email: str = Field(default="admin@schubamed.de", alias="ADMIN_EMAIL")
admin_password: str = Field(default="ValidationSuite!2026", alias="ADMIN_PASSWORD")
settings = Settings()

View file

@ -0,0 +1,23 @@
from __future__ import annotations
from datetime import UTC, datetime, timedelta
import bcrypt
from jose import jwt
from app.core.config import settings
def hash_password(password: str) -> str:
return bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt()).decode("utf-8")
def verify_password(password: str, password_hash: str) -> bool:
return bcrypt.checkpw(password.encode("utf-8"), password_hash.encode("utf-8"))
def create_access_token(subject: str, role: str) -> str:
expires_at = datetime.now(UTC) + timedelta(minutes=settings.access_token_minutes)
payload = {"sub": subject, "role": role, "exp": expires_at}
return jwt.encode(payload, settings.jwt_secret, algorithm=settings.jwt_algorithm)