feat: implement proxy management endpoints and MongoDB integration

This commit is contained in:
gabdevele
2026-04-12 00:55:29 +02:00 Unverified
parent 1b03ac7541
commit b4a84e70a2
6 changed files with 209 additions and 25 deletions
+32 -4
View File
@@ -1,8 +1,36 @@
from pydantic import BaseModel, Field
from datetime import datetime
from models.service import ServiceDocument
from pydantic import BaseModel, ConfigDict, Field
from models.service import ServiceEndpointDocument
class ProxyDocument(BaseModel):
port: int = Field(..., description="Port number of the proxy")
service: ServiceDocument = Field(..., description="Associated service details")
model_config = ConfigDict(extra="forbid")
proxy_port: int = Field(..., description="Port exposed by the proxy")
name: str = Field(..., description="Human readable proxy name")
code: str = Field(..., description="Proxy source or identifier")
service: ServiceEndpointDocument = Field(..., description="Associated upstream service")
created_at: datetime | None = Field(default=None, description="Creation timestamp in UTC")
updated_at: datetime | None = Field(default=None, description="Last update timestamp in UTC")
class ProxyCreateInput(BaseModel):
model_config = ConfigDict(extra="forbid")
proxy_port: int = Field(..., description="Port exposed by the proxy")
name: str = Field(..., description="Human readable proxy name")
code: str = Field(..., description="Proxy source or identifier")
service: ServiceEndpointDocument = Field(..., description="Associated upstream service")
class ProxyUpdateInput(BaseModel):
model_config = ConfigDict(extra="forbid")
name: str | None = Field(default=None, description="Human readable proxy name")
code: str | None = Field(default=None, description="Proxy source or identifier")
service: ServiceEndpointDocument | None = Field(
default=None,
description="Associated upstream service",
)
+7 -5
View File
@@ -1,6 +1,8 @@
from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field
class ServiceDocument(BaseModel):
name: str = Field(..., description="Name of the service")
port: int = Field(..., description="Port number of the service")
category: str = Field(..., description="Category of the service (e.g., web, pwn, etc.)")
class ServiceEndpointDocument(BaseModel):
model_config = ConfigDict(extra="forbid")
address: str = Field(..., description="Upstream service address")
port: int = Field(..., description="Upstream service port")