Skip to content

Commit

Permalink
Add consent last modified to contact index
Browse files Browse the repository at this point in the history
  • Loading branch information
chopkinsmade committed Nov 15, 2024
1 parent 17a6a1a commit 2a4ed2b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions datahub/search/contact/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Contact(BaseSearchModel):
full_telephone_number = Keyword()
title = fields.id_name_field()
valid_email = Boolean()
consent_data_last_modified = Date()

MAPPINGS = {
'adviser': dict_utils.contact_or_adviser_dict,
Expand Down
1 change: 1 addition & 0 deletions datahub/search/contact/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class SearchContactQuerySerializer(EntitySearchQuerySerializer):
created_by = SingleOrListField(child=StringUUIDField(), required=False)
created_on_exists = serializers.BooleanField(required=False)
valid_email = serializers.BooleanField(required=False)
consent_data_last_modified = serializers.DateTimeField(required=False)

SORT_BY_FIELDS = (
'address_country.name',
Expand Down
1 change: 1 addition & 0 deletions datahub/search/contact/test/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test_contact_dbmodel_to_dict(opensearch):
'title',
'company',
'created_on',
'consent_data_last_modified',
'created_by',
'modified_on',
'archived',
Expand Down
3 changes: 3 additions & 0 deletions datahub/search/contact/test/test_opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def test_mapping(opensearch):
},
'type': 'object',
},
'consent_data_last_modified': {
'type': 'date',
},
'created_by': {
'properties': {
'dit_team': {
Expand Down
3 changes: 3 additions & 0 deletions fixtures/test_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@
modified_on: "2018-06-05T00:00:00Z"
archived_documents_url_path: "/documents/123"
consent_data: [{"source_system": "System A", "consent_domain": "Domestic", "email_contact_consent": true, "telephone_contact_consent": false}]
consent_data_last_modified: "2024-09-09T14:10:00"

- model: company.contact
pk: 1430e18a-52ac-4185-b71d-b2be5a771fd0
Expand All @@ -642,6 +643,8 @@
notes: This is a dummy contact for testing
created_on: "2018-02-28T15:00:00Z"
modified_on: "2018-06-05T00:00:00Z"
consent_data: [{"source_system": "System B", "consent_domain": "International", "email_contact_consent": false, "telephone_contact_consent": false}]
consent_data_last_modified: "2023-09-09T14:10:00"

- model: company_referral.companyreferral
pk: 02e4cce0-caf5-4eb8-8d6d-ebdd69a6545b
Expand Down

0 comments on commit 2a4ed2b

Please sign in to comment.