Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new fields to vtex integration #68

Merged
merged 17 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading