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
All checks were successful
Deploy to Server / deploy (push) Successful in 18s
This commit is contained in:
parent
5d56a936b0
commit
a8747791c0
12 changed files with 242 additions and 13 deletions
23
twitch/migrations/0015_dropcampaign_is_fully_imported.py
Normal file
23
twitch/migrations/0015_dropcampaign_is_fully_imported.py
Normal 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.",
|
||||
),
|
||||
),
|
||||
]
|
||||
25
twitch/migrations/0016_mark_all_drops_fully_imported.py
Normal file
25
twitch/migrations/0016_mark_all_drops_fully_imported.py
Normal 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),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue