Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
backoffice: added decision connecion in serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
DonHaul committed Aug 23, 2024
1 parent b8b534f commit 152533c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2.6 on 2024-08-23 13:02

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("workflows", "0009_decision"),
]

operations = [
migrations.AlterField(
model_name="decision",
name="workflow",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="decisions",
to="workflows.workflow",
),
),
migrations.AlterField(
model_name="workflowticket",
name="workflow_id",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="tickets",
to="workflows.workflow",
),
),
]
5 changes: 3 additions & 2 deletions backoffice/backoffice/workflows/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ class Decision(models.Model):
user = models.ForeignKey(
User,
to_field="email",
related_name="tickets",
db_column="email",
on_delete=models.CASCADE,
)
workflow = models.ForeignKey(Workflow, on_delete=models.CASCADE)
workflow = models.ForeignKey(
Workflow, related_name="decisions", on_delete=models.CASCADE
)
action = models.CharField(max_length=30, choices=DECISION_CHOICES)

_created_at = models.DateTimeField(auto_now_add=True)
Expand Down
2 changes: 1 addition & 1 deletion backoffice/backoffice/workflows/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_decisions(self):
workflow_data = WorkflowSerializer(self.workflow).data
assert "decisions" in workflow_data
assert "action" in workflow_data["decisions"][0]
assert "email" in workflow_data["decisions"][0]
assert "user" in workflow_data["decisions"][0]

@pytest.mark.vcr()
def test_delete(self):
Expand Down

0 comments on commit 152533c

Please sign in to comment.