mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 21:45:41 +00:00
refactor: Update project settings, URL configurations, client views, and remove requirements.txt.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12
gestaoRaul/payments/api_views.py
Normal file
12
gestaoRaul/payments/api_views.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from rest_framework import viewsets, permissions
|
||||
from .models import Payments
|
||||
from .serializers import PaymentsSerializer
|
||||
|
||||
class PaymentsViewSet(viewsets.ModelViewSet):
|
||||
queryset = Payments.objects.all()
|
||||
serializer_class = PaymentsSerializer
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
def get_queryset(self):
|
||||
# Opcionalmente filtrar pagamentos recentes
|
||||
return Payments.objects.all().order_by('-datetime')
|
||||
Binary file not shown.
Binary file not shown.
15
gestaoRaul/payments/serializers.py
Normal file
15
gestaoRaul/payments/serializers.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from rest_framework import serializers
|
||||
from .models import Payments
|
||||
|
||||
class PaymentsSerializer(serializers.ModelSerializer):
|
||||
type_pay_name = serializers.ReadOnlyField(source='type_pay.name')
|
||||
comanda_name = serializers.ReadOnlyField(source='comanda.name')
|
||||
client_name = serializers.ReadOnlyField(source='client.name')
|
||||
|
||||
class Meta:
|
||||
model = Payments
|
||||
fields = [
|
||||
'id', 'value', 'type_pay', 'type_pay_name',
|
||||
'comanda', 'comanda_name', 'client', 'client_name',
|
||||
'description', 'datetime'
|
||||
]
|
||||
Reference in New Issue
Block a user