From 7b9ccdd27b2fc1072e39459067f17901268328eb Mon Sep 17 00:00:00 2001 From: Luiz Eduardo Date: Thu, 12 Feb 2026 09:06:01 -0300 Subject: [PATCH 1/3] fix: correct ordering by excluding null start_time runs #983 Adiciona filtro na query GraphQL `LastTwoCompletedRunsWithTasks` para garantir que apenas `flow_runs` com `start_time` diferente de `null` sejam retornadas. --- .../commands/_disable_unhealthy_flow_schedules/constants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/apps/core/management/commands/_disable_unhealthy_flow_schedules/constants.py b/backend/apps/core/management/commands/_disable_unhealthy_flow_schedules/constants.py index 8c70e9d8..babe2967 100644 --- a/backend/apps/core/management/commands/_disable_unhealthy_flow_schedules/constants.py +++ b/backend/apps/core/management/commands/_disable_unhealthy_flow_schedules/constants.py @@ -29,6 +29,7 @@ class Querys(Enum): where: { flow_id: { _eq: $flow_id } state: { _in: ["Success", "Failed"] } + start_time: { _is_null: false } } order_by: { start_time: desc } limit: 2 From 5eae7680e06333099f7568604377e788f81d1656 Mon Sep 17 00:00:00 2001 From: vrtornisiello Date: Thu, 12 Feb 2026 14:02:43 -0300 Subject: [PATCH 2/3] feat: add user UUID to JWT token payload --- backend/custom/graphql_jwt.py | 17 +++++++++++++++++ backend/settings/base.py | 1 + 2 files changed, 18 insertions(+) diff --git a/backend/custom/graphql_jwt.py b/backend/custom/graphql_jwt.py index 2974a298..642b7331 100644 --- a/backend/custom/graphql_jwt.py +++ b/backend/custom/graphql_jwt.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from functools import wraps from re import findall +from typing import Any from django.db.models import Q from graphene import Field, ObjectType, String @@ -9,6 +10,22 @@ from graphql_jwt.decorators import context from graphql_jwt.relay import JSONWebTokenMutation from graphql_jwt.settings import jwt_settings +from graphql_jwt.utils import jwt_payload + + +def jwt_payload_with_uuid(user, context=None) -> dict[str, Any]: + """Custom JWT payload handler that adds the user's UUID to the token payload. + + Args: + user (Account): An instance of backend.apps.account.models.Account + context (Any, optional): Django request context. Defaults to None. + + Returns: + dict[str, Any]: JWT token payload with the user's UUID included. + """ + payload = jwt_payload(user, context) + payload["uuid"] = str(user.uuid) + return payload class User(ObjectType): diff --git a/backend/settings/base.py b/backend/settings/base.py index 55c0e81c..5397ff0f 100644 --- a/backend/settings/base.py +++ b/backend/settings/base.py @@ -200,6 +200,7 @@ "JWT_EXPIRATION_DELTA": timedelta(days=7), "JWT_REFRESH_EXPIRATION_DELTA": timedelta(days=14), "JWT_ALLOW_ANY_HANDLER": "backend.custom.graphql_jwt.allow_any", + "JWT_PAYLOAD_HANDLER": "backend.custom.graphql_jwt.jwt_payload_with_uuid", } # Translations From d5f4cf35fe98b9b3c7f2e85955dddc2843c726f5 Mon Sep 17 00:00:00 2001 From: vrtornisiello Date: Thu, 12 Feb 2026 14:12:22 -0300 Subject: [PATCH 3/3] feat: add unique constraint to Account model's uuid field --- .../migrations/0028_alter_account_uuid.py | 20 +++++++++++++++++++ backend/apps/account/models.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 backend/apps/account/migrations/0028_alter_account_uuid.py diff --git a/backend/apps/account/migrations/0028_alter_account_uuid.py b/backend/apps/account/migrations/0028_alter_account_uuid.py new file mode 100644 index 00000000..ce80a724 --- /dev/null +++ b/backend/apps/account/migrations/0028_alter_account_uuid.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 4.2.10 on 2026-02-12 15:03 + +import uuid + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("account", "0027_rename_has_access_to_chatbot_account_has_chatbot_access"), + ] + + operations = [ + migrations.AlterField( + model_name="account", + name="uuid", + field=models.UUIDField(default=uuid.uuid4, unique=True), + ), + ] diff --git a/backend/apps/account/models.py b/backend/apps/account/models.py index 33a3d05c..7bd1dbbc 100644 --- a/backend/apps/account/models.py +++ b/backend/apps/account/models.py @@ -208,7 +208,7 @@ class Account(BaseModel, AbstractBaseUser, PermissionsMixin): (COLABORADOR, "Colaborador"), ) - uuid = models.UUIDField(primary_key=False, default=uuid4) + uuid = models.UUIDField(primary_key=False, default=uuid4, unique=True) email = models.EmailField("Email", unique=True) gcp_email = models.EmailField("GCP email", null=True, blank=True) # Google Cloud Platform email