DRY-up and enforce kwargs for most events

For most events this makes the purpose of each argument clearer at
the point the event is called. It's still worth having a function
for each event type, as this abstracts knowledge of the event label.
Using a schema approach will make adding new events easier.

In the next commit we'll DRY-up the duplication in the tests as well.
This commit is contained in:
Ben Thorner
2021-07-12 15:29:53 +01:00
parent cfe022bc7f
commit 22ac1bfcae
7 changed files with 100 additions and 96 deletions

View File

@@ -44,7 +44,7 @@ def archive_user(user_id):
flash('User cant be removed from a service - '
'check all services have another team member with manage_settings')
return redirect(url_for('main.user_information', user_id=user_id))
create_archive_user_event(str(user_id), current_user.id)
create_archive_user_event(user_id=str(user_id), archived_by_id=current_user.id)
return redirect(url_for('.user_information', user_id=user_id))
else: