Public PPR submission
This commit is contained in:
@@ -56,6 +56,31 @@ async def create_ppr(
|
||||
return ppr
|
||||
|
||||
|
||||
@router.post("/public", response_model=PPR)
|
||||
async def create_public_ppr(
|
||||
request: Request,
|
||||
ppr_in: PPRCreate,
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""Create a new PPR record (public endpoint, no authentication required)"""
|
||||
client_ip = get_client_ip(request)
|
||||
# For public submissions, use a default created_by or None
|
||||
ppr = crud_ppr.create(db, obj_in=ppr_in, created_by="public", user_ip=client_ip)
|
||||
|
||||
# Send real-time update via WebSocket
|
||||
if hasattr(request.app.state, 'connection_manager'):
|
||||
await request.app.state.connection_manager.broadcast({
|
||||
"type": "ppr_created",
|
||||
"data": {
|
||||
"id": ppr.id,
|
||||
"ac_reg": ppr.ac_reg,
|
||||
"status": ppr.status.value
|
||||
}
|
||||
})
|
||||
|
||||
return ppr
|
||||
|
||||
|
||||
@router.get("/{ppr_id}", response_model=PPR)
|
||||
async def get_ppr(
|
||||
ppr_id: int,
|
||||
|
||||
Reference in New Issue
Block a user