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

feature/add-consent-data-to-contact-index #5792

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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