Add Chzzk campaign and reward models, import command, and schemas
Some checks failed
Deploy to Server / deploy (push) Failing after 19s
Some checks failed
Deploy to Server / deploy (push) Failing after 19s
This commit is contained in:
parent
c852134338
commit
677aedf42b
14 changed files with 650 additions and 9 deletions
100
chzzk/migrations/0001_initial.py
Normal file
100
chzzk/migrations/0001_initial.py
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
# Generated by Django 6.0.3 on 2026-03-31 19:33
|
||||
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
"""Initial migration for ChzzkCampaign and ChzzkReward models."""
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="ChzzkCampaign",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("campaign_no", models.BigIntegerField(unique=True)),
|
||||
("title", models.CharField(max_length=255)),
|
||||
("image_url", models.URLField()),
|
||||
("description", models.TextField()),
|
||||
("category_type", models.CharField(max_length=64)),
|
||||
("category_id", models.CharField(max_length=128)),
|
||||
("category_value", models.CharField(max_length=128)),
|
||||
("pc_link_url", models.URLField()),
|
||||
("mobile_link_url", models.URLField()),
|
||||
("service_id", models.CharField(max_length=128)),
|
||||
("state", models.CharField(max_length=64)),
|
||||
("start_date", models.DateTimeField()),
|
||||
("end_date", models.DateTimeField()),
|
||||
("has_ios_based_reward", models.BooleanField()),
|
||||
("drops_campaign_not_started", models.BooleanField()),
|
||||
(
|
||||
"campaign_reward_type",
|
||||
models.CharField(blank=True, default="", max_length=64),
|
||||
),
|
||||
(
|
||||
"reward_type",
|
||||
models.CharField(blank=True, default="", max_length=64),
|
||||
),
|
||||
("account_link_url", models.URLField()),
|
||||
("scraped_at", models.DateTimeField(default=django.utils.timezone.now)),
|
||||
("source_api", models.CharField(max_length=16)),
|
||||
("scrape_status", models.CharField(default="success", max_length=32)),
|
||||
("raw_json", models.JSONField()),
|
||||
],
|
||||
options={
|
||||
"ordering": ["-start_date"],
|
||||
"unique_together": {("campaign_no", "source_api")},
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="ChzzkReward",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("reward_no", models.BigIntegerField()),
|
||||
("image_url", models.URLField()),
|
||||
("title", models.CharField(max_length=255)),
|
||||
("reward_type", models.CharField(max_length=64)),
|
||||
(
|
||||
"campaign_reward_type",
|
||||
models.CharField(blank=True, default="", max_length=64),
|
||||
),
|
||||
("condition_type", models.CharField(max_length=64)),
|
||||
("condition_for_minutes", models.IntegerField()),
|
||||
("ios_based_reward", models.BooleanField()),
|
||||
("code_remaining_count", models.IntegerField()),
|
||||
(
|
||||
"campaign",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="rewards",
|
||||
to="chzzk.chzzkcampaign",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"unique_together": {("campaign", "reward_no")},
|
||||
},
|
||||
),
|
||||
]
|
||||
20
chzzk/migrations/0002_alter_chzzkcampaign_campaign_no.py
Normal file
20
chzzk/migrations/0002_alter_chzzkcampaign_campaign_no.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 6.0.3 on 2026-03-31 19:53
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
"""Alter campaign_no field in ChzzkCampaign to remove unique constraint."""
|
||||
|
||||
dependencies = [
|
||||
("chzzk", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="chzzkcampaign",
|
||||
name="campaign_no",
|
||||
field=models.BigIntegerField(),
|
||||
),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue