refactor: remove address field and related logic
This commit is contained in:
@@ -60,7 +60,7 @@ async def create_proxy_handler(payload: ProxyCreateInput):
|
||||
return await create_proxy(
|
||||
proxy_port=payload.proxy_port,
|
||||
name=payload.name,
|
||||
service={"address": payload.service.address, "port": payload.service.port},
|
||||
service={"port": payload.service.port},
|
||||
code=payload.code,
|
||||
)
|
||||
|
||||
|
||||
@@ -4,5 +4,4 @@ from pydantic import BaseModel, ConfigDict, Field
|
||||
class ServiceEndpointDocument(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
address: str = Field(..., description="Upstream service address")
|
||||
port: int = Field(..., description="Upstream service port")
|
||||
|
||||
@@ -4,11 +4,11 @@ from typing import Any
|
||||
|
||||
from motor.motor_asyncio import AsyncIOMotorCollection
|
||||
from pymongo import ReturnDocument
|
||||
from services.proxy.models import ServiceConfig
|
||||
|
||||
from core.mongodb import get_database
|
||||
from models.proxy import ProxyDocument, ProxyUpdateInput
|
||||
from models.service import ServiceEndpointDocument
|
||||
from services.proxy.models import ServiceConfig
|
||||
|
||||
COLLECTION_NAME = "proxies"
|
||||
|
||||
@@ -47,7 +47,6 @@ async def create_proxy(
|
||||
name=name,
|
||||
code=code,
|
||||
service=ServiceEndpointDocument(
|
||||
address=service["address"],
|
||||
port=service["port"],
|
||||
),
|
||||
created_at=now,
|
||||
|
||||
@@ -2,5 +2,4 @@ from typing import TypedDict
|
||||
|
||||
|
||||
class ServiceConfig(TypedDict):
|
||||
name: str
|
||||
port: int
|
||||
Reference in New Issue
Block a user