Added the pools-recreate endpoint, can be used to reset pools after editing connections.
This commit is contained in:
@@ -40,7 +40,9 @@ async def read_connections_endpoint(
|
||||
response_model=Connection,
|
||||
dependencies=[Depends(get_current_user)],
|
||||
)
|
||||
async def read_connection_endpoint(connection_id: int, db: AsyncSession = Depends(get_db)):
|
||||
async def read_connection_endpoint(
|
||||
connection_id: int, db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
db_connection = await read_connection(db, connection_id)
|
||||
if db_connection is None:
|
||||
raise HTTPException(status_code=404, detail="Connection not found")
|
||||
@@ -68,8 +70,21 @@ async def update_connection_endpoint(
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
dependencies=[Depends(get_admin_user)],
|
||||
)
|
||||
async def delete_connection_endpoint(connection_id: int, db: AsyncSession = Depends(get_db)):
|
||||
async def delete_connection_endpoint(
|
||||
connection_id: int, db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
db_connection = await delete_connection(db=db, connection_id=connection_id)
|
||||
if db_connection is None:
|
||||
raise HTTPException(status_code=404, detail="Connection not found")
|
||||
return None
|
||||
|
||||
|
||||
@router.post(
|
||||
"/pools-recreate",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
dependencies=[Depends(get_admin_user)],
|
||||
)
|
||||
async def recreate_pools():
|
||||
from utils.scripts import pools_creator, pools_destroy
|
||||
await pools_destroy()
|
||||
await pools_creator()
|
||||
|
||||
Reference in New Issue
Block a user