Skip to content

Commit

Permalink
chore: add flavour fields to security questions
Browse files Browse the repository at this point in the history
Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>
  • Loading branch information
maxwellgithinji authored and KathurimaKimathi committed Nov 16, 2021
1 parent 88b5d77 commit f25d52a
Show file tree
Hide file tree
Showing 5 changed files with 25,681 additions and 11,183 deletions.
23 changes: 23 additions & 0 deletions mycarehub/clients/migrations/0008_auto_20211116_0945.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.9 on 2021-11-16 06:45

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('clients', '0007_auto_20211110_0453'),
]

operations = [
migrations.AddField(
model_name='securityquestion',
name='flavour',
field=models.CharField(choices=[('PRO', 'PRO'), ('CONSUMER', 'CONSUMER')], max_length=32, null=True),
),
migrations.AddField(
model_name='securityquestionresponse',
name='flavour',
field=models.CharField(choices=[('PRO', 'PRO'), ('CONSUMER', 'CONSUMER')], max_length=32, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.9 on 2021-11-16 09:33

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('clients', '0008_auto_20211116_0945'),
]

operations = [
migrations.RemoveField(
model_name='securityquestionresponse',
name='flavour',
),
]
7 changes: 7 additions & 0 deletions mycarehub/clients/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
from mycarehub.users.models import GenderChoices


class FlavourChoices(TextChoices):
PRO = "PRO", _("PRO")
CONSUMER = "CONSUMER", _("CONSUMER")


class Identifier(AbstractBase):
class IdentifierType(models.TextChoices):
CCC = "CCC", _("Comprehensive Care Clinic Number")
Expand Down Expand Up @@ -47,9 +52,11 @@ class ResponseType(models.TextChoices):
description = models.TextField()
sequence = models.IntegerField(default=0)
response_type = models.CharField(max_length=32, choices=ResponseType.choices)
flavour = models.CharField(choices=FlavourChoices.choices, max_length=32, null=True)


class SecurityQuestionResponse(AbstractBase):

user = models.ForeignKey(get_user_model(), on_delete=models.PROTECT)
question = models.ForeignKey(SecurityQuestion, on_delete=models.PROTECT)
timestamp = models.DateTimeField(default=timezone.now)
Expand Down
3 changes: 3 additions & 0 deletions mycarehub/clients/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def setUp(self):
stem=fake.text(),
description=fake.text(),
organisation=self.global_organisation,
flavour="CONSUMER",
)
self.data = {
"identifier_type": "NATIONAL_ID",
Expand All @@ -66,6 +67,7 @@ def setUp(self):
"sequence": random.randint(1, 999_999),
"response_type": "TEXT",
"organisation": self.global_organisation.pk,
"flavour": "CONSUMER",
}
self.detail_url = reverse(self.url_detail_base, kwargs={"pk": self.instance.pk})
super().setUp()
Expand All @@ -82,6 +84,7 @@ def setUp(self):
stem=fake.text(),
description=fake.text(),
organisation=self.global_organisation,
flavour="CONSUMER",
)
self.instance = baker.make(
SecurityQuestionResponse,
Expand Down

0 comments on commit f25d52a

Please sign in to comment.