mirror of
https://github.com/suitenumerique/docs.git
synced 2026-09-27 20:15:01 +02:00
📈(backend) capture an event when a document is imported
We want to capture an event when a file is imported. We add in the properties the type of file imported and if it is in the create-for-owner api call.
This commit is contained in:
@@ -755,6 +755,12 @@ class DocumentViewSet(
|
||||
serializer.validated_data["content"] = converted_content
|
||||
serializer.validated_data["title"] = uploaded_file.name
|
||||
logger.info("conversion ended successfully")
|
||||
|
||||
posthog_capture(
|
||||
PosthogEventName.DOC_IMPORTED,
|
||||
self.request.user,
|
||||
{"content_type": uploaded_file.content_type},
|
||||
)
|
||||
except ConversionError as err:
|
||||
logger.error("could not convert file content with error: %s", err)
|
||||
raise drf.exceptions.ValidationError(
|
||||
|
||||
Reference in New Issue
Block a user