You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.6 KiB

from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from fastapi.requests import Request
from fastapi import Query
from pymongo.asynchronous.database import AsyncDatabase
from extra.MessageDTO import MessageDTO
from typing import List, Annotated
from pymongo import DESCENDING
class WebExtension:
MESSAGE_PORTNUM = 1
app: FastAPI
dbStore: AsyncDatabase
def __init__(self, core):
self.core = core
self.app = core.app
@self.app.get(f"{self.core.context}/packet/stats")
@self.core.authManager.authRequest()
async def findPacketsAndGroupCount(request: Request,
after: float = Query(-1),
before: float = Query(-1),
nums: List[int] = Query([]),
portnums: List[int] = Query([]),
packetsPerNode:bool = Query(False),
packetsSumNode:bool = Query(False)):
gl = await self.core.dbService.findPacketsAndGroupCount(after, before, nums, portnums, packetsPerNode, packetsSumNode)
return gl
@self.app.get(f"{self.core.context}/packet/signal")
@self.core.authManager.authRequest()
async def findPacketsAndGroupCount(request: Request,
after: float = Query(-1),
before: float = Query(-1),
nums: List[int] = Query([])):
gl = await self.core.dbService.findPacketsSignals(after, before, nums)
return gl