Add is_fully_imported field to DropCampaign and KickDropCampaign models; update views and commands to filter by this field
All checks were successful
Deploy to Server / deploy (push) Successful in 18s

This commit is contained in:
Joakim Hellsén 2026-03-20 00:55:32 +01:00
commit a8747791c0
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
12 changed files with 242 additions and 13 deletions

View file

@ -0,0 +1,23 @@
# Generated by Django 6.0.3 on 2026-03-19 19:20
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
"""Add a new field `is_fully_imported` to the `DropCampaign` model to track whether all related images and formats have been imported and are ready for display. This field will help us filter out campaigns that are not yet fully imported in our views and APIs, ensuring that only complete campaigns are shown to users."""
dependencies = [
("twitch", "0014_dropcampaign_image_mime_type_and_more"),
]
operations = [
migrations.AddField(
model_name="dropcampaign",
name="is_fully_imported",
field=models.BooleanField(
default=False,
help_text="True if all images and formats are imported and ready for display.",
),
),
]

View file

@ -0,0 +1,25 @@
from django.db import migrations
def mark_all_drops_fully_imported(apps, schema_editor) -> None: # noqa: ANN001, ARG001
"""Marks all existing DropCampaigns as fully imported.
This was needed to ensure that the Twitch API view only returns campaigns that are ready for display.
"""
DropCampaign = apps.get_model("twitch", "DropCampaign")
DropCampaign.objects.all().update(is_fully_imported=True)
class Migration(migrations.Migration):
"""Marks all existing DropCampaigns as fully imported.
This was needed to ensure that the Twitch API view only returns campaigns that are ready for display.
"""
dependencies = [
("twitch", "0015_dropcampaign_is_fully_imported"),
]
operations = [
migrations.RunPython(mark_all_drops_fully_imported),
]