refactor: remove support contact fields from SupplierProfile and restrict CORS allowed origins
Some checks failed
Deploy Beta (NATIVE) / deploy (push) Failing after 26s
Some checks failed
Deploy Beta (NATIVE) / deploy (push) Failing after 26s
This commit is contained in:
parent
3f369c7eb5
commit
7949cc2d36
5 changed files with 27 additions and 9 deletions
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Generated by Django 6.1 on 2026-09-05 10:32
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('api', '0007_sellerkyc_pan_aadhaar_linked_sellerkyc_pan_dob_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='supplierprofile',
|
||||||
|
name='support_email',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='supplierprofile',
|
||||||
|
name='support_phone',
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -31,8 +31,6 @@ class SupplierProfile(models.Model):
|
||||||
is_gstin_verified = models.BooleanField(default=False)
|
is_gstin_verified = models.BooleanField(default=False)
|
||||||
business_type = models.CharField(max_length=50, choices=BUSINESS_TYPE_CHOICES, blank=True, null=True)
|
business_type = models.CharField(max_length=50, choices=BUSINESS_TYPE_CHOICES, blank=True, null=True)
|
||||||
store_slug = models.SlugField(max_length=255, unique=True, blank=True, null=True)
|
store_slug = models.SlugField(max_length=255, unique=True, blank=True, null=True)
|
||||||
support_email = models.EmailField(blank=True, null=True)
|
|
||||||
support_phone = models.CharField(max_length=20, blank=True, null=True)
|
|
||||||
categories = models.ManyToManyField(Category, blank=True, related_name='suppliers')
|
categories = models.ManyToManyField(Category, blank=True, related_name='suppliers')
|
||||||
aadhar_file = models.CharField(max_length=255, blank=True, null=True) # retaining old files or S3 keys
|
aadhar_file = models.CharField(max_length=255, blank=True, null=True) # retaining old files or S3 keys
|
||||||
pan_file = models.CharField(max_length=255, blank=True, null=True)
|
pan_file = models.CharField(max_length=255, blank=True, null=True)
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,6 @@ def test_profile_update(api_client, create_user):
|
||||||
'logo_s3_key': 'suppliers/1/logo.jpg',
|
'logo_s3_key': 'suppliers/1/logo.jpg',
|
||||||
'business_type': 'individual_maker',
|
'business_type': 'individual_maker',
|
||||||
'store_slug': 'new-artisan-handloom',
|
'store_slug': 'new-artisan-handloom',
|
||||||
'support_email': 'support@newartisan.com',
|
|
||||||
'support_phone': '+919999988888',
|
|
||||||
'categories': ['Sustainable Products', 'Home Decor']
|
'categories': ['Sustainable Products', 'Home Decor']
|
||||||
}
|
}
|
||||||
response = api_client.put(url, data, format='json')
|
response = api_client.put(url, data, format='json')
|
||||||
|
|
@ -97,8 +95,6 @@ def test_profile_update(api_client, create_user):
|
||||||
assert create_user.profile.is_gstin_verified is True
|
assert create_user.profile.is_gstin_verified is True
|
||||||
assert create_user.profile.business_type == 'individual_maker'
|
assert create_user.profile.business_type == 'individual_maker'
|
||||||
assert create_user.profile.store_slug == 'new-artisan-handloom'
|
assert create_user.profile.store_slug == 'new-artisan-handloom'
|
||||||
assert create_user.profile.support_email == 'support@newartisan.com'
|
|
||||||
assert create_user.profile.support_phone == '+919999988888'
|
|
||||||
assert set(create_user.profile.categories.values_list('name', flat=True)) == {'Sustainable Products', 'Home Decor'}
|
assert set(create_user.profile.categories.values_list('name', flat=True)) == {'Sustainable Products', 'Home Decor'}
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
|
|
||||||
|
|
@ -207,8 +207,6 @@ class ProfileView(APIView):
|
||||||
profile.is_gstin_verified = request.data.get('is_gstin_verified', profile.is_gstin_verified)
|
profile.is_gstin_verified = request.data.get('is_gstin_verified', profile.is_gstin_verified)
|
||||||
profile.business_type = request.data.get('business_type', profile.business_type)
|
profile.business_type = request.data.get('business_type', profile.business_type)
|
||||||
profile.store_slug = request.data.get('store_slug', profile.store_slug)
|
profile.store_slug = request.data.get('store_slug', profile.store_slug)
|
||||||
profile.support_email = request.data.get('support_email', profile.support_email)
|
|
||||||
profile.support_phone = request.data.get('support_phone', profile.support_phone)
|
|
||||||
|
|
||||||
categories_data = request.data.get('categories')
|
categories_data = request.data.get('categories')
|
||||||
if categories_data is not None:
|
if categories_data is not None:
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,12 @@ MIDDLEWARE = [
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
CORS_ALLOW_ALL_ORIGINS = True
|
# CORS_ALLOW_ALL_ORIGINS = True
|
||||||
|
CORS_ALLOWED_ORIGINS = [
|
||||||
|
'http://localhost:5173', # Vite local dev
|
||||||
|
'http://127.0.0.1:5173', # Vite local dev
|
||||||
|
'https://d1zlxfmkt834bg.cloudfront.net', # CloudFront betasupplier site
|
||||||
|
]
|
||||||
CORS_ALLOW_CREDENTIALS = True
|
CORS_ALLOW_CREDENTIALS = True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue