File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 55from sqlalchemy import select
66from sqlalchemy .ext .asyncio import AsyncSession
77
8- from app .db .models import ProxyInbound , ProxyHost
8+ from app .db .models import ProxyHost , ProxyInbound
99from app .models .host import CreateHost
1010
1111
@@ -140,11 +140,16 @@ async def create_host(db: AsyncSession, new_host: CreateHost) -> ProxyHost:
140140
141141
142142async def modify_host (db : AsyncSession , db_host : ProxyHost , modified_host : CreateHost ) -> ProxyHost :
143- host_data = modified_host .model_dump (exclude = {"id" })
143+ host_data = modified_host .model_dump (exclude = {"id" , "inbound_tag" })
144144
145145 for key , value in host_data .items ():
146146 setattr (db_host , key , value )
147147
148+ if not modified_host .inbound_tag :
149+ db_host .inbound = None
150+ else :
151+ db_host .inbound = await get_or_create_inbound (db , modified_host .inbound_tag )
152+
148153 await db .commit ()
149154 await db .refresh (db_host )
150155 return db_host
You can’t perform that action at this time.
0 commit comments