You've already forked Promocode-API
mirror of
https://github.com/devitq/Promocode-API.git
synced 2026-05-23 03:57:11 +00:00
feat: added promocode creation and view
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user