feat(auth): implement authentication endpoints and JWT handling

This commit is contained in:
gabdevele
2026-04-12 20:18:33 +02:00 Unverified
parent f3979c56ef
commit cc8ae34838
18 changed files with 640 additions and 33 deletions
+10 -5
View File
@@ -1,12 +1,11 @@
from datetime import datetime, timezone
from typing import Any, Mapping
from motor.motor_asyncio import AsyncIOMotorCollection
from pymongo import ReturnDocument
from core.mongodb import get_database
from models.proxy import ProxyDocument, ProxyUpdateInput
from models.service import ServiceEndpointDocument
from motor.motor_asyncio import AsyncIOMotorCollection
from pymongo import ReturnDocument
from utils.proxy.types import ServiceConfig
COLLECTION_NAME = "proxies"
@@ -45,7 +44,10 @@ async def create_proxy(
proxy_port=proxy_port,
name=name,
code=code,
service=ServiceEndpointDocument(address=service["address"], port=service["port"]),
service=ServiceEndpointDocument(
address=service["address"],
port=service["port"],
),
created_at=now,
updated_at=now,
)
@@ -73,7 +75,10 @@ async def list_proxies() -> list[ProxyDocument]:
return proxies
async def update_proxy(proxy_port: int, updates: ProxyUpdateInput) -> ProxyDocument | None:
async def update_proxy(
proxy_port: int,
updates: ProxyUpdateInput,
) -> ProxyDocument | None:
payload = updates.model_dump(exclude_none=True)
if not payload:
return await get_proxy_by_port(proxy_port)