feat: added promocode creation and view

This commit is contained in:
ITQ
2025-01-21 18:44:45 +03:00
parent 36275caf40
commit 5ff66261c3
22 changed files with 813 additions and 56 deletions
+5 -1
View File
@@ -1,7 +1,10 @@
from datetime import timedelta
import jwt
from django.conf import settings
from django.core.validators import MinLengthValidator, RegexValidator
from django.db import models
from django.utils import timezone
from apps.core.models import BaseModel
@@ -17,7 +20,7 @@ class Business(BaseModel):
max_length=60,
validators=[
RegexValidator(
r"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$"
r"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$",
),
],
)
@@ -31,6 +34,7 @@ class Business(BaseModel):
{
"business_id": str(self.id),
"token_version": self.token_version,
"exp": timezone.now() + timedelta(hours=24),
},
settings.SECRET_KEY,
algorithm="HS256",