Skip to content

Commit

Permalink
Add audit log field to RetrieveEYBLeadSerializer
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverjwroberts committed Feb 18, 2025
1 parent b1b3a25 commit b55e2b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion datahub/investment_lead/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rest_framework import serializers

from datahub.company.models import Company
from datahub.core.audit import AuditLogField
from datahub.core.serializers import (
AddressSerializer,
NestedRelatedField,
Expand Down Expand Up @@ -497,7 +498,7 @@ class Meta(BaseEYBLeadSerializer.Meta):
fields = [
f for f in ALL_FIELDS
if f not in ADDRESS_FIELDS
] + ['address', 'investment_projects']
] + ['address', 'investment_projects', 'audit_log']

sector = NestedRelatedField(Sector)
proposed_investment_region = NestedRelatedField(UKRegion)
Expand All @@ -507,6 +508,7 @@ class Meta(BaseEYBLeadSerializer.Meta):
)
company = NestedRelatedField(Company)
investment_projects = NestedRelatedField(InvestmentProject, many=True)
audit_log = AuditLogField(read_only=True)

def get_related_fields_representation(self, instance):
"""Provides related fields in a representation-friendly format."""
Expand Down
3 changes: 3 additions & 0 deletions datahub/investment_lead/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ def assert_retrieved_eyb_lead_data(instance: EYBLead, data: dict):
assert instance.utm_content == data.get('utm_content')
assert instance.marketing_hashed_uuid == data.get('marketing_hashed_uuid')

# Audit log
assert 'audit_log' in data.keys()


def assert_eyb_lead_matches_company(company: Company, eyb_lead: EYBLead):
assert eyb_lead.duns_number == company.duns_number
Expand Down

0 comments on commit b55e2b3

Please sign in to comment.