feat: add Mine Map v1
This commit is contained in:
1 parent
548051899e
commit
60a831950c
16 files changed
+2027
-163
No files matched your search
@@ -0,0 +1,30 @@
|
||||
"""HTTP boundary for the read-only Mine Map API."""
|
||||
|
||||
from typing import Annotated
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
|
||||
from app.identity import require_permission, user_has_permission
|
||||
from app.locations.dependencies import get_location_map_service
|
||||
from app.locations.models import MineMapResponse
|
||||
from app.locations.service import LocationMapService
|
||||
|
||||
|
||||
router = APIRouter(prefix="/api/location", tags=["locations"])
|
||||
MapUser = Annotated[dict, Depends(require_permission("locations.view"))]
|
||||
MapService = Annotated[LocationMapService, Depends(get_location_map_service)]
|
||||
|
||||
|
||||
@router.get("/map", response_model=MineMapResponse)
|
||||
def get_mine_map(
|
||||
current_user: MapUser,
|
||||
service: MapService,
|
||||
site_id: Annotated[UUID | None, Query()] = None,
|
||||
room_id: Annotated[UUID | None, Query()] = None,
|
||||
) -> MineMapResponse:
|
||||
return service.get_map(
|
||||
site_id=site_id,
|
||||
room_id=room_id,
|
||||
include_miner_details=user_has_permission(current_user, "miners.view"),
|
||||
)
|
||||
Reference in new issue
Block a user