Skip to content

Commit e030dbb

Browse files
committed
Update database table
1 parent 7fd9d44 commit e030dbb

File tree

4 files changed

+42
-7
lines changed

4 files changed

+42
-7
lines changed

backend/api/orders/mutations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def create_order(
4343
is_business=input.invoice_information.is_business,
4444
defaults={
4545
"company_name": input.invoice_information.company,
46-
"user_name": input.invoice_information.name,
46+
"user_first_name": input.invoice_information.first_name,
47+
"user_last_name": input.invoice_information.last_name,
4748
"zip_code": input.invoice_information.zipcode,
4849
"city": input.invoice_information.city,
4950
"address": input.invoice_information.street,

backend/api/tests/schema/test_create_order.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ def test_calls_create_order(graphql_client, user, mocker, requests_mock, pretix_
157157

158158
billing_address = BillingAddress.objects.get(user=user)
159159

160-
assert billing_address.user_name == "Patrick"
160+
assert billing_address.user_first_name == "Patrick"
161+
assert billing_address.user_last_name == "Arminio"
161162
assert billing_address.company_name == ""
162163
assert not billing_address.is_business
163164
assert billing_address.address == "street"
@@ -234,7 +235,8 @@ def test_calls_create_order_doesnt_require_attendee_data_for_non_admission_produ
234235

235236
billing_address = BillingAddress.objects.get(user=user)
236237

237-
assert billing_address.user_name == "Patrick"
238+
assert billing_address.user_first_name == "Patrick"
239+
assert billing_address.user_last_name == "Arminio"
238240
assert billing_address.company_name == ""
239241
assert not billing_address.is_business
240242
assert billing_address.address == "street"
@@ -437,7 +439,8 @@ def test_invoice_validation_fails_without_required_field_in_country_italy(
437439

438440
@override_settings(FRONTEND_URL="http://test.it")
439441
@pytest.mark.parametrize(
440-
"field_to_delete", ["name", "street", "zipcode", "city", "country"]
442+
"field_to_delete",
443+
["firstName", "lastName", "street", "zipcode", "city", "country"],
441444
)
442445
def test_invoice_validation_fails_with_missing_required_fields(
443446
graphql_client, user, mocker, field_to_delete, requests_mock, pretix_items
@@ -1300,7 +1303,8 @@ def test_invoice_validation_works_when_not_italian_and_no_sdi(
13001303

13011304
billing_address = BillingAddress.objects.get(user=user)
13021305

1303-
assert billing_address.user_name == "Patrick"
1306+
assert billing_address.user_first_name == "Patrick"
1307+
assert billing_address.user_last_name == "Arminio"
13041308
assert billing_address.company_name == "LTD"
13051309
assert billing_address.is_business
13061310

@@ -1379,7 +1383,8 @@ def test_create_order_billing_address_stores_both_non_and_business(
13791383

13801384
billing_address = billing_addresses.get(is_business=True)
13811385

1382-
assert billing_address.user_name == "Patrick"
1386+
assert billing_address.user_first_name == "Patrick"
1387+
assert billing_address.user_last_name == "Arminio"
13831388
assert billing_address.company_name == "LTD"
13841389
assert billing_address.is_business
13851390

@@ -1453,6 +1458,7 @@ def test_create_order_updates_billing_address(
14531458
billing_address = BillingAddress.objects.get(user=user)
14541459

14551460
assert billing_address.id == existing_billing_address.id
1456-
assert billing_address.user_name == "Patrick"
1461+
assert billing_address.user_first_name == "Patrick"
1462+
assert billing_address.user_last_name == "Arminio"
14571463
assert billing_address.company_name == "LTD"
14581464
assert billing_address.is_business
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generated by Django 5.1.4 on 2025-03-11 22:28
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('billing', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='billingaddress',
15+
name='user_first_name',
16+
field=models.TextField(default='', verbose_name='user first name'),
17+
preserve_default=False,
18+
),
19+
migrations.AddField(
20+
model_name='billingaddress',
21+
name='user_last_name',
22+
field=models.TextField(default='', verbose_name='user last name'),
23+
preserve_default=False,
24+
),
25+
]

backend/billing/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ class BillingAddress(TimeStampedModel):
2323
)
2424
is_business = models.BooleanField(_("is business"))
2525
company_name = models.TextField(_("company name"), blank=True)
26+
# TODO: delete this in future
2627
user_name = models.TextField(_("user name"))
28+
user_first_name = models.TextField(_("user first name"))
29+
user_last_name = models.TextField(_("user last name"))
2730
zip_code = models.TextField(_("zip code"))
2831
city = models.TextField(_("city"))
2932
address = models.TextField(_("address"))

0 commit comments

Comments
 (0)