"""This module holds the serializers for the ``api`` app"""

from rest_framework import serializers


class NonDeletedListSerializer(serializers.ListSerializer):
    """List serializer subclass to apply the ``non_deleted`` queryset filter"""

    def to_representation(self, data):
        """Filter out the deleted items

        For the parameters, see ``rest_framework.serializers.ListSerializer``.
        """

        data = data.non_deleted()

        return super().to_representation(data)
