Skip to content

Commit

Permalink
feat: add new fields to vtex integration
Browse files Browse the repository at this point in the history
  • Loading branch information
elitonzky committed Nov 13, 2024
1 parent e2d014e commit e55e6ce
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions retail/api/features/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class FeaturesView(BaseServiceView):
def get(self, request, project_uuid: str):
try:
category = request.query_params.get("category", None)
can_vtex_integrate = request.query_params.get("can_vtex_integrate", None)

integrated_features = IntegratedFeature.objects.filter(
project__uuid=project_uuid
Expand All @@ -26,11 +27,16 @@ def get(self, request, project_uuid: str):
for email in settings.EMAILS_CAN_TESTING:
if email in request.user.email:
can_testing = True

if not can_testing:
features = features.exclude(status="testing")

if category:
features = features.filter(category=category)

if can_vtex_integrate:
features = features.filter(can_vtex_integrate=can_vtex_integrate)

serializer = FeaturesSerializer(features, many=True)

usecase = RemoveGlobalsKeysUsecase(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 5.1.1 on 2024-11-13 13:02

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("features", "0014_feature_status_alter_featureversion_action_types"),
]

operations = [
migrations.AddField(
model_name="feature",
name="can_vtex_integrate",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="feature",
name="config",
field=models.JSONField(default=dict),
),
migrations.AddField(
model_name="integratedfeature",
name="created_by_vtex",
field=models.BooleanField(default=False),
),
]
4 changes: 4 additions & 0 deletions retail/features/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class Feature(models.Model):
blank=True
)

can_vtex_integrate = models.BooleanField(default=False)
config = models.JSONField(default=dict)

def __str__(self):
return self.name

Expand Down Expand Up @@ -139,6 +142,7 @@ class IntegratedFeature(models.Model):
User, on_delete=models.CASCADE, related_name="integrated_features"
)
integrated_on = models.DateField(auto_now_add=True)
created_by_vtex = models.BooleanField(default=False)

# def save(self, *args) -> None:
# self.feature = self.feature_version.feature
Expand Down

0 comments on commit e55e6ce

Please sign in to comment.