Bulletin list and detail working now. No link from main dashboard yet. New is failing.
This commit is contained in:
@@ -9,7 +9,7 @@ from persistent.list import PersistentList
|
|||||||
from ..dependencies import get_current_http_user
|
from ..dependencies import get_current_http_user
|
||||||
from ..auth import HttpUser
|
from ..auth import HttpUser
|
||||||
from ..server import templates
|
from ..server import templates
|
||||||
from packetserver.runners.http_server import get_db_connection
|
|
||||||
from packetserver.server.bulletin import Bulletin
|
from packetserver.server.bulletin import Bulletin
|
||||||
|
|
||||||
# API router (/api/v1)
|
# API router (/api/v1)
|
||||||
@@ -21,6 +21,7 @@ html_router = APIRouter(tags=["bulletins-html"])
|
|||||||
# --- API Endpoints ---
|
# --- API Endpoints ---
|
||||||
|
|
||||||
async def list_bulletins(limit: int = 50, since: Optional[datetime] = None) -> dict:
|
async def list_bulletins(limit: int = 50, since: Optional[datetime] = None) -> dict:
|
||||||
|
from packetserver.runners.http_server import get_db_connection
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
root = conn.root()
|
root = conn.root()
|
||||||
bulletins_list: List[Bulletin] = root.get("bulletins", [])
|
bulletins_list: List[Bulletin] = root.get("bulletins", [])
|
||||||
@@ -54,6 +55,7 @@ async def api_list_bulletins(
|
|||||||
return await list_bulletins(limit=limit, since=since)
|
return await list_bulletins(limit=limit, since=since)
|
||||||
|
|
||||||
async def get_one_bulletin(bid: int) -> dict:
|
async def get_one_bulletin(bid: int) -> dict:
|
||||||
|
from packetserver.runners.http_server import get_db_connection
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
root = conn.root()
|
root = conn.root()
|
||||||
bulletins_list: List[Bulletin] = root.get("bulletins", [])
|
bulletins_list: List[Bulletin] = root.get("bulletins", [])
|
||||||
@@ -86,6 +88,7 @@ async def create_bulletin(
|
|||||||
payload: CreateBulletinRequest,
|
payload: CreateBulletinRequest,
|
||||||
current_user: HttpUser = Depends(get_current_http_user)
|
current_user: HttpUser = Depends(get_current_http_user)
|
||||||
):
|
):
|
||||||
|
from packetserver.runners.http_server import get_db_connection
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
root = conn.root()
|
root = conn.root()
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from fastapi.templating import Jinja2Templates
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from .routers import public, profile, messages, send
|
from .routers import public, profile, messages, send
|
||||||
from packetserver.http.routers.bulletins import html_router
|
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).parent.resolve()
|
BASE_DIR = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
@@ -45,4 +44,5 @@ app.include_router(messages.router)
|
|||||||
app.include_router(send.router)
|
app.include_router(send.router)
|
||||||
app.include_router(dashboard.router)
|
app.include_router(dashboard.router)
|
||||||
app.include_router(bulletins.router)
|
app.include_router(bulletins.router)
|
||||||
app.include_router(html_router)
|
app.include_router(bulletins.html_router)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user