19 lines
568 B
Python
19 lines
568 B
Python
from rest_framework import serializers
|
|
|
|
from apps.live_monitoring.models import Camera
|
|
|
|
|
|
class CameraSerializer(serializers.ModelSerializer):
|
|
"""Public camera card. Stream URLs and credentials are never listed here —
|
|
clients must go through the tokenized ``access`` / ``verify`` flow.
|
|
"""
|
|
|
|
protocol = serializers.SerializerMethodField()
|
|
|
|
class Meta:
|
|
model = Camera
|
|
fields = ["id", "name", "facility", "processing_line", "protocol", "active"]
|
|
|
|
def get_protocol(self, obj: Camera) -> str:
|
|
return obj.resolved_protocol()
|