from rest_framework import viewsets
from core.apps.eggs.models import Market
from core.apps.eggs.serializers.add_market import AddMarketSerializer
from core.http.permissions import IsRole


class AddMarketView(viewsets.ModelViewSet):
    queryset = Market.objects.all()
    serializer_class = AddMarketSerializer
    permission_classes = [IsRole(["admin"])]

    def perform_create(self, serializer):
        serializer.save()
