Primo commit

This commit is contained in:
2026-01-13 11:20:12 +01:00
parent ce9e2fdf2a
commit 17453f5d13
51 changed files with 3883 additions and 2508 deletions

View File

@@ -9,6 +9,7 @@ from slowapi import Limiter
from slowapi.util import get_remote_address
from database.connection import get_db
from database.models import UserRole
from services.auth import (
create_user, authenticate_user, create_access_token,
get_user_by_email
@@ -25,7 +26,6 @@ class RegisterRequest(BaseModel):
email: EmailStr
password: str
name: str
manager_id: str | None = None
class LoginRequest(BaseModel):
@@ -42,16 +42,16 @@ class UserResponse(BaseModel):
id: str
email: str
name: str | None
manager_id: str | None
role: str
manager_parking_quota: int | None = None
office_id: str | None
office_name: str | None = None
role: UserRole
week_start_day: int = 0
# Notification preferences
notify_weekly_parking: int = 1
notify_daily_parking: int = 1
notify_weekly_parking: bool = True
notify_daily_parking: bool = True
notify_daily_parking_hour: int = 8
notify_daily_parking_minute: int = 0
notify_parking_changes: int = 1
notify_parking_changes: bool = True
@router.post("/register", response_model=TokenResponse)
@@ -76,8 +76,7 @@ def register(request: Request, data: RegisterRequest, db: Session = Depends(get_
db=db,
email=data.email,
password=data.password,
name=data.name,
manager_id=data.manager_id
name=data.name
)
config.logger.info(f"New user registered: {data.email}")
@@ -126,15 +125,15 @@ def get_me(user=Depends(get_current_user)):
id=user.id,
email=user.email,
name=user.name,
manager_id=user.manager_id,
office_id=user.office_id,
office_name=user.office.name if user.office else None,
role=user.role,
manager_parking_quota=user.manager_parking_quota,
week_start_day=get_notification_default(user.week_start_day, 0),
notify_weekly_parking=get_notification_default(user.notify_weekly_parking, 1),
notify_daily_parking=get_notification_default(user.notify_daily_parking, 1),
notify_weekly_parking=get_notification_default(user.notify_weekly_parking, True),
notify_daily_parking=get_notification_default(user.notify_daily_parking, True),
notify_daily_parking_hour=get_notification_default(user.notify_daily_parking_hour, 8),
notify_daily_parking_minute=get_notification_default(user.notify_daily_parking_minute, 0),
notify_parking_changes=get_notification_default(user.notify_parking_changes, 1)
notify_parking_changes=get_notification_default(user.notify_parking_changes, True)
)