Skip to content

Commit

Permalink
fix(audit): create audit log for deleted conditions in a segment (#3577)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell authored Mar 8, 2024
1 parent 5f96f5a commit 1330b4a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.2.24 on 2024-03-07 15:41

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("segments", "0021_create_whitelisted_segments"),
]

operations = [
migrations.AddField(
model_name="segmentrule",
name="deleted_at",
field=models.DateTimeField(
blank=True, db_index=True, default=None, editable=False, null=True
),
),
migrations.AddField(
model_name='condition',
name='deleted_at',
field=models.DateTimeField(blank=True, db_index=True, default=None, editable=False, null=True),
),
migrations.AddField(
model_name='historicalcondition',
name='deleted_at',
field=models.DateTimeField(blank=True, db_index=True, default=None, editable=False, null=True),
),
]
5 changes: 2 additions & 3 deletions api/segments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from copy import deepcopy

from core.models import (
AbstractBaseExportableModel,
SoftDeleteExportableModel,
abstract_base_auditable_model_factory,
)
Expand Down Expand Up @@ -87,7 +86,7 @@ def _get_project(self):
return self.project


class SegmentRule(AbstractBaseExportableModel):
class SegmentRule(SoftDeleteExportableModel):
ALL_RULE = "ALL"
ANY_RULE = "ANY"
NONE_RULE = "NONE"
Expand Down Expand Up @@ -132,7 +131,7 @@ def get_segment(self):


class Condition(
AbstractBaseExportableModel, abstract_base_auditable_model_factory(["uuid"])
SoftDeleteExportableModel, abstract_base_auditable_model_factory(["uuid"])
):
history_record_class_path = "segments.models.HistoricalCondition"
related_object_type = RelatedObjectType.SEGMENT
Expand Down

0 comments on commit 1330b4a

Please sign in to comment.