Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove creator field from gift card model

fowczarekf2456f9837fa
diff --git a/saleor/giftcard/models.py b/saleor/giftcard/models.py
index 58976fb8d9..89c8911562 100644
--- a/saleor/giftcard/models.py
+++ b/saleor/giftcard/models.py
@@ -25,9 +25,6 @@ class GiftCard(models.Model):
on_delete=models.SET_NULL,
related_name="gift_cards",
)
- creator = models.ForeignKey(
- settings.AUTH_USER_MODEL, blank=True, null=True, on_delete=models.SET_NULL
- )
created = models.DateTimeField(auto_now_add=True)
start_date = models.DateField(default=date.today)
end_date = models.DateField(null=True, blank=True)
diff --git a/saleor/graphql/giftcard/mutations.py b/saleor/graphql/giftcard/mutations.py
index 0fef283124..07ea02421a 100644
--- a/saleor/graphql/giftcard/mutations.py
+++ b/saleor/graphql/giftcard/mutations.py
@@ -58,11 +58,6 @@ class GiftCardCreate(ModelMutation):
)
return cleaned_input
- @classmethod
- def save(cls, info, instance, cleaned_input):
- instance.creator = info.context.user
- super().save(info, instance, cleaned_input)
-
class GiftCardUpdate(GiftCardCreate):
class Arguments:
diff --git a/saleor/graphql/giftcard/types.py b/saleor/graphql/giftcard/types.py
index 893269f7d4..39857cd36d 100644
--- a/saleor/graphql/giftcard/types.py
+++ b/saleor/graphql/giftcard/types.py
@@ -15,10 +15,6 @@ class GiftCard(CountableDjangoObjectType):
"saleor.graphql.account.types.User",
description="The customer who bought a gift card.",
)
- creator = graphene.Field(
- "saleor.graphql.account.types.User",
- description="The staff who created a gift card.",
- )
class Meta:
description = dedent(
@@ -30,7 +26,6 @@ class GiftCard(CountableDjangoObjectType):
only_fields = [
"code",
"buyer",
- "creator",
"created",
"start_date",
"end_date",
@@ -48,7 +43,3 @@ class GiftCard(CountableDjangoObjectType):
@permission_required("giftcard.manage_gift_card")
def resolve_buyer(self, _info):
return self.buyer
-
- @permission_required("giftcard.manage_gift_card")
- def resolve_creator(self, _info):
- return self.creator
diff --git a/tests/api/test_gift_card.py b/tests/api/test_gift_card.py
index 4562c837bb..0caa260693 100644
--- a/tests/api/test_gift_card.py
+++ b/tests/api/test_gift_card.py
@@ -141,9 +141,6 @@ mutation giftCardCreate(
buyer {
email
}
- creator {
- email
- }
created
startDate
endDate
@@ -180,7 +177,6 @@ def test_create_gift_card(staff_api_client, customer_user, permission_manage_gif
data = content["data"]["giftCardCreate"]["giftCard"]
assert data["code"] == code
assert data["buyer"]["email"] == customer_user.email
- assert data["creator"]["email"] == staff_api_client.user.email
assert data["startDate"] == start_date.isoformat()
assert data["endDate"] == end_date.isoformat()
assert not data["lastUsedOn"]
diff --git a/tests/conftest.py b/tests/conftest.py
index cd38ce70d5..275313a470 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -630,7 +630,6 @@ def gift_card(customer_user, staff_user):
buyer=customer_user,
initial_balance=10,
current_balance=10,
- creator=staff_user,
)
@@ -640,14 +639,13 @@ def gift_card_used(staff_user):
code="used_gift_card",
initial_balance=150,
current_balance=100,
- creator=staff_user,
)
@pytest.fixture
def gift_card_created_by_staff(staff_user):
return GiftCard.objects.create(
- code="mirumee_staff", creator=staff_user, initial_balance=5, current_balance=5
+ code="mirumee_staff", initial_balance=5, current_balance=5
)