Skip to content

Commit

Permalink
adding a field to set when a feature are ready to go for production
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackson Barbosa committed Oct 4, 2024
1 parent 67b0bd8 commit 61789b0
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 3 deletions.
2 changes: 2 additions & 0 deletions retail/api/features/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def get(self, request, project_uuid: str):

features = Feature.objects.exclude(uuid__in=integrated_features)
features = features.exclude(feature_type="FUNCTION")
features = features.exclude(status="development")
features = features.exclude(status="testing")
if category:
features = features.filter(category=category)

Expand Down
5 changes: 4 additions & 1 deletion retail/features/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Meta:
"functions",
"documentation_url",
"disclaimer",
"status"
]

def __init__(self, *args, **kwargs):
Expand All @@ -43,8 +44,10 @@ def __init__(self, *args, **kwargs):
class FunctionForm(forms.ModelForm):
class Meta:
model = Feature
fields = ["name", "description", "category"]
fields = ["name", "description", "category", "status"]

def __init__(self, *args, **kwargs):
feature = kwargs.get("instance", None)
if feature and feature.feature_type == "FUNCTION":
functions = functions.exclude(uuid=feature.uuid)
super().__init__(*args, **kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Generated by Django 5.1.1 on 2024-10-04 20:31

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("features", "0013_featureversion_action_base_flow_name_and_more"),
]

operations = [
migrations.AddField(
model_name="feature",
name="status",
field=models.CharField(
blank=True,
choices=[
("development", "Development"),
("testing", "Testing"),
("ready", "Ready"),
],
default="development",
max_length=20,
null=True,
verbose_name="Status of feature",
),
),
migrations.AlterField(
model_name="featureversion",
name="action_types",
field=models.TextField(
blank=True,
choices=[
("PERSONALIZADO", "Personalizado"),
("VOLTAR AO MENU", "Voltar ao Menu"),
("INTERAÇÕES GERAIS", "Interações gerais"),
("CONFIGURAR COMUNICAÇÕES", "Configurar comunicações"),
("DESPEDIDA", "Despedida"),
("SAC/FALE CONOSCO", "SAC/Fale conosco"),
("INDIQUE E GANHE", "Indique e Ganhe"),
("TROCA E DEVOLUÇÃO", "Troca e Devolução"),
("STATUS DO PEDIDO", "Status do Pedido"),
("CUMPRIMENTOS", "Cumprimentos"),
("COMPRAS DE PRODUTOS", "Compras de Produtos"),
("TÓPICOS SENSÍVEIS", "Tópicos sensíveis"),
("MÍDIAS E LOCALIZAÇÃO", "Mídias e Localização"),
("ENVIO DE CARRINHO DO WHATSAPP", "Envio de Carrinho do Whatsapp"),
("CONTROLE DO AGENTE", "Controle do agente"),
],
default="PERSONALIZADO",
null=True,
),
),
]
23 changes: 21 additions & 2 deletions retail/features/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ class Feature(models.Model):

features_types_choices = [("FEATURE", "Feature"), ("FUNCTION", "Function")]
categories_choices = [("ACTIVE", "Active"), ("PASSIVE", "Passive")]

STATUS_CHOICES = [
('development', 'Development'),
('testing', 'Testing'),
('ready', 'Ready'),
]
created_on = models.DateTimeField(
"when are created the new feature", auto_now_add=True
)
Expand All @@ -29,6 +33,15 @@ class Feature(models.Model):
)
documentation_url = models.TextField(null=True)
disclaimer = models.TextField(null=True)

status = models.CharField(
max_length=20,
choices=STATUS_CHOICES,
default='development',
verbose_name='Status of feature',
null=True,
blank=True
)

def __str__(self):
return self.name
Expand All @@ -42,13 +55,19 @@ class FeatureVersion(models.Model):
ACTION_TYPES_CHOICES = [
("PERSONALIZADO", "Personalizado"),
("VOLTAR AO MENU", "Voltar ao Menu"),
("INTEGRAÇÕES GERAIS", "Interações gerais"),
("INTERAÇÕES GERAIS", "Interações gerais"),
("CONFIGURAR COMUNICAÇÕES", "Configurar comunicações"),
("DESPEDIDA", "Despedida"),
("SAC/FALE CONOSCO", "SAC/Fale conosco"),
("INDIQUE E GANHE", "Indique e Ganhe"),
("TROCA E DEVOLUÇÃO", "Troca e Devolução"),
("STATUS DO PEDIDO", "Status do Pedido"),
("CUMPRIMENTOS", "Cumprimentos"),
("COMPRAS DE PRODUTOS", "Compras de Produtos"),
("TÓPICOS SENSÍVEIS", "Tópicos sensíveis"),
("MÍDIAS E LOCALIZAÇÃO", "Mídias e Localização"),
("ENVIO DE CARRINHO DO WHATSAPP", "Envio de Carrinho do Whatsapp"),
("CONTROLE DO AGENTE", "Controle do agente"),
]

uuid = models.UUIDField(
Expand Down

0 comments on commit 61789b0

Please sign in to comment.