mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 09:16:49 +01:00
7546e3ea0a
* add description and tag fields to event and property definitions * set up description and tagging on models * frontend functionality for description editing * connect backend and kea logic for description editing * update event and property definitions model and migration * delete set null instead of cascade * migration merge fix * add owner column * undo posthog event property taxonomy migrations * set up definitions on enterprise level * allow enterprise definitions description editing * fix licensing conditions and add tests * proper get and update methods for the multi inheritance table and new column fields for enterprise event model * check for license to separate routes * migrate existing definitions to ee definitions tables and render ee vs non-ee definition views based on existing feature conditional * all the working backend updates * updated tests * frontend fixes and linting updates * feature flag it
29 lines
952 B
Python
29 lines
952 B
Python
from rest_framework import serializers
|
|
|
|
from ee.models.event_definition import EnterpriseEventDefinition
|
|
from posthog.api.shared import UserBasicSerializer
|
|
|
|
|
|
class EnterpriseEventDefinitionSerializer(serializers.ModelSerializer):
|
|
owner = UserBasicSerializer(read_only=True)
|
|
updated_by = UserBasicSerializer(read_only=False)
|
|
|
|
class Meta:
|
|
model = EnterpriseEventDefinition
|
|
fields = (
|
|
"id",
|
|
"name",
|
|
"owner",
|
|
"description",
|
|
"tags",
|
|
"volume_30_day",
|
|
"query_usage_30_day",
|
|
"updated_at",
|
|
"updated_by",
|
|
)
|
|
read_only_fields = ["id", "name", "updated_at", "volume_30_day", "query_usage_30_day"]
|
|
|
|
def update(self, event_definition: EnterpriseEventDefinition, validated_data):
|
|
validated_data["updated_by"] = self.context["request"].user
|
|
return super().update(event_definition, validated_data)
|