Skip to content

Commit

Permalink
feat: audit log de_minimis_aid creation
Browse files Browse the repository at this point in the history
  • Loading branch information
rikuke committed Jan 10, 2024
1 parent 69fe3e1 commit 153a9da
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion backend/benefit/applications/api/v1/serializers/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,8 @@ def assign_default_fields_from_company(self, application, company):

def _update_de_minimis_aid(self, application, de_minimis_data):
serializer = DeMinimisAidSerializer(data=de_minimis_data, many=True)
user = self.get_logged_in_user()

if not serializer.is_valid():
raise BenefitAPIException(
format_lazy(
Expand All @@ -1299,7 +1301,14 @@ def _update_de_minimis_aid(self, application, de_minimis_data):
aid_item[
"ordering"
] = idx # use the ordering defined in the JSON sent by the client
serializer.save()
de_minimis_list = serializer.save()
for de_minimis in de_minimis_list:
audit_logging.log(
user,
"",
Operation.CREATE,
de_minimis,
)

def get_logged_in_user(self):
return get_request_user_from_context(self)
Expand Down

0 comments on commit 153a9da

Please sign in to comment.