0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/ee/api/ee_property_definition.py

30 lines
1.0 KiB
Python
Raw Normal View History

from rest_framework import serializers
from ee.models.property_definition import EnterprisePropertyDefinition
from posthog.api.shared import UserBasicSerializer
from posthog.api.tagged_item import TaggedItemSerializerMixin
class EnterprisePropertyDefinitionSerializer(TaggedItemSerializerMixin, serializers.ModelSerializer):
updated_by = UserBasicSerializer(read_only=True)
class Meta:
model = EnterprisePropertyDefinition
fields = (
"id",
"name",
"description",
"tags",
"is_numerical",
"updated_at",
"updated_by",
"query_usage_30_day",
Event properties in filter (#7718) * create event property model * add null * rename cache vars * update event properties table on ingestion * match date formats * match date formats * better string handling * property type can be null too * pass event timestamp * update property type later * perform all updates through a buffer object * move to EventPropertyCounter * fix migration * improve flush last seen at job * flush job periodically + env * upsert all event properties in 1 query * log to statsd * enable property counter only if experimental mode enabled * use now() instead of event timestamp * fix seconds * add user/pass for default postgres * add tests * use big integers * make query work with 50k props * processing events saves event properties * fix script * test date format detection * default enabled * only enable event property counter for specific teams * eslint fixes * fix logs double-sync noise in tests * fix bigint test * don't do tasks that make no sense * remove dead code * proof of concept * remove old <PropertyFilter> component * change import paths * event properties sorted by event names * get event names from actions if used * scope event property filters by event names * fix eslint * simpler test setup * different contraint name * refactor team manager * greatly simplify the system * fetch cached event properties * fix team manager and timestamps * add cached entry * also don't cache event properties for teams that have it disabled * remove indexes that are not going to be used * remove unused imports * blacked * remember event properties with a LRU cache * fix eslint * clean up the last bits * remove fields we no longer have * add some instrumentation to figure out what services we can connect to (helps debug errors locally with kafka) * Update frontend/src/types.ts Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com> * merge duplicate code * use the right prop for event names * mute unseen events, add info icon * use the event-property tracker also for non-EE clients * simplify duplicates * add test for event properties * add test for non-EE event properties * add flag * revert the label and unmute the text * change the flag to UNSEEN_EVENT_PROPERTIES * sort by query_usage_30_day again * Update frontend/src/types.ts Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com> * use None if no event_names * fix type * improve pagination test Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-12-21 17:27:12 +01:00
"is_event_property",
"property_type",
)
Event properties in filter (#7718) * create event property model * add null * rename cache vars * update event properties table on ingestion * match date formats * match date formats * better string handling * property type can be null too * pass event timestamp * update property type later * perform all updates through a buffer object * move to EventPropertyCounter * fix migration * improve flush last seen at job * flush job periodically + env * upsert all event properties in 1 query * log to statsd * enable property counter only if experimental mode enabled * use now() instead of event timestamp * fix seconds * add user/pass for default postgres * add tests * use big integers * make query work with 50k props * processing events saves event properties * fix script * test date format detection * default enabled * only enable event property counter for specific teams * eslint fixes * fix logs double-sync noise in tests * fix bigint test * don't do tasks that make no sense * remove dead code * proof of concept * remove old <PropertyFilter> component * change import paths * event properties sorted by event names * get event names from actions if used * scope event property filters by event names * fix eslint * simpler test setup * different contraint name * refactor team manager * greatly simplify the system * fetch cached event properties * fix team manager and timestamps * add cached entry * also don't cache event properties for teams that have it disabled * remove indexes that are not going to be used * remove unused imports * blacked * remember event properties with a LRU cache * fix eslint * clean up the last bits * remove fields we no longer have * add some instrumentation to figure out what services we can connect to (helps debug errors locally with kafka) * Update frontend/src/types.ts Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com> * merge duplicate code * use the right prop for event names * mute unseen events, add info icon * use the event-property tracker also for non-EE clients * simplify duplicates * add test for event properties * add test for non-EE event properties * add flag * revert the label and unmute the text * change the flag to UNSEEN_EVENT_PROPERTIES * sort by query_usage_30_day again * Update frontend/src/types.ts Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com> * use None if no event_names * fix type * improve pagination test Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-12-21 17:27:12 +01:00
read_only_fields = ["id", "name", "is_numerical", "query_usage_30_day", "is_event_property"]
def update(self, event_definition: EnterprisePropertyDefinition, validated_data):
validated_data["updated_by"] = self.context["request"].user
return super().update(event_definition, validated_data)