diff --git a/gestaoRaul.zip b/gestaoRaul.zip new file mode 100644 index 0000000..b898050 Binary files /dev/null and b/gestaoRaul.zip differ diff --git a/gestaoRaul/.gitignore b/gestaoRaul/.gitignore new file mode 100644 index 0000000..a4e8f0a --- /dev/null +++ b/gestaoRaul/.gitignore @@ -0,0 +1,18 @@ +.venv/ +__pycache__/ +*.py[cod] +*$py.class +.env +db.sqlite3 +media/ +static/ +.python-version +uv.lock +pyproject.toml +GUIA_POSTMAN_API.md +brain/ +logs/ +walkthrough.md +task.md +implementation_plan*.md +*.webp diff --git a/gestaoRaul/README.md b/gestaoRaul/README.md new file mode 100644 index 0000000..e69de29 diff --git a/gestaoRaul/balcao/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/__init__.cpython-312.pyc index 04120db..b2cd5e3 100644 Binary files a/gestaoRaul/balcao/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/admin.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/admin.cpython-312.pyc index dd3bda4..d71fabf 100644 Binary files a/gestaoRaul/balcao/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/apps.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/apps.cpython-312.pyc index f1b903c..a1f532e 100644 Binary files a/gestaoRaul/balcao/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc index 47e2733..06e76aa 100644 Binary files a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/models.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/models.cpython-312.pyc index 78916c0..8a10e8c 100644 Binary files a/gestaoRaul/balcao/__pycache__/models.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/urls.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/urls.cpython-312.pyc index 1a7b4ea..da07072 100644 Binary files a/gestaoRaul/balcao/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc index 718e315..33ed526 100644 Binary files a/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/categories/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/categories/__pycache__/__init__.cpython-312.pyc index 6907e66..d75c5df 100644 Binary files a/gestaoRaul/categories/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/categories/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/categories/__pycache__/admin.cpython-312.pyc b/gestaoRaul/categories/__pycache__/admin.cpython-312.pyc index e231c4d..b649e50 100644 Binary files a/gestaoRaul/categories/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/categories/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/categories/__pycache__/apps.cpython-312.pyc b/gestaoRaul/categories/__pycache__/apps.cpython-312.pyc index 42f432f..cf7d127 100644 Binary files a/gestaoRaul/categories/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/categories/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/categories/__pycache__/models.cpython-312.pyc b/gestaoRaul/categories/__pycache__/models.cpython-312.pyc index c8e1af7..064abba 100644 Binary files a/gestaoRaul/categories/__pycache__/models.cpython-312.pyc and b/gestaoRaul/categories/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/categories/__pycache__/urls.cpython-312.pyc b/gestaoRaul/categories/__pycache__/urls.cpython-312.pyc index 11204cb..f370b9d 100644 Binary files a/gestaoRaul/categories/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/categories/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/categories/__pycache__/views.cpython-312.pyc b/gestaoRaul/categories/__pycache__/views.cpython-312.pyc index 5a087d3..1a1b0b4 100644 Binary files a/gestaoRaul/categories/__pycache__/views.cpython-312.pyc and b/gestaoRaul/categories/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/categories/api_views.py b/gestaoRaul/categories/api_views.py new file mode 100644 index 0000000..7ed827d --- /dev/null +++ b/gestaoRaul/categories/api_views.py @@ -0,0 +1,8 @@ +from rest_framework import viewsets, permissions +from .models import Categories +from .serializers import CategoriesSerializer + +class CategoriesViewSet(viewsets.ModelViewSet): + queryset = Categories.objects.all() + serializer_class = CategoriesSerializer + permission_classes = [permissions.IsAuthenticatedOrReadOnly] diff --git a/gestaoRaul/categories/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestaoRaul/categories/migrations/__pycache__/0001_initial.cpython-312.pyc index 951343e..32c09ca 100644 Binary files a/gestaoRaul/categories/migrations/__pycache__/0001_initial.cpython-312.pyc and b/gestaoRaul/categories/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/gestaoRaul/categories/migrations/__pycache__/0002_rename_category_categories.cpython-312.pyc b/gestaoRaul/categories/migrations/__pycache__/0002_rename_category_categories.cpython-312.pyc index 3e075c6..36ce5f4 100644 Binary files a/gestaoRaul/categories/migrations/__pycache__/0002_rename_category_categories.cpython-312.pyc and b/gestaoRaul/categories/migrations/__pycache__/0002_rename_category_categories.cpython-312.pyc differ diff --git a/gestaoRaul/categories/migrations/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/categories/migrations/__pycache__/__init__.cpython-312.pyc index 06eaab2..51c6da4 100644 Binary files a/gestaoRaul/categories/migrations/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/categories/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/categories/serializers.py b/gestaoRaul/categories/serializers.py new file mode 100644 index 0000000..b0c6477 --- /dev/null +++ b/gestaoRaul/categories/serializers.py @@ -0,0 +1,7 @@ +from rest_framework import serializers +from .models import Categories + +class CategoriesSerializer(serializers.ModelSerializer): + class Meta: + model = Categories + fields = '__all__' diff --git a/gestaoRaul/clients/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/clients/__pycache__/__init__.cpython-312.pyc index 3c1282e..c6e983e 100644 Binary files a/gestaoRaul/clients/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/clients/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/clients/__pycache__/admin.cpython-312.pyc b/gestaoRaul/clients/__pycache__/admin.cpython-312.pyc index 7f5766a..0559609 100644 Binary files a/gestaoRaul/clients/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/clients/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/clients/__pycache__/apps.cpython-312.pyc b/gestaoRaul/clients/__pycache__/apps.cpython-312.pyc index 380defe..c8504fd 100644 Binary files a/gestaoRaul/clients/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/clients/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/clients/__pycache__/models.cpython-312.pyc b/gestaoRaul/clients/__pycache__/models.cpython-312.pyc index 35cd00b..0194644 100644 Binary files a/gestaoRaul/clients/__pycache__/models.cpython-312.pyc and b/gestaoRaul/clients/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/clients/__pycache__/urls.cpython-312.pyc b/gestaoRaul/clients/__pycache__/urls.cpython-312.pyc index 83c27de..28de9e9 100644 Binary files a/gestaoRaul/clients/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/clients/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/clients/__pycache__/views.cpython-312.pyc b/gestaoRaul/clients/__pycache__/views.cpython-312.pyc index efcd208..201b447 100644 Binary files a/gestaoRaul/clients/__pycache__/views.cpython-312.pyc and b/gestaoRaul/clients/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/clients/api_views.py b/gestaoRaul/clients/api_views.py new file mode 100644 index 0000000..6000cc9 --- /dev/null +++ b/gestaoRaul/clients/api_views.py @@ -0,0 +1,74 @@ +from rest_framework import viewsets, permissions, status +from rest_framework.decorators import action +from rest_framework.response import Response +from .models import Client +from .serializers import ClientSerializer +from comandas.models import Comanda, ProductComanda +from comandas.serializers import ComandaSerializer +from payments.models import Payments, somar +from typePay.models import TypePay + +class ClientViewSet(viewsets.ModelViewSet): + queryset = Client.objects.all() + serializer_class = ClientSerializer + permission_classes = [permissions.IsAuthenticated] + + def get_queryset(self): + return Client.objects.all() + + @action(detail=True, methods=['get']) + def fiados(self, request, pk=None): + client = self.get_object() + comandas = Comanda.objects.filter(client=client, status='FIADO') + serializer = ComandaSerializer(comandas, many=True) + return Response(serializer.data) + + @action(detail=False, methods=['post']) + def pagar_fiados(self, request): + comanda_ids = request.data.get('ids', []) + if not comanda_ids: + return Response({'error': 'Nenhum ID de comanda fornecido.'}, status=status.HTTP_400_BAD_REQUEST) + + results = [] + for comanda_id in comanda_ids: + try: + comanda = Comanda.objects.get(id=comanda_id) + + # Apenas processar se estiver como FIADO + if comanda.status != 'FIADO': + results.append({'id': comanda_id, 'status': 'erro', 'message': 'Status da comanda não é FIADO.'}) + continue + + # 1. Fechar a comanda + comanda.status = 'CLOSED' + comanda.save() + + # 2. Gerar o pagamento (Inspirado no payDebt original) + try: + type_pay = TypePay.objects.get(id=1) # Assume ID 1 como padrão para recebimento de fiado + except TypePay.DoesNotExist: + type_pay, _ = TypePay.objects.get_or_create(id=1, defaults={'name': 'Dinheiro'}) + + consumo = ProductComanda.objects.filter(comanda=comanda) + valores = somar(consumo, comanda) + + payment = Payments.objects.create( + value=valores['totalSemTaxa'], # Valor que falta pagar + type_pay=type_pay, + comanda=comanda, + client=comanda.client, + description='PAGAMENTO DE FIADO (via API)' + ) + + results.append({'id': comanda_id, 'status': 'sucesso', 'payment_id': payment.id}) + + except Comanda.DoesNotExist: + results.append({'id': comanda_id, 'status': 'erro', 'message': 'Comanda não encontrada.'}) + except Exception as e: + results.append({'id': comanda_id, 'status': 'erro', 'message': str(e)}) + + return Response({ + 'success': True, + 'message': f'{len(comanda_ids)} comandas processadas', + 'results': results + }, status=status.HTTP_200_OK) diff --git a/gestaoRaul/clients/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestaoRaul/clients/migrations/__pycache__/0001_initial.cpython-312.pyc index 39d680a..f9e576e 100644 Binary files a/gestaoRaul/clients/migrations/__pycache__/0001_initial.cpython-312.pyc and b/gestaoRaul/clients/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/gestaoRaul/clients/migrations/__pycache__/0002_client_created_at_client_debt.cpython-312.pyc b/gestaoRaul/clients/migrations/__pycache__/0002_client_created_at_client_debt.cpython-312.pyc index c45f81b..ece5d3d 100644 Binary files a/gestaoRaul/clients/migrations/__pycache__/0002_client_created_at_client_debt.cpython-312.pyc and b/gestaoRaul/clients/migrations/__pycache__/0002_client_created_at_client_debt.cpython-312.pyc differ diff --git a/gestaoRaul/clients/migrations/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/clients/migrations/__pycache__/__init__.cpython-312.pyc index 30c7d8f..6d25ab2 100644 Binary files a/gestaoRaul/clients/migrations/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/clients/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/clients/serializers.py b/gestaoRaul/clients/serializers.py new file mode 100644 index 0000000..9b47ab1 --- /dev/null +++ b/gestaoRaul/clients/serializers.py @@ -0,0 +1,23 @@ +from rest_framework import serializers +from .models import Client +from comandas.models import Comanda, ProductComanda +from payments.models import Payments, somar +from decimal import Decimal + +class ClientSerializer(serializers.ModelSerializer): + debt = serializers.SerializerMethodField() + + class Meta: + model = Client + fields = ['id', 'name', 'created_at', 'active', 'contact', 'debt'] + + def get_debt(self, obj): + comandas = Comanda.objects.filter(client=obj, status='FIADO') + total_debt = Decimal(0) + + for comanda in comandas: + consumo = ProductComanda.objects.filter(comanda=comanda) + valores = somar(consumo, comanda) + total_debt += valores['totalSemTaxa'] + + return total_debt diff --git a/gestaoRaul/clients/views.py b/gestaoRaul/clients/views.py index 43d7c1c..a1a9110 100644 --- a/gestaoRaul/clients/views.py +++ b/gestaoRaul/clients/views.py @@ -89,14 +89,12 @@ def payDebt(request): typePayment = TypePay.objects.get(id=1) consumo = ProductComanda.objects.filter(comanda=comanda_id) value = somar(consumo,comanda) - print(value["totalSemTaxa"]) description = 'PAGAMENTO DE FIADO' pagamento = Payments(value=value["totalSemTaxa"], comanda=comanda, type_pay=typePayment,description=description,client=comanda.client) pagamento.save() except Comanda.DoesNotExist: return JsonResponse({'error': f'Comanda com ID {comanda_id} não encontrada'}, status=404) - # return redirect(f'/clients/viewClient/{comanda.client.id}') return JsonResponse({ 'success': True, diff --git a/gestaoRaul/comandas/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/__init__.cpython-312.pyc index 187050a..7cdcf48 100644 Binary files a/gestaoRaul/comandas/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/admin.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/admin.cpython-312.pyc index 30aaef4..4700468 100644 Binary files a/gestaoRaul/comandas/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/apps.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/apps.cpython-312.pyc index a49bf10..1aaae39 100644 Binary files a/gestaoRaul/comandas/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc index c57a7db..2a6eae0 100644 Binary files a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc index 793c12e..644be7a 100644 Binary files a/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc index 706f463..ed24ff4 100644 Binary files a/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc index 53182cc..3c55aac 100644 Binary files a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/api_views.py b/gestaoRaul/comandas/api_views.py new file mode 100644 index 0000000..d9d8954 --- /dev/null +++ b/gestaoRaul/comandas/api_views.py @@ -0,0 +1,168 @@ +from rest_framework import viewsets, permissions, status +from rest_framework.decorators import action +from rest_framework.response import Response +from django.utils import timezone +from .models import Comanda, ProductComanda, StockMovement, StockMovementType +from .serializers import ComandaSerializer, ProductComandaSerializer +from payments.models import Payments +from typePay.models import TypePay +from clients.models import Client + +class ComandaViewSet(viewsets.ModelViewSet): + queryset = Comanda.objects.all() + serializer_class = ComandaSerializer + permission_classes = [permissions.IsAuthenticated] + + def get_queryset(self): + return Comanda.objects.all() + + @action(detail=True, methods=['post']) + def apagar(self, request, pk=None): + comanda = self.get_object() + + # 1. Recuperar os itens para devolver ao estoque + itens = ProductComanda.objects.filter(comanda=comanda) + + # Tipo de movimentação: Estorno/Cancelamento (ajustar conforme os tipos existentes) + # Se não houver um tipo específico, podemos buscar um genérico ou usar o de Venda com sinal invertido via sumTransactionStock + try: + typeMovement = StockMovementType.objects.get(name="Estorno - Comanda Apagada") + except StockMovementType.DoesNotExist: + # Fallback para um tipo existente se o de estorno não existir + typeMovement, _ = StockMovementType.objects.get_or_create(name="Ajuste de Estoque (Cancelamento)") + + for item in itens: + StockMovement.sumTransactionStock( + product=item.product, + movement_type=typeMovement, + comanda=comanda, + user=request.user, + qtd=1, + obs=f"Estorno: Comanda {comanda.name} apagada/limpa via API" + ) + + # 2. Excluir os itens da comanda + itens.delete() + + # 3. Mudar o status para CLOSED + comanda.status = 'CLOSED' + comanda.save() + + @action(detail=True, methods=['post']) + def pagar(self, request, pk=None): + comanda = self.get_object() + + # Dados do pagamento vindos no request + value = request.data.get('value') + type_pay_id = request.data.get('type_pay') + client_id = request.data.get('client') + description = request.data.get('description', f"Pagamento da comanda {comanda.name}") + + if not value or not type_pay_id: + return Response( + {'error': 'Campos "value" e "type_pay" são obrigatórios.'}, + status=status.HTTP_400_BAD_REQUEST + ) + + try: + type_pay = TypePay.objects.get(id=type_pay_id) + except TypePay.DoesNotExist: + return Response({'error': 'Tipo de pagamento não encontrado.'}, status=status.HTTP_400_BAD_REQUEST) + + client = None + if client_id: + try: + client = Client.objects.get(id=client_id) + except Client.DoesNotExist: + return Response({'error': 'Cliente não encontrado.'}, status=status.HTTP_400_BAD_REQUEST) + + # 1. Criar o registro de pagamento + payment = Payments.objects.create( + value=value, + type_pay=type_pay, + comanda=comanda, + client=client, + description=description + ) + + # 2. Fechar a comanda + comanda.status = 'CLOSED' + comanda.dt_close = timezone.now() + comanda.save() + + return Response({ + 'status': 'Pagamento registrado e comanda fechada com sucesso.', + 'payment_id': payment.id + }, status=status.HTTP_200_OK) + +class ProductComandaViewSet(viewsets.ModelViewSet): + queryset = ProductComanda.objects.all() + serializer_class = ProductComandaSerializer + permission_classes = [permissions.IsAuthenticated] + + def perform_create(self, serializer): + # Salva o item na comanda + product_comanda = serializer.save() + + # Recupera os dados para a movimentação de estoque + product = product_comanda.product + comanda = product_comanda.comanda + + # Tipo de movimentação: Venda - Comanda (como na view original) + try: + typeMovement = StockMovementType.objects.get(name="Venda - Comanda") + except StockMovementType.DoesNotExist: + typeMovement, _ = StockMovementType.objects.get_or_create(name="Saída de Estoque (API)") + + StockMovement.subTransactionStock( + product=product, + movement_type=typeMovement, + comanda=comanda, + user=self.request.user, + qtd=1, + obs="Adicionado na comanda via API" + ) + + # 3. Criar Pedido (Order) automaticamente se for item de cozinha + # (Lógica inspirada no addProduct original) + if product.cuisine: + from orders.models import Order + Order.objects.create( + id_comanda=comanda, + id_product=product, + productComanda=product_comanda, + obs=self.request.data.get('obs', '') + ) + + def perform_update(self, serializer): + instance = serializer.save() + obs = self.request.data.get('obs') + if obs is not None: + order = instance.order_set.first() + if order: + order.obs = obs + order.save() + + def perform_destroy(self, instance): + # Recupera os dados antes de deletar + product = instance.product + comanda = instance.comanda + + # Tipo de movimentação: Estorno/Cancelamento + try: + typeMovement = StockMovementType.objects.get(name="Estorno - Item Removido") + except StockMovementType.DoesNotExist: + typeMovement, _ = StockMovementType.objects.get_or_create(name="Ajuste de Estoque (Cancelamento)") + + # Realiza a devolução ao estoque + StockMovement.sumTransactionStock( + product=product, + movement_type=typeMovement, + comanda=comanda, + user=self.request.user, + qtd=1, + obs=f"Estorno: Item {product.name} removido da comanda {comanda.name} via API" + ) + + # Deleta o registro definitivamente + instance.delete() diff --git a/gestaoRaul/comandas/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestaoRaul/comandas/migrations/__pycache__/0001_initial.cpython-312.pyc index 9d14a41..9067a66 100644 Binary files a/gestaoRaul/comandas/migrations/__pycache__/0001_initial.cpython-312.pyc and b/gestaoRaul/comandas/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/migrations/__pycache__/0002_productcomanda.cpython-312.pyc b/gestaoRaul/comandas/migrations/__pycache__/0002_productcomanda.cpython-312.pyc index a5c6197..b23eb8a 100644 Binary files a/gestaoRaul/comandas/migrations/__pycache__/0002_productcomanda.cpython-312.pyc and b/gestaoRaul/comandas/migrations/__pycache__/0002_productcomanda.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/migrations/__pycache__/0003_comanda_status_alter_productcomanda_product.cpython-312.pyc b/gestaoRaul/comandas/migrations/__pycache__/0003_comanda_status_alter_productcomanda_product.cpython-312.pyc index aa60511..6494876 100644 Binary files a/gestaoRaul/comandas/migrations/__pycache__/0003_comanda_status_alter_productcomanda_product.cpython-312.pyc and b/gestaoRaul/comandas/migrations/__pycache__/0003_comanda_status_alter_productcomanda_product.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/migrations/__pycache__/0004_comanda_user.cpython-312.pyc b/gestaoRaul/comandas/migrations/__pycache__/0004_comanda_user.cpython-312.pyc index aa72881..d770665 100644 Binary files a/gestaoRaul/comandas/migrations/__pycache__/0004_comanda_user.cpython-312.pyc and b/gestaoRaul/comandas/migrations/__pycache__/0004_comanda_user.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/migrations/__pycache__/0005_stockmovementtype_stockmovement.cpython-312.pyc b/gestaoRaul/comandas/migrations/__pycache__/0005_stockmovementtype_stockmovement.cpython-312.pyc index a1c63ed..b96f5cd 100644 Binary files a/gestaoRaul/comandas/migrations/__pycache__/0005_stockmovementtype_stockmovement.cpython-312.pyc and b/gestaoRaul/comandas/migrations/__pycache__/0005_stockmovementtype_stockmovement.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/migrations/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/comandas/migrations/__pycache__/__init__.cpython-312.pyc index fff2780..17d7080 100644 Binary files a/gestaoRaul/comandas/migrations/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/comandas/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/serializers.py b/gestaoRaul/comandas/serializers.py new file mode 100644 index 0000000..b48cfc0 --- /dev/null +++ b/gestaoRaul/comandas/serializers.py @@ -0,0 +1,28 @@ +from rest_framework import serializers +from .models import Comanda, ProductComanda + +class ProductComandaSerializer(serializers.ModelSerializer): + product_name = serializers.ReadOnlyField(source='product.name') + obs = serializers.SerializerMethodField() + + class Meta: + model = ProductComanda + fields = ['id', 'comanda', 'data_time', 'product', 'product_name', 'applicant', 'obs'] + + def get_obs(self, obj): + order = obj.order_set.first() + return order.obs if order else "" + +class ComandaSerializer(serializers.ModelSerializer): + mesa_name = serializers.ReadOnlyField(source='mesa.name') + client_name = serializers.ReadOnlyField(source='client.name') + user_name = serializers.ReadOnlyField(source='user.username') + items = ProductComandaSerializer(many=True, read_only=True, source='productcomanda_set') + + class Meta: + model = Comanda + fields = [ + 'id', 'mesa', 'mesa_name', 'user', 'user_name', + 'type_pay', 'dt_open', 'dt_close', 'client', + 'client_name', 'name', 'status', 'items' + ] diff --git a/gestaoRaul/comandas/templatetags/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/comandas/templatetags/__pycache__/__init__.cpython-312.pyc index 72893b6..0c1e4eb 100644 Binary files a/gestaoRaul/comandas/templatetags/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/comandas/templatetags/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/templatetags/__pycache__/custom_filter_tag.cpython-312.pyc b/gestaoRaul/comandas/templatetags/__pycache__/custom_filter_tag.cpython-312.pyc index aa63e1e..557f43c 100644 Binary files a/gestaoRaul/comandas/templatetags/__pycache__/custom_filter_tag.cpython-312.pyc and b/gestaoRaul/comandas/templatetags/__pycache__/custom_filter_tag.cpython-312.pyc differ diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 56d3887..d1d95e2 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/gestaoRaul/__pycache__/__init__.cpython-312.pyc index 362f0e4..e617dcc 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/gestaoRaul/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/decorators.cpython-312.pyc b/gestaoRaul/gestaoRaul/__pycache__/decorators.cpython-312.pyc index 546d996..d85e7d3 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/decorators.cpython-312.pyc and b/gestaoRaul/gestaoRaul/__pycache__/decorators.cpython-312.pyc differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc index 2171e93..08595a1 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc and b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-312.pyc b/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-312.pyc index 52358fe..5757a92 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/wsgi.cpython-312.pyc b/gestaoRaul/gestaoRaul/__pycache__/wsgi.cpython-312.pyc index 06b3f71..e727182 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/wsgi.cpython-312.pyc and b/gestaoRaul/gestaoRaul/__pycache__/wsgi.cpython-312.pyc differ diff --git a/gestaoRaul/gestaoRaul/api_urls.py b/gestaoRaul/gestaoRaul/api_urls.py new file mode 100644 index 0000000..5dbc306 --- /dev/null +++ b/gestaoRaul/gestaoRaul/api_urls.py @@ -0,0 +1,31 @@ +from django.urls import path, include +from rest_framework.routers import DefaultRouter +from orders.api_views import OrderViewSet +from products.api_views import ProductViewSet +from clients.api_views import ClientViewSet +from mesas.api_views import MesaViewSet +from comandas.api_views import ComandaViewSet, ProductComandaViewSet +from categories.api_views import CategoriesViewSet +from typePay.api_views import TypePayViewSet +from payments.api_views import PaymentsViewSet +from rest_framework_simplejwt.views import ( + TokenRefreshView, +) +from login.api_views import MyTokenObtainPairView + +router = DefaultRouter() +router.register(r'orders', OrderViewSet, basename='order') +router.register(r'products', ProductViewSet, basename='product') +router.register(r'clients', ClientViewSet, basename='client') +router.register(r'mesas', MesaViewSet, basename='mesa') +router.register(r'comandas', ComandaViewSet, basename='comanda') +router.register(r'items-comanda', ProductComandaViewSet, basename='items-comanda') +router.register(r'categories', CategoriesViewSet, basename='category') +router.register(r'payment-types', TypePayViewSet, basename='payment-type') +router.register(r'payments', PaymentsViewSet, basename='payment') + +urlpatterns = [ + path('', include(router.urls)), + path('token/', MyTokenObtainPairView.as_view(), name='token_obtain_pair'), + path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'), +] diff --git a/gestaoRaul/gestaoRaul/settings.py b/gestaoRaul/gestaoRaul/settings.py index 4b28d17..05fe078 100644 --- a/gestaoRaul/gestaoRaul/settings.py +++ b/gestaoRaul/gestaoRaul/settings.py @@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/5.1/ref/settings/ import os from pathlib import Path +from datetime import timedelta from dotenv import load_dotenv load_dotenv() @@ -31,21 +32,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-mqcnrs5!hc6bj$�@@9d8^2@x#w&$qhk3vlr5_)3znd9h6&d8' +SECRET_KEY = os.getenv('SECRET_KEY', 'django-insecure-mqcnrs5!hc6bj$�@@9d8^2@x#w&$qhk3vlr5_)3znd9h6&d8') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = os.getenv('DEBUG', 'True') == 'True' -ALLOWED_HOSTS = [ - '192.168.0.150', - '192.168.1.150', - '10.72.150.166', - 'localhost', - '127.0.0.1', - 'rrbec.local.com', - 'django_app', - '0.0.0.0' - ] +ALLOWED_HOSTS = ['*'] # Application definition @@ -70,10 +62,14 @@ INSTALLED_APPS = [ 'login', 'django_extensions', 'pwa', + 'rest_framework', + 'corsheaders', ] MIDDLEWARE = [ + 'corsheaders.middleware.CorsMiddleware', 'django.middleware.security.SecurityMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -106,24 +102,24 @@ WSGI_APPLICATION = 'gestaoRaul.wsgi.application' # Database # https://docs.djangoproject.com/en/5.1/ref/settings/#databases -# DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.sqlite3', -# 'NAME': BASE_DIR / 'db.sqlite3', -# } -# } - - DATABASES = { - 'default': { - 'ENGINE': DB_ENGINE, - 'NAME': DB_NAME, - 'USER': DB_USER, - 'PASSWORD': DB_PASSWORD, - 'HOST': DB_HOST, - 'PORT': DB_PORT, - } - } + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# DATABASES = { +# 'default': { +# 'ENGINE': DB_ENGINE, +# 'NAME': DB_NAME, +# 'USER': DB_USER, +# 'PASSWORD': DB_PASSWORD, +# 'HOST': DB_HOST, +# 'PORT': DB_PORT, +# } +# } # Password validation @@ -165,6 +161,16 @@ STATIC_URL = 'static/' STATICFILES_DIRS = (os.path.join(BASE_DIR, 'templates/static'),) STATIC_ROOT = os.path.join(BASE_DIR, 'static') +# WhiteNoise storage to compress and cache static files +STORAGES = { + "default": { + "BACKEND": "django.core.files.storage.FileSystemStorage", + }, + "staticfiles": { + "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", + }, +} + MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' @@ -199,4 +205,23 @@ PWA_APP_SPLASH_SCREEN = { "media": "(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" } PWA_APP_DIR = "ltr" -PWA_APP_LANG = "pt-BR" \ No newline at end of file +PWA_APP_LANG = "pt-BR" + +# --- REST FRAMEWORK & CORS --- +CORS_ALLOW_ALL_ORIGINS = True # Para desenvolvimento +CORS_ALLOW_CREDENTIALS = True # Permite envio de cookies para SessionAuth + +REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework.authentication.SessionAuthentication', # Prioridade para teste no navegador + 'rest_framework_simplejwt.authentication.JWTAuthentication', + ), + 'DEFAULT_PERMISSION_CLASSES': ( + 'rest_framework.permissions.IsAuthenticated', + ), +} + +SIMPLE_JWT = { + 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60), + 'REFRESH_TOKEN_LIFETIME': timedelta(days=1), +} \ No newline at end of file diff --git a/gestaoRaul/gestaoRaul/urls.py b/gestaoRaul/gestaoRaul/urls.py index 1f54e0b..09aaf0c 100644 --- a/gestaoRaul/gestaoRaul/urls.py +++ b/gestaoRaul/gestaoRaul/urls.py @@ -30,6 +30,5 @@ urlpatterns = [ path('balcao/', include('balcao.urls')), path('pedidos/', include('orders.urls')), path('', include('pwa.urls')), - - + path('api/v1/', include('gestaoRaul.api_urls')), ] diff --git a/gestaoRaul/home/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/home/__pycache__/__init__.cpython-312.pyc index 5af2f89..5c49d87 100644 Binary files a/gestaoRaul/home/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/home/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/home/__pycache__/admin.cpython-312.pyc b/gestaoRaul/home/__pycache__/admin.cpython-312.pyc index 6168e07..12d4f80 100644 Binary files a/gestaoRaul/home/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/home/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/home/__pycache__/apps.cpython-312.pyc b/gestaoRaul/home/__pycache__/apps.cpython-312.pyc index aa93645..f443073 100644 Binary files a/gestaoRaul/home/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/home/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/home/__pycache__/models.cpython-312.pyc b/gestaoRaul/home/__pycache__/models.cpython-312.pyc index 0249f88..77d6cc5 100644 Binary files a/gestaoRaul/home/__pycache__/models.cpython-312.pyc and b/gestaoRaul/home/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/home/__pycache__/urls.cpython-312.pyc b/gestaoRaul/home/__pycache__/urls.cpython-312.pyc index ed8f6d5..35b1b57 100644 Binary files a/gestaoRaul/home/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/home/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/home/__pycache__/views.cpython-312.pyc b/gestaoRaul/home/__pycache__/views.cpython-312.pyc index 6e705cd..8b8ffb4 100644 Binary files a/gestaoRaul/home/__pycache__/views.cpython-312.pyc and b/gestaoRaul/home/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/home/migrations/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/home/migrations/__pycache__/__init__.cpython-312.pyc index 8e19c6d..768dbe5 100644 Binary files a/gestaoRaul/home/migrations/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/home/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/login/__pycache__/urls.cpython-312.pyc b/gestaoRaul/login/__pycache__/urls.cpython-312.pyc index 454f8d8..54723f7 100644 Binary files a/gestaoRaul/login/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/login/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/login/__pycache__/views.cpython-312.pyc b/gestaoRaul/login/__pycache__/views.cpython-312.pyc index d1d1b20..86f65ca 100644 Binary files a/gestaoRaul/login/__pycache__/views.cpython-312.pyc and b/gestaoRaul/login/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/login/api_views.py b/gestaoRaul/login/api_views.py new file mode 100644 index 0000000..bbd407d --- /dev/null +++ b/gestaoRaul/login/api_views.py @@ -0,0 +1,5 @@ +from rest_framework_simplejwt.views import TokenObtainPairView +from .serializers import MyTokenObtainPairSerializer + +class MyTokenObtainPairView(TokenObtainPairView): + serializer_class = MyTokenObtainPairSerializer diff --git a/gestaoRaul/login/serializers.py b/gestaoRaul/login/serializers.py new file mode 100644 index 0000000..efa55ce --- /dev/null +++ b/gestaoRaul/login/serializers.py @@ -0,0 +1,27 @@ +from rest_framework_simplejwt.serializers import TokenObtainPairSerializer + +class MyTokenObtainPairSerializer(TokenObtainPairSerializer): + @classmethod + def get_token(cls, user): + token = super().get_token(user) + + # Adicione campos personalizados ao token (payload) se desejar + token['username'] = user.username + token['groups'] = list(user.groups.values_list('name', flat=True)) + + return token + + def validate(self, attrs): + data = super().validate(attrs) + + # Adicione informações do usuário na resposta do JSON + data['user'] = { + 'id': self.user.id, + 'username': self.user.username, + 'email': self.user.email, + 'first_name': self.user.first_name, + 'last_name': self.user.last_name, + 'groups': list(self.user.groups.values_list('name', flat=True)) + } + + return data diff --git a/gestaoRaul/main.py b/gestaoRaul/main.py new file mode 100644 index 0000000..5505081 --- /dev/null +++ b/gestaoRaul/main.py @@ -0,0 +1,6 @@ +def main(): + print("Hello from gestaoraul!") + + +if __name__ == "__main__": + main() diff --git a/gestaoRaul/mesas/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/mesas/__pycache__/__init__.cpython-312.pyc index 353f872..422902c 100644 Binary files a/gestaoRaul/mesas/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/mesas/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/mesas/__pycache__/admin.cpython-312.pyc b/gestaoRaul/mesas/__pycache__/admin.cpython-312.pyc index 9fdb4b5..b4ef18c 100644 Binary files a/gestaoRaul/mesas/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/mesas/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/mesas/__pycache__/apps.cpython-312.pyc b/gestaoRaul/mesas/__pycache__/apps.cpython-312.pyc index cfddfc2..7166dc5 100644 Binary files a/gestaoRaul/mesas/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/mesas/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/mesas/__pycache__/models.cpython-312.pyc b/gestaoRaul/mesas/__pycache__/models.cpython-312.pyc index bbd7402..c8e80f5 100644 Binary files a/gestaoRaul/mesas/__pycache__/models.cpython-312.pyc and b/gestaoRaul/mesas/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/mesas/__pycache__/urls.cpython-312.pyc b/gestaoRaul/mesas/__pycache__/urls.cpython-312.pyc index 41ac14c..289a3a2 100644 Binary files a/gestaoRaul/mesas/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/mesas/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/mesas/__pycache__/views.cpython-312.pyc b/gestaoRaul/mesas/__pycache__/views.cpython-312.pyc index fca7f3f..2bb846d 100644 Binary files a/gestaoRaul/mesas/__pycache__/views.cpython-312.pyc and b/gestaoRaul/mesas/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/mesas/api_views.py b/gestaoRaul/mesas/api_views.py new file mode 100644 index 0000000..c9fa8cc --- /dev/null +++ b/gestaoRaul/mesas/api_views.py @@ -0,0 +1,8 @@ +from rest_framework import viewsets, permissions +from .models import Mesa +from .serializers import MesaSerializer + +class MesaViewSet(viewsets.ModelViewSet): + queryset = Mesa.objects.all() + serializer_class = MesaSerializer + permission_classes = [permissions.IsAuthenticated] diff --git a/gestaoRaul/mesas/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestaoRaul/mesas/migrations/__pycache__/0001_initial.cpython-312.pyc index bc22cb5..01a60b5 100644 Binary files a/gestaoRaul/mesas/migrations/__pycache__/0001_initial.cpython-312.pyc and b/gestaoRaul/mesas/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/gestaoRaul/mesas/migrations/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/mesas/migrations/__pycache__/__init__.cpython-312.pyc index 917566f..5b94486 100644 Binary files a/gestaoRaul/mesas/migrations/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/mesas/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/mesas/serializers.py b/gestaoRaul/mesas/serializers.py new file mode 100644 index 0000000..319ad92 --- /dev/null +++ b/gestaoRaul/mesas/serializers.py @@ -0,0 +1,7 @@ +from rest_framework import serializers +from .models import Mesa + +class MesaSerializer(serializers.ModelSerializer): + class Meta: + model = Mesa + fields = '__all__' diff --git a/gestaoRaul/orders/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/orders/__pycache__/__init__.cpython-312.pyc index efa86a7..6482db6 100644 Binary files a/gestaoRaul/orders/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/orders/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/orders/__pycache__/admin.cpython-312.pyc b/gestaoRaul/orders/__pycache__/admin.cpython-312.pyc index 9527c52..11f28ac 100644 Binary files a/gestaoRaul/orders/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/orders/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/orders/__pycache__/apps.cpython-312.pyc b/gestaoRaul/orders/__pycache__/apps.cpython-312.pyc index 53fb131..f3490ef 100644 Binary files a/gestaoRaul/orders/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/orders/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/orders/__pycache__/models.cpython-312.pyc b/gestaoRaul/orders/__pycache__/models.cpython-312.pyc index cce4871..6f10b3f 100644 Binary files a/gestaoRaul/orders/__pycache__/models.cpython-312.pyc and b/gestaoRaul/orders/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/orders/__pycache__/urls.cpython-312.pyc b/gestaoRaul/orders/__pycache__/urls.cpython-312.pyc index d58e210..2e9c222 100644 Binary files a/gestaoRaul/orders/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/orders/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/orders/__pycache__/views.cpython-312.pyc b/gestaoRaul/orders/__pycache__/views.cpython-312.pyc index fcbdeb1..844f546 100644 Binary files a/gestaoRaul/orders/__pycache__/views.cpython-312.pyc and b/gestaoRaul/orders/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/orders/api_views.py b/gestaoRaul/orders/api_views.py new file mode 100644 index 0000000..15936d1 --- /dev/null +++ b/gestaoRaul/orders/api_views.py @@ -0,0 +1,47 @@ +from rest_framework import viewsets, permissions, status +from rest_framework.decorators import action +from rest_framework.response import Response +from .models import Order +from .serializers import OrderSerializer +from django.utils import timezone + +class OrderViewSet(viewsets.ModelViewSet): + queryset = Order.objects.all() + serializer_field = OrderSerializer + permission_classes = [permissions.IsAuthenticated] + + def get_queryset(self): + # Filtrar pedidos das últimas 15 horas como na view original + fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15) + return Order.objects.filter(queue__gte=fifteen_hours_ago).order_by('-queue') + + def get_serializer_class(self): + return OrderSerializer + + @action(detail=True, methods=['post']) + def preparing(self, request, pk=None): + order = self.get_object() + order.preparing = timezone.now() + order.save() + return Response(OrderSerializer(order).data) + + @action(detail=True, methods=['post']) + def finish(self, request, pk=None): + order = self.get_object() + order.finished = timezone.now() + order.save() + return Response(OrderSerializer(order).data) + + @action(detail=True, methods=['post']) + def deliver(self, request, pk=None): + order = self.get_object() + order.delivered = timezone.now() + order.save() + return Response(OrderSerializer(order).data) + + @action(detail=True, methods=['post']) + def cancel(self, request, pk=None): + order = self.get_object() + order.canceled = timezone.now() + order.save() + return Response(OrderSerializer(order).data) diff --git a/gestaoRaul/orders/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestaoRaul/orders/migrations/__pycache__/0001_initial.cpython-312.pyc index e84cc75..67d7982 100644 Binary files a/gestaoRaul/orders/migrations/__pycache__/0001_initial.cpython-312.pyc and b/gestaoRaul/orders/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-312.pyc b/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-312.pyc index 3c5a2ad..d177e82 100644 Binary files a/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-312.pyc and b/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-312.pyc differ diff --git a/gestaoRaul/orders/migrations/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/orders/migrations/__pycache__/__init__.cpython-312.pyc index e0e6b8d..c0db084 100644 Binary files a/gestaoRaul/orders/migrations/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/orders/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/orders/serializers.py b/gestaoRaul/orders/serializers.py new file mode 100644 index 0000000..96047cf --- /dev/null +++ b/gestaoRaul/orders/serializers.py @@ -0,0 +1,31 @@ +from rest_framework import serializers +from .models import Order + +class OrderSerializer(serializers.ModelSerializer): + status = serializers.SerializerMethodField() + product_name = serializers.ReadOnlyField(source='id_product.name') + comanda_name = serializers.ReadOnlyField(source='id_comanda.name') + mesa_name = serializers.ReadOnlyField(source='id_comanda.mesa.name') + + class Meta: + model = Order + fields = [ + 'id', 'id_product', 'product_name', 'id_comanda', 'comanda_name', + 'mesa_name', 'obs', 'queue', 'preparing', 'finished', + 'delivered', 'canceled', 'status' + ] + extra_kwargs = { + 'queue': {'read_only': True}, + 'status': {'read_only': True}, + } + + def get_status(self, obj): + if obj.delivered: + return 'Entregue' + if obj.finished: + return 'Pronto' + if obj.preparing: + return 'Preparando' + if obj.canceled: + return 'Cancelado' + return 'Em espera' diff --git a/gestaoRaul/payments/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/payments/__pycache__/__init__.cpython-312.pyc index 753edec..bbb2275 100644 Binary files a/gestaoRaul/payments/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/payments/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/payments/__pycache__/admin.cpython-312.pyc b/gestaoRaul/payments/__pycache__/admin.cpython-312.pyc index 096cd0e..c115f6f 100644 Binary files a/gestaoRaul/payments/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/payments/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/payments/__pycache__/apps.cpython-312.pyc b/gestaoRaul/payments/__pycache__/apps.cpython-312.pyc index 4181561..fb07b0b 100644 Binary files a/gestaoRaul/payments/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/payments/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/payments/__pycache__/models.cpython-312.pyc b/gestaoRaul/payments/__pycache__/models.cpython-312.pyc index 4ff6d21..d70fc62 100644 Binary files a/gestaoRaul/payments/__pycache__/models.cpython-312.pyc and b/gestaoRaul/payments/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/payments/api_views.py b/gestaoRaul/payments/api_views.py new file mode 100644 index 0000000..e288cc5 --- /dev/null +++ b/gestaoRaul/payments/api_views.py @@ -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') diff --git a/gestaoRaul/payments/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestaoRaul/payments/migrations/__pycache__/0001_initial.cpython-312.pyc index 236764f..0b36c67 100644 Binary files a/gestaoRaul/payments/migrations/__pycache__/0001_initial.cpython-312.pyc and b/gestaoRaul/payments/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/gestaoRaul/payments/migrations/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/payments/migrations/__pycache__/__init__.cpython-312.pyc index 10cea92..c8f0431 100644 Binary files a/gestaoRaul/payments/migrations/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/payments/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/payments/serializers.py b/gestaoRaul/payments/serializers.py new file mode 100644 index 0000000..72319e9 --- /dev/null +++ b/gestaoRaul/payments/serializers.py @@ -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' + ] diff --git a/gestaoRaul/products/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/products/__pycache__/__init__.cpython-312.pyc index 7f622e0..19f88a1 100644 Binary files a/gestaoRaul/products/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/products/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/products/__pycache__/admin.cpython-312.pyc b/gestaoRaul/products/__pycache__/admin.cpython-312.pyc index 1a12239..4c67474 100644 Binary files a/gestaoRaul/products/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/products/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/products/__pycache__/apps.cpython-312.pyc b/gestaoRaul/products/__pycache__/apps.cpython-312.pyc index 7f2644a..748b245 100644 Binary files a/gestaoRaul/products/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/products/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/products/__pycache__/models.cpython-312.pyc b/gestaoRaul/products/__pycache__/models.cpython-312.pyc index f70a556..3ff7775 100644 Binary files a/gestaoRaul/products/__pycache__/models.cpython-312.pyc and b/gestaoRaul/products/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/products/__pycache__/urls.cpython-312.pyc b/gestaoRaul/products/__pycache__/urls.cpython-312.pyc index e1e97c7..a7da0ce 100644 Binary files a/gestaoRaul/products/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/products/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/products/__pycache__/views.cpython-312.pyc b/gestaoRaul/products/__pycache__/views.cpython-312.pyc index 48cca5d..b1eae30 100644 Binary files a/gestaoRaul/products/__pycache__/views.cpython-312.pyc and b/gestaoRaul/products/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/products/api_views.py b/gestaoRaul/products/api_views.py new file mode 100644 index 0000000..4b2bfcd --- /dev/null +++ b/gestaoRaul/products/api_views.py @@ -0,0 +1,11 @@ +from rest_framework import viewsets, permissions +from .models import Product +from .serializers import ProductSerializer + +class ProductViewSet(viewsets.ModelViewSet): + queryset = Product.objects.all() + serializer_class = ProductSerializer + permission_classes = [permissions.IsAuthenticatedOrReadOnly] + + def get_queryset(self): + return Product.objects.all() diff --git a/gestaoRaul/products/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestaoRaul/products/migrations/__pycache__/0001_initial.cpython-312.pyc index e30e4e3..f77564a 100644 Binary files a/gestaoRaul/products/migrations/__pycache__/0001_initial.cpython-312.pyc and b/gestaoRaul/products/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/gestaoRaul/products/migrations/__pycache__/0002_product_image_product_quantity.cpython-312.pyc b/gestaoRaul/products/migrations/__pycache__/0002_product_image_product_quantity.cpython-312.pyc index 613db8d..21dc7a1 100644 Binary files a/gestaoRaul/products/migrations/__pycache__/0002_product_image_product_quantity.cpython-312.pyc and b/gestaoRaul/products/migrations/__pycache__/0002_product_image_product_quantity.cpython-312.pyc differ diff --git a/gestaoRaul/products/migrations/__pycache__/0003_product_cuisine.cpython-312.pyc b/gestaoRaul/products/migrations/__pycache__/0003_product_cuisine.cpython-312.pyc index fe92bd0..36ca8cf 100644 Binary files a/gestaoRaul/products/migrations/__pycache__/0003_product_cuisine.cpython-312.pyc and b/gestaoRaul/products/migrations/__pycache__/0003_product_cuisine.cpython-312.pyc differ diff --git a/gestaoRaul/products/migrations/__pycache__/0004_unitofmeasure_productcomponent_product_components_and_more.cpython-312.pyc b/gestaoRaul/products/migrations/__pycache__/0004_unitofmeasure_productcomponent_product_components_and_more.cpython-312.pyc index 9ada42c..8e8ae12 100644 Binary files a/gestaoRaul/products/migrations/__pycache__/0004_unitofmeasure_productcomponent_product_components_and_more.cpython-312.pyc and b/gestaoRaul/products/migrations/__pycache__/0004_unitofmeasure_productcomponent_product_components_and_more.cpython-312.pyc differ diff --git a/gestaoRaul/products/migrations/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/products/migrations/__pycache__/__init__.cpython-312.pyc index 2e74f4e..a312f80 100644 Binary files a/gestaoRaul/products/migrations/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/products/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/products/serializers.py b/gestaoRaul/products/serializers.py new file mode 100644 index 0000000..1ea67fe --- /dev/null +++ b/gestaoRaul/products/serializers.py @@ -0,0 +1,19 @@ +from rest_framework import serializers +from .models import Product, UnitOfMeasure + +class UnitOfMeasureSerializer(serializers.ModelSerializer): + class Meta: + model = UnitOfMeasure + fields = '__all__' + +class ProductSerializer(serializers.ModelSerializer): + category_name = serializers.ReadOnlyField(source='category.name') + unit_of_measure_name = serializers.ReadOnlyField(source='unit_of_measure.name') + + class Meta: + model = Product + fields = [ + 'id', 'name', 'description', 'image', 'price', + 'quantity', 'category', 'category_name', + 'cuisine', 'active', 'unit_of_measure', 'unit_of_measure_name' + ] diff --git a/gestaoRaul/requirements.txt b/gestaoRaul/requirements.txt new file mode 100644 index 0000000..2407cd1 --- /dev/null +++ b/gestaoRaul/requirements.txt @@ -0,0 +1,254 @@ +# This file was autogenerated by uv via the following command: +# uv export --format requirements-txt --output-file requirements.txt +asarpy==1.0.1 \ + --hash=sha256:1f1a9a230942da620bc134eccda7be352f731301ac1269e71e426419e433a0d6 + # via gestaoraul +asgiref==3.8.1 \ + --hash=sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47 \ + --hash=sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590 + # via + # django + # django-cors-headers + # gestaoraul +cffi==1.17.1 \ + --hash=sha256:0984a4925a435b1da406122d4d7968dd861c1385afe3b45ba82b750f229811e2 \ + --hash=sha256:1257bdabf294dceb59f5e70c64a3e2f462c30c7ad68092d01bbbfb1c16b1ba36 \ + --hash=sha256:1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824 \ + --hash=sha256:386c8bf53c502fff58903061338ce4f4950cbdcb23e2902d86c0f722b786bbe3 \ + --hash=sha256:3edc8d958eb099c634dace3c7e16560ae474aa3803a5df240542b305d14e14ed \ + --hash=sha256:4ceb10419a9adf4460ea14cfd6bc43d08701f0835e979bf821052f1805850fe8 \ + --hash=sha256:51392eae71afec0d0c8fb1a53b204dbb3bcabcb3c9b807eedf3e1e6ccf2de903 \ + --hash=sha256:706510fe141c86a69c8ddc029c7910003a17353970cff3b904ff0686a5927683 \ + --hash=sha256:72e72408cad3d5419375fc87d289076ee319835bdfa2caad331e377589aebba9 \ + --hash=sha256:733e99bc2df47476e3848417c5a4540522f234dfd4ef3ab7fafdf555b082ec0c \ + --hash=sha256:805b4371bf7197c329fcb3ead37e710d1bca9da5d583f5073b799d5c5bd1eee4 \ + --hash=sha256:a08d7e755f8ed21095a310a693525137cfe756ce62d066e53f502a83dc550f65 \ + --hash=sha256:b62ce867176a75d03a665bad002af8e6d54644fad99a3c70905c543130e39d93 \ + --hash=sha256:c59d6e989d07460165cc5ad3c61f9fd8f1b4796eacbd81cee78957842b834af4 \ + --hash=sha256:d01b12eeeb4427d3110de311e1774046ad344f5b1a7403101878976ecd7a10f3 \ + --hash=sha256:d63afe322132c194cf832bfec0dc69a99fb9bb6bbd550f161a49e9e855cc78ff \ + --hash=sha256:da95af8214998d77a98cc14e3a3bd00aa191526343078b530ceb0bd710fb48a5 \ + --hash=sha256:dd398dbc6773384a17fe0d3e7eeb8d1a21c2200473ee6806bb5e6a8e62bb73dd \ + --hash=sha256:de55b766c7aa2e2a3092c51e0483d700341182f08e67c63630d5b6f200bb28e5 \ + --hash=sha256:e03eab0a8677fa80d646b5ddece1cbeaf556c313dcfac435ba11f107ba117b5d \ + --hash=sha256:f3a2b4222ce6b60e2e8b337bb9596923045681d71e5a082783484d845390938e \ + --hash=sha256:f6a16c31041f09ead72d69f583767292f750d24913dadacf5756b966aacb3f1a \ + --hash=sha256:f79fc4fc25f1c8698ff97788206bb3c2598949bfe0fef03d299eb1b5356ada99 + # via + # cryptography + # gestaoraul +cryptography==44.0.0 \ + --hash=sha256:1923cb251c04be85eec9fda837661c67c1049063305d6be5721643c22dd4e2b7 \ + --hash=sha256:3c672a53c0fb4725a29c303be906d3c1fa99c32f58abe008a82705f9ee96f40b \ + --hash=sha256:404fdc66ee5f83a1388be54300ae978b2efd538018de18556dde92575e05defc \ + --hash=sha256:4ac4c9f37eba52cb6fbeaf5b59c152ea976726b865bd4cf87883a7e7006cc543 \ + --hash=sha256:660cb7312a08bc38be15b696462fa7cc7cd85c3ed9c576e81f4dc4d8b2b31591 \ + --hash=sha256:708ee5f1bafe76d041b53a4f95eb28cdeb8d18da17e597d46d7833ee59b97ede \ + --hash=sha256:761817a3377ef15ac23cd7834715081791d4ec77f9297ee694ca1ee9c2c7e5eb \ + --hash=sha256:831c3c4d0774e488fdc83a1923b49b9957d33287de923d58ebd3cec47a0ae43f \ + --hash=sha256:84111ad4ff3f6253820e6d3e58be2cc2a00adb29335d4cacb5ab4d4d34f2a123 \ + --hash=sha256:9e6fc8a08e116fb7c7dd1f040074c9d7b51d74a8ea40d4df2fc7aa08b76b9e6c \ + --hash=sha256:a01956ddfa0a6790d594f5b34fc1bfa6098aca434696a03cfdbe469b8ed79285 \ + --hash=sha256:abc998e0c0eee3c8a1904221d3f67dcfa76422b23620173e28c11d3e626c21bd \ + --hash=sha256:b15492a11f9e1b62ba9d73c210e2416724633167de94607ec6069ef724fad092 \ + --hash=sha256:c5eb858beed7835e5ad1faba59e865109f3e52b3783b9ac21e7e47dc5554e289 \ + --hash=sha256:cd4e834f340b4293430701e772ec543b0fbe6c2dea510a5286fe0acabe153a02 \ + --hash=sha256:d2436114e46b36d00f8b72ff57e598978b37399d2786fd39793c36c6d5cb1c64 \ + --hash=sha256:eb33480f1bad5b78233b0ad3e1b0be21e8ef1da745d8d2aecbb20671658b9053 \ + --hash=sha256:eca27345e1214d1b9f9490d200f9db5a874479be914199194e746c893788d417 \ + --hash=sha256:ed3534eb1090483c96178fcb0f8893719d96d5274dfde98aa6add34614e97c8e \ + --hash=sha256:f3f6fdfa89ee2d9d496e2c087cebef9d4fcbb0ad63c40e821b39f74bf48d9c5e \ + --hash=sha256:f53c2c87e0fb4b0c00fa9571082a057e37690a8f12233306161c8f4b819960b7 + # via + # gestaoraul + # pyopenssl +django==5.1.4 \ + --hash=sha256:236e023f021f5ce7dee5779de7b286565fdea5f4ab86bae5338e3f7b69896cf0 \ + --hash=sha256:de450c09e91879fa5a307f696e57c851955c910a438a35e6b4c895e86bedc82a + # via + # django-cors-headers + # django-extensions + # django-pwa + # djangorestframework + # djangorestframework-simplejwt + # gestaoraul +django-cors-headers==4.9.0 \ + --hash=sha256:15c7f20727f90044dcee2216a9fd7303741a864865f0c3657e28b7056f61b449 \ + --hash=sha256:fe5d7cb59fdc2c8c646ce84b727ac2bca8912a247e6e68e1fb507372178e59e8 + # via gestaoraul +django-extensions==3.2.3 \ + --hash=sha256:44d27919d04e23b3f40231c4ab7af4e61ce832ef46d610cc650d53e68328410a \ + --hash=sha256:9600b7562f79a92cbf1fde6403c04fee314608fefbb595502e34383ae8203401 + # via gestaoraul +django-pwa==2.0.1 \ + --hash=sha256:41dc931c645c6125c556bd753205ca051aa48e5d46edbf281003594f3d76d4a3 \ + --hash=sha256:5539fabb41fe189cc2a82cb1f0f889b45671a8144d7b5bb5206a9ddd0fddb3c2 + # via gestaoraul +djangorestframework==3.16.1 \ + --hash=sha256:166809528b1aced0a17dc66c24492af18049f2c9420dbd0be29422029cfc3ff7 \ + --hash=sha256:33a59f47fb9c85ede792cbf88bde71893bcda0667bc573f784649521f1102cec + # via + # djangorestframework-simplejwt + # gestaoraul +djangorestframework-simplejwt==5.5.1 \ + --hash=sha256:2c30f3707053d384e9f315d11c2daccfcb548d4faa453111ca19a542b732e469 \ + --hash=sha256:e72c5572f51d7803021288e2057afcbd03f17fe11d484096f40a460abc76e87f + # via gestaoraul +dotenv==0.9.9 \ + --hash=sha256:29cf74a087b31dafdb5a446b6d7e11cbce8ed2741540e2339c69fbef92c94ce9 + # via gestaoraul +gunicorn==23.0.0 \ + --hash=sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d \ + --hash=sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec + # via gestaoraul +markupsafe==3.0.2 \ + --hash=sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30 \ + --hash=sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9 \ + --hash=sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396 \ + --hash=sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028 \ + --hash=sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557 \ + --hash=sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a \ + --hash=sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c \ + --hash=sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c \ + --hash=sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22 \ + --hash=sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094 \ + --hash=sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5 \ + --hash=sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225 \ + --hash=sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c \ + --hash=sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87 \ + --hash=sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf \ + --hash=sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb \ + --hash=sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48 \ + --hash=sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c \ + --hash=sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6 \ + --hash=sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd \ + --hash=sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1 \ + --hash=sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d \ + --hash=sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca \ + --hash=sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a \ + --hash=sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe \ + --hash=sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8 \ + --hash=sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f \ + --hash=sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f \ + --hash=sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0 \ + --hash=sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79 \ + --hash=sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430 + # via + # gestaoraul + # werkzeug +packaging==24.2 \ + --hash=sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759 \ + --hash=sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f + # via + # gestaoraul + # gunicorn +pillow==11.1.0 \ + --hash=sha256:11633d58b6ee5733bde153a8dafd25e505ea3d32e261accd388827ee987baf65 \ + --hash=sha256:2062ffb1d36544d42fcaa277b069c88b01bb7298f4efa06731a7fd6cc290b81a \ + --hash=sha256:31eba6bbdd27dde97b0174ddf0297d7a9c3a507a8a1480e1e60ef914fe23d352 \ + --hash=sha256:368da70808b36d73b4b390a8ffac11069f8a5c85f29eff1f1b01bcf3ef5b2a20 \ + --hash=sha256:36ba10b9cb413e7c7dfa3e189aba252deee0602c86c309799da5a74009ac7a1c \ + --hash=sha256:3764d53e09cdedd91bee65c2527815d315c6b90d7b8b79759cc48d7bf5d4f114 \ + --hash=sha256:3cdcdb0b896e981678eee140d882b70092dac83ac1cdf6b3a60e2216a73f2b91 \ + --hash=sha256:4dd43a78897793f60766563969442020e90eb7847463eca901e41ba186a7d4a5 \ + --hash=sha256:593c5fd6be85da83656b93ffcccc2312d2d149d251e98588b14fbc288fd8909c \ + --hash=sha256:67cd427c68926108778a9005f2a04adbd5e67c442ed21d95389fe1d595458756 \ + --hash=sha256:70ca5ef3b3b1c4a0812b5c63c57c23b63e53bc38e758b37a951e5bc466449861 \ + --hash=sha256:758e9d4ef15d3560214cddbc97b8ef3ef86ce04d62ddac17ad39ba87e89bd3b1 \ + --hash=sha256:7fdadc077553621911f27ce206ffcbec7d3f8d7b50e0da39f10997e8e2bb7f6a \ + --hash=sha256:8000376f139d4d38d6851eb149b321a52bb8893a88dae8ee7d95840431977081 \ + --hash=sha256:9044b5e4f7083f209c4e35aa5dd54b1dd5b112b108648f5c902ad586d4f945c5 \ + --hash=sha256:93a18841d09bcdd774dcdc308e4537e1f867b3dec059c131fde0327899734aa1 \ + --hash=sha256:9409c080586d1f683df3f184f20e36fb647f2e0bc3988094d4fd8c9f4eb1b3b3 \ + --hash=sha256:9aa9aeddeed452b2f616ff5507459e7bab436916ccb10961c4a382cd3e03f47f \ + --hash=sha256:9ee85f0696a17dd28fbcfceb59f9510aa71934b483d1f5601d1030c3c8304f3c \ + --hash=sha256:a697cd8ba0383bba3d2d3ada02b34ed268cb548b369943cd349007730c92bddf \ + --hash=sha256:a85b653980faad27e88b141348707ceeef8a1186f75ecc600c395dcac19f385b \ + --hash=sha256:ad5db5781c774ab9a9b2c4302bbf0c1014960a0a7be63278d13ae6fdf88126fe \ + --hash=sha256:ae98e14432d458fc3de11a77ccb3ae65ddce70f730e7c76140653048c71bfcbc \ + --hash=sha256:b523466b1a31d0dcef7c5be1f20b942919b62fd6e9a9be199d035509cbefc0ec \ + --hash=sha256:b5d658fbd9f0d6eea113aea286b21d3cd4d3fd978157cbf2447a6035916506d3 \ + --hash=sha256:cc1331b6d5a6e144aeb5e626f4375f5b7ae9934ba620c0ac6b3e43d5e683a0f0 \ + --hash=sha256:cfd5cd998c2e36a862d0e27b2df63237e67273f2fc78f47445b14e73a810e7e6 \ + --hash=sha256:dd0e081319328928531df7a0e63621caf67652c8464303fd102141b785ef9547 \ + --hash=sha256:dda60aa465b861324e65a78c9f5cf0f4bc713e4309f83bc387be158b077963d9 \ + --hash=sha256:e63e4e5081de46517099dc30abe418122f54531a6ae2ebc8680bcd7096860eab \ + --hash=sha256:f86d3a7a9af5d826744fabf4afd15b9dfef44fe69a98541f666f66fbb8d3fef9 + # via gestaoraul +psycopg==3.2.6 \ + --hash=sha256:16fa094efa2698f260f2af74f3710f781e4a6f226efe9d1fd0c37f384639ed8a \ + --hash=sha256:f3ff5488525890abb0566c429146add66b329e20d6d4835662b920cbbf90ac58 + # via gestaoraul +pycparser==2.22 \ + --hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \ + --hash=sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc + # via + # cffi + # gestaoraul +pyjwt==2.11.0 \ + --hash=sha256:35f95c1f0fbe5d5ba6e43f00271c275f7a1a4db1dab27bf708073b75318ea623 \ + --hash=sha256:94a6bde30eb5c8e04fee991062b534071fd1439ef58d2adc9ccb823e7bcd0469 + # via djangorestframework-simplejwt +pyopenssl==24.3.0 \ + --hash=sha256:49f7a019577d834746bc55c5fce6ecbcec0f2b4ec5ce1cf43a9a173b8138bb36 \ + --hash=sha256:e474f5a473cd7f92221cc04976e48f4d11502804657a08a989fb3be5514c904a + # via gestaoraul +python-dotenv==1.1.0 \ + --hash=sha256:41f90bc6f5f177fb41f53e87666db362025010eb28f60a01c9143bfa33a2b2d5 \ + --hash=sha256:d7c01d9e2293916c18baf562d95698754b0dbbb5e74d457c45d4f6561fb9d55d + # via + # dotenv + # gestaoraul +sqlparse==0.5.2 \ + --hash=sha256:9e37b35e16d1cc652a2545f0997c1deb23ea28fa1f3eefe609eee3063c3b105f \ + --hash=sha256:e99bc85c78160918c3e1d9230834ab8d80fc06c59d03f8db2618f65f65dda55e + # via + # django + # gestaoraul +typing-extensions==4.12.2 \ + --hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \ + --hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8 + # via + # gestaoraul + # psycopg +tzdata==2024.2 \ + --hash=sha256:7d85cc416e9382e69095b7bdf4afd9e3880418a2413feec7069d533d6b4e31cc \ + --hash=sha256:a48093786cdcde33cad18c2555e8532f34422074448fbc874186f0abd79565cd + # via + # django + # gestaoraul + # psycopg +websockets==15.0 \ + --hash=sha256:0f2205cdb444a42a7919690238fb5979a05439b9dbb73dd47c863d39640d85ab \ + --hash=sha256:10552fed076757a70ba2c18edcbc601c7637b30cdfe8c24b65171e824c7d6081 \ + --hash=sha256:1206432cc6c644f6fc03374b264c5ff805d980311563202ed7fef91a38906276 \ + --hash=sha256:1caf951110ca757b8ad9c4974f5cac7b8413004d2f29707e4d03a65d54cedf2b \ + --hash=sha256:26ba70fed190708551c19a360f9d7eca8e8c0f615d19a574292b7229e0ae324c \ + --hash=sha256:32e02a2d83f4954aa8c17e03fe8ec6962432c39aca4be7e8ee346b05a3476904 \ + --hash=sha256:3a302241fbe825a3e4fe07666a2ab513edfdc6d43ce24b79691b45115273b5e7 \ + --hash=sha256:51ffd53c53c4442415b613497a34ba0aa7b99ac07f1e4a62db5dcd640ae6c3c3 \ + --hash=sha256:56e3efe356416bc67a8e093607315951d76910f03d2b3ad49c4ade9207bf710d \ + --hash=sha256:5d3cc75ef3e17490042c47e0523aee1bcc4eacd2482796107fd59dd1100a44bc \ + --hash=sha256:86bfb52a9cfbcc09aba2b71388b0a20ea5c52b6517c0b2e316222435a8cdab72 \ + --hash=sha256:8bf1ab71f9f23b0a1d52ec1682a3907e0c208c12fef9c3e99d2b80166b17905f \ + --hash=sha256:a9f8e33747b1332db11cf7fcf4a9512bef9748cb5eb4d3f7fbc8c30d75dc6ffc \ + --hash=sha256:ae721bcc8e69846af00b7a77a220614d9b2ec57d25017a6bbde3a99473e41ce8 \ + --hash=sha256:aea01f40995fa0945c020228ab919b8dfc93fc8a9f2d3d705ab5b793f32d9e99 \ + --hash=sha256:b89504227a5311610e4be16071465885a0a3d6b0e82e305ef46d9b064ce5fb72 \ + --hash=sha256:bfcd3acc1a81f106abac6afd42327d2cf1e77ec905ae11dc1d9142a006a496b6 \ + --hash=sha256:c53f97032b87a406044a1c33d1e9290cc38b117a8062e8a8b285175d7e2f99c9 \ + --hash=sha256:c8c5c8e1bac05ef3c23722e591ef4f688f528235e2480f157a9cfe0a19081375 \ + --hash=sha256:ca36151289a15b39d8d683fd8b7abbe26fc50be311066c5f8dcf3cb8cee107ab \ + --hash=sha256:cccc18077acd34c8072578394ec79563664b1c205f7a86a62e94fafc7b59001f \ + --hash=sha256:d2244d8ab24374bed366f9ff206e2619345f9cd7fe79aad5225f53faac28b6b1 \ + --hash=sha256:d4c22992e24f12de340ca5f824121a5b3e1a37ad4360b4e1aaf15e9d1c42582d \ + --hash=sha256:ffc02b159b65c05f2ed9ec176b715b66918a674bd4daed48a9a7a590dd4be1aa + # via gestaoraul +werkzeug==3.1.3 \ + --hash=sha256:54b78bf3716d19a65be4fceccc0d1d7b89e608834989dfae50ea87564639213e \ + --hash=sha256:60723ce945c19328679790e3282cc758aa4a6040e4bb330f53d30fa546d44746 + # via gestaoraul +whitenoise==6.11.0 \ + --hash=sha256:0f5bfce6061ae6611cd9396a8231e088722e4fc67bc13a111be74c738d99375f \ + --hash=sha256:b2aeb45950597236f53b5342b3121c5de69c8da0109362aee506ce88e022d258 + # via gestaoraul diff --git a/gestaoRaul/requirements_freeze.txt b/gestaoRaul/requirements_freeze.txt new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/gestaoRaul/requirements_simple.txt similarity index 52% rename from requirements.txt rename to gestaoRaul/requirements_simple.txt index a837edf..e89879b 100644 --- a/requirements.txt +++ b/gestaoRaul/requirements_simple.txt @@ -1,21 +1,26 @@ -asarPy==1.0.1 +asarpy==1.0.1 asgiref==3.8.1 cffi==1.17.1 cryptography==44.0.0 -Django==5.1.4 +django==5.1.4 +django-cors-headers==4.9.0 django-extensions==3.2.3 django-pwa==2.0.1 +djangorestframework==3.16.1 +djangorestframework-simplejwt==5.5.1 dotenv==0.9.9 gunicorn==23.0.0 -MarkupSafe==3.0.2 +markupsafe==3.0.2 packaging==24.2 pillow==11.1.0 psycopg==3.2.6 pycparser==2.22 -pyOpenSSL==24.3.0 +pyjwt==2.11.0 +pyopenssl==24.3.0 python-dotenv==1.1.0 sqlparse==0.5.2 -typing_extensions==4.12.2 +typing-extensions==4.12.2 tzdata==2024.2 websockets==15.0 -Werkzeug==3.1.3 +werkzeug==3.1.3 +whitenoise==6.11.0 diff --git a/gestaoRaul/squarecloud.app b/gestaoRaul/squarecloud.app new file mode 100644 index 0000000..4dec696 --- /dev/null +++ b/gestaoRaul/squarecloud.app @@ -0,0 +1,7 @@ +DISPLAY_NAME=Gestao Raul API +DESCRIPTION=Sistema de Gestão para Restaurantes/Bares com API REST. +MAIN=gestaoRaul/wsgi.py +MEMORY=512 +VERSION=recommended +SUB_DOMAIN=gestao-raul # Escolha um subdomínio disponível +START=python manage.py collectstatic --noinput && python -m gunicorn gestaoRaul.wsgi:application --bind 0.0.0.0:80 --timeout 120 diff --git a/gestaoRaul/typePay/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/typePay/__pycache__/__init__.cpython-312.pyc index 952542d..679ea32 100644 Binary files a/gestaoRaul/typePay/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/typePay/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/typePay/__pycache__/admin.cpython-312.pyc b/gestaoRaul/typePay/__pycache__/admin.cpython-312.pyc index 54a442b..c484816 100644 Binary files a/gestaoRaul/typePay/__pycache__/admin.cpython-312.pyc and b/gestaoRaul/typePay/__pycache__/admin.cpython-312.pyc differ diff --git a/gestaoRaul/typePay/__pycache__/apps.cpython-312.pyc b/gestaoRaul/typePay/__pycache__/apps.cpython-312.pyc index a2d3a3c..9ab4167 100644 Binary files a/gestaoRaul/typePay/__pycache__/apps.cpython-312.pyc and b/gestaoRaul/typePay/__pycache__/apps.cpython-312.pyc differ diff --git a/gestaoRaul/typePay/__pycache__/models.cpython-312.pyc b/gestaoRaul/typePay/__pycache__/models.cpython-312.pyc index 2ecf71d..a590598 100644 Binary files a/gestaoRaul/typePay/__pycache__/models.cpython-312.pyc and b/gestaoRaul/typePay/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/typePay/__pycache__/urls.cpython-312.pyc b/gestaoRaul/typePay/__pycache__/urls.cpython-312.pyc index 75d6486..786edca 100644 Binary files a/gestaoRaul/typePay/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/typePay/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/typePay/__pycache__/views.cpython-312.pyc b/gestaoRaul/typePay/__pycache__/views.cpython-312.pyc index 53d9efd..4a4746b 100644 Binary files a/gestaoRaul/typePay/__pycache__/views.cpython-312.pyc and b/gestaoRaul/typePay/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/typePay/api_views.py b/gestaoRaul/typePay/api_views.py new file mode 100644 index 0000000..668199c --- /dev/null +++ b/gestaoRaul/typePay/api_views.py @@ -0,0 +1,8 @@ +from rest_framework import viewsets, permissions +from .models import TypePay +from .serializers import TypePaySerializer + +class TypePayViewSet(viewsets.ModelViewSet): + queryset = TypePay.objects.all() + serializer_class = TypePaySerializer + permission_classes = [permissions.IsAuthenticatedOrReadOnly] diff --git a/gestaoRaul/typePay/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestaoRaul/typePay/migrations/__pycache__/0001_initial.cpython-312.pyc index 7b5f046..d88c372 100644 Binary files a/gestaoRaul/typePay/migrations/__pycache__/0001_initial.cpython-312.pyc and b/gestaoRaul/typePay/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/gestaoRaul/typePay/migrations/__pycache__/__init__.cpython-312.pyc b/gestaoRaul/typePay/migrations/__pycache__/__init__.cpython-312.pyc index 3e250d1..29fec32 100644 Binary files a/gestaoRaul/typePay/migrations/__pycache__/__init__.cpython-312.pyc and b/gestaoRaul/typePay/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/gestaoRaul/typePay/serializers.py b/gestaoRaul/typePay/serializers.py new file mode 100644 index 0000000..0534adf --- /dev/null +++ b/gestaoRaul/typePay/serializers.py @@ -0,0 +1,7 @@ +from rest_framework import serializers +from .models import TypePay + +class TypePaySerializer(serializers.ModelSerializer): + class Meta: + model = TypePay + fields = '__all__' diff --git a/gestaoRaul/websocket_client/__pycache__/websocketClient.cpython-312.pyc b/gestaoRaul/websocket_client/__pycache__/websocketClient.cpython-312.pyc index a52d3e1..f9958fa 100644 Binary files a/gestaoRaul/websocket_client/__pycache__/websocketClient.cpython-312.pyc and b/gestaoRaul/websocket_client/__pycache__/websocketClient.cpython-312.pyc differ diff --git a/gestaoRaul1.zip b/gestaoRaul1.zip new file mode 100644 index 0000000..ec395e6 Binary files /dev/null and b/gestaoRaul1.zip differ