# Path: api_v3/models/review.py
# class Review(models.Model):
#     """Ticket review model."""
# 
#     MAX_DAYS_TO_RESPOND = 7
# 
#     RATINGS = (
#         (-1, 'No'),
#         (0, 'Neutral'),
#         (1, 'Yes')
#     )
# 
#     ticket = models.ForeignKey(
#         Ticket, blank=False, related_name='reviews', db_index=True,
#         on_delete=models.DO_NOTHING)
# 
#     rating = models.IntegerField(
#         default=RATINGS[1][0], choices=RATINGS, db_index=True)
#     link = models.CharField(max_length=255, blank=False, null=True)
#     body = BleachField(blank=False)
#     created_at = models.DateTimeField(auto_now_add=True)
# 
#     @classmethod
#     def ticket_to_token(cls, ticket):
#         """Generates an expiring JWT token with the ticket ID."""
#         return jwt.encode(
#             {
#                 'sub': ticket.id,
#                 'exp': (
#                     datetime.utcnow() +
#                     timedelta(days=cls.MAX_DAYS_TO_RESPOND)
#                 )
#             },
#             settings.SECRET_KEY,
#             algorithm='HS256'
#         )
# 
#     @classmethod
#     def ticket_from_token(cls, token):
#         """Extracts the ticket ID from a valid JWT token."""
#         if token is None or token == '':
#             return None
# 
#         try:
#             payload = jwt.decode(
#                 token, settings.SECRET_KEY, algorithms=['HS256'])
# 
#             return Ticket.objects.get(id=payload.get('sub'))
#         except jwt.ExpiredSignatureError:
#             return None


from api_v3.models import Review
from django.db import migrations, models
import django.db.models.deletion
import django_bleach.models
# Generated by Django 3.2.4 on 2021-07-06 14:22



class Migration(migrations.Migration):

    dependencies = [
        ('api_v3', '0014_change_ticket_column_limits'),

# Path: api_v3/models/review.py
# class Review(models.Model):
#     """Ticket review model."""
# 
#     MAX_DAYS_TO_RESPOND = 7
# 
#     RATINGS = (
#         (-1, 'No'),
#         (0, 'Neutral'),
#         (1, 'Yes')
#     )
# 
#     ticket = models.ForeignKey(
#         Ticket, blank=False, related_name='reviews', db_index=True,
#         on_delete=models.DO_NOTHING)
# 
#     rating = models.IntegerField(
#         default=RATINGS[1][0], choices=RATINGS, db_index=True)
#     link = models.CharField(max_length=255, blank=False, null=True)
#     body = BleachField(blank=False)
#     created_at = models.DateTimeField(auto_now_add=True)
# 
#     @classmethod
#     def ticket_to_token(cls, ticket):
#         """Generates an expiring JWT token with the ticket ID."""
#         return jwt.encode(
#             {
#                 'sub': ticket.id,
#                 'exp': (
#                     datetime.utcnow() +
#                     timedelta(days=cls.MAX_DAYS_TO_RESPOND)
#                 )
#             },
#             settings.SECRET_KEY,
#             algorithm='HS256'
#         )
# 
#     @classmethod
#     def ticket_from_token(cls, token):
#         """Extracts the ticket ID from a valid JWT token."""
#         if token is None or token == '':
#             return None
# 
#         try:
#             payload = jwt.decode(
#                 token, settings.SECRET_KEY, algorithms=['HS256'])
# 
#             return Ticket.objects.get(id=payload.get('sub'))
#         except jwt.ExpiredSignatureError:
#             return None


# Path: api_v3/migrations/0015_added_reviews.py
from api_v3.models import Review
from django.db import migrations, models
import django.db.models.deletion
import django_bleach.models

# Generated by Django 3.2.4 on 2021-07-06 14:22



class Migration(migrations.Migration):

    dependencies = [
        ('api_v3', '0014_change_ticket_column_limits'),

    ]