Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM-381: added validations columns in Individual Data Sources #42

Merged
merged 11 commits into from
Jan 19, 2024
6 changes: 0 additions & 6 deletions individual/gql_mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ def _validate_mutation(cls, user, **data):

@classmethod
def _mutate(cls, user, **data):
if "date_valid_to" not in data:
data['date_valid_to'] = None
if "client_mutation_id" in data:
data.pop('client_mutation_id')
if "client_mutation_label" in data:
Expand Down Expand Up @@ -173,8 +171,6 @@ def _validate_mutation(cls, user, **data):

@classmethod
def _mutate(cls, user, **data):
if "date_valid_to" not in data:
data['date_valid_to'] = None
if "client_mutation_id" in data:
data.pop('client_mutation_id')
if "client_mutation_label" in data:
Expand Down Expand Up @@ -258,8 +254,6 @@ def _validate_mutation(cls, user, **data):

@classmethod
def _mutate(cls, user, **data):
if "date_valid_to" not in data:
data['date_valid_to'] = None
if "client_mutation_id" in data:
data.pop('client_mutation_id')
if "client_mutation_label" in data:
Expand Down
21 changes: 0 additions & 21 deletions individual/migrations/0008_auto_20230724_1355.py

This file was deleted.

23 changes: 23 additions & 0 deletions individual/migrations/0008_auto_20240105_1527.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.19 on 2024-01-05 15:27

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('individual', '0007_auto_20230630_0950'),
]

operations = [
migrations.AddField(
model_name='historicalindividualdatasource',
name='validations',
field=models.JSONField(default=dict),
),
migrations.AddField(
model_name='individualdatasource',
name='validations',
field=models.JSONField(default=dict),
),
]
23 changes: 23 additions & 0 deletions individual/migrations/0009_auto_20240109_0953.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.19 on 2024-01-09 09:53

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('individual', '0008_auto_20240105_1527'),
]

operations = [
migrations.AlterField(
model_name='historicalindividualdatasourceupload',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('TRIGGERED', 'Triggered'), ('IN_PROGRESS', 'In progress'), ('SUCCESS', 'Success'), ('WAITING_FOR_VERIFICATION', 'WAITING_FOR_VERIFICATION'), ('FAIL', 'Fail')], default='PENDING', max_length=255),
),
migrations.AlterField(
model_name='individualdatasourceupload',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('TRIGGERED', 'Triggered'), ('IN_PROGRESS', 'In progress'), ('SUCCESS', 'Success'), ('WAITING_FOR_VERIFICATION', 'WAITING_FOR_VERIFICATION'), ('FAIL', 'Fail')], default='PENDING', max_length=255),
),
]
23 changes: 23 additions & 0 deletions individual/migrations/0010_auto_20240109_1140.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.19 on 2024-01-09 11:40

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('individual', '0009_auto_20240109_0953'),
]

operations = [
migrations.AlterField(
model_name='historicalindividualdatasourceupload',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('TRIGGERED', 'Triggered'), ('IN_PROGRESS', 'In progress'), ('SUCCESS', 'Success'), ('PARTIAL_SUCCESS', 'Partial Success'), ('WAITING_FOR_VERIFICATION', 'WAITING_FOR_VERIFICATION'), ('FAIL', 'Fail')], default='PENDING', max_length=255),
),
migrations.AlterField(
model_name='individualdatasourceupload',
name='status',
field=models.CharField(choices=[('PENDING', 'Pending'), ('TRIGGERED', 'Triggered'), ('IN_PROGRESS', 'In progress'), ('SUCCESS', 'Success'), ('PARTIAL_SUCCESS', 'Partial Success'), ('WAITING_FOR_VERIFICATION', 'WAITING_FOR_VERIFICATION'), ('FAIL', 'Fail')], default='PENDING', max_length=255),
),
]
6 changes: 6 additions & 0 deletions individual/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class Individual(HistoryModel):

json_ext = models.JSONField(db_column="Json_ext", default=dict)

def __str__(self):
return f'{self.first_name} {self.last_name}'

class Meta:
managed = True

Expand All @@ -23,6 +26,8 @@ class Status(models.TextChoices):
TRIGGERED = 'TRIGGERED', _('Triggered')
IN_PROGRESS = 'IN_PROGRESS', _('In progress')
SUCCESS = 'SUCCESS', _('Success')
PARTIAL_SUCCESS = 'PARTIAL_SUCCESS', _('Partial Success')
WAITING_FOR_VERIFICATION = 'WAITING_FOR_VERIFICATION', _('WAITING_FOR_VERIFICATION')
FAIL = 'FAIL', _('Fail')

source_name = models.CharField(max_length=255, null=False)
Expand All @@ -35,6 +40,7 @@ class Status(models.TextChoices):
class IndividualDataSource(HistoryModel):
individual = models.ForeignKey(Individual, models.DO_NOTHING, null=True)
upload = models.ForeignKey(IndividualDataSourceUpload, models.DO_NOTHING, null=True)
validations = models.JSONField(default=dict)


class Group(HistoryModel):
Expand Down
Loading