Skip to content

Commit

Permalink
Refactor support application and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DEENUU1 committed Dec 29, 2023
1 parent 6866b3a commit a41cbf6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 46 deletions.
15 changes: 0 additions & 15 deletions support/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ class Contact(models.Model):
def __str__(self):
return self.subject

@property
def is_new(self):
threshold_days = 1
return (timezone.now() - self.created_at) < timedelta(days=threshold_days)

@property
def is_expired(self):
threshold_days = 90
return (timezone.now() - self.created_at) > timedelta(days=threshold_days)

class Meta:
ordering = ['-created_at']
verbose_name = 'Contact'
Expand All @@ -43,11 +33,6 @@ class Report(models.Model):
def __str__(self):
return self.description

@property
def is_new(self):
threshold_days = 1
return (timezone.now() - self.created_at) < timedelta(days=threshold_days)

class Meta:
ordering = ['-created_at']
verbose_name = 'Report'
Expand Down
6 changes: 0 additions & 6 deletions support/serializers.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
from rest_framework import serializers
from rest_framework.serializers import ModelSerializer

from .models import Contact, Report


class ContactSerializer(ModelSerializer):
is_new = serializers.ReadOnlyField()
is_expired = serializers.ReadOnlyField()

class Meta:
model = Contact
fields = "__all__"


class ReportSerializer(ModelSerializer):
is_new = serializers.ReadOnlyField()

class Meta:
model = Report
fields = "__all__"
22 changes: 0 additions & 22 deletions support/task.py

This file was deleted.

3 changes: 0 additions & 3 deletions tests/test_support/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ def test_create_contact_success():
assert contact.message == "Test test"
assert contact.email == "[email protected]"
assert contact.reviewed == False
assert contact.is_new == True
assert contact.is_expired == False


@pytest.mark.django_db
Expand All @@ -33,4 +31,3 @@ def test_create_report_success(user_data):
assert report.user == user_data
assert report.offer == joboffer
assert report.description == "dasdasda"
assert report.is_new == True

0 comments on commit a41cbf6

Please sign in to comment.