add routers ip wip
This commit is contained in:
parent
928fe6578c
commit
9ee7f1cf3a
@ -11,7 +11,7 @@ router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/ipaddress", tags=["ipaddress"], response_model=list[ipaddress.IpAddressOut])
|
||||
async def read_events(authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))], skip: int = 0, limit: int = 20, id_event: str | None = None, name: str | None = None, status: int | None = None):
|
||||
async def read_events(authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))], skip: int = 0, limit: int = 20, id_ip: str | None = None, ip: str | None = None, status: int | None = None):
|
||||
if limit < 1 or skip < 0 or limit < skip:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
@ -23,11 +23,11 @@ async def read_events(authorize: Annotated[bool, Depends(permissions_checker.Per
|
||||
object_search = {}
|
||||
if status is not None:
|
||||
object_search = {"status":{"$eq": status}}
|
||||
if id_event is not None:
|
||||
eventid = ObjectId(id_event)
|
||||
object_search = {"id": {"$regex": userid}}
|
||||
if id_ip is not None:
|
||||
ipid = ObjectId(id_ip)
|
||||
object_search = {"id": {"$regex": ipid}}
|
||||
if status is not None:
|
||||
object_search = {"$and":[{"id":{"$regex": eventid}}, {"status":{"$eq":status}}]}
|
||||
object_search = {"$and":[{"id":{"$regex": ipid}}, {"status":{"$eq":status}}]}
|
||||
if name is not None:
|
||||
object_search = {"name": {"$regex": name}}
|
||||
if status is not None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user