The comeback

This commit is contained in:
2024-12-09 06:18:57 +01:00
parent dc19efc536
commit eb283451a8
37 changed files with 813 additions and 2402 deletions

View File

@ -1,290 +0,0 @@
# Generated by Django 5.1 on 2024-09-01 22:36
from __future__ import annotations
from typing import TYPE_CHECKING
import django.contrib.auth.models
import django.contrib.auth.validators
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
if TYPE_CHECKING:
from django.db.migrations.operations.base import Operation
class Migration(migrations.Migration):
initial = True
dependencies: list[tuple[str, str]] = [
("auth", "0012_alter_user_first_name_max_length"),
]
operations: list[Operation] = [
migrations.CreateModel(
name="Game",
fields=[
("created_at", models.DateTimeField(auto_created=True, null=True)),
("twitch_id", models.TextField(primary_key=True, serialize=False)),
("modified_at", models.DateTimeField(auto_now=True, null=True)),
("game_url", models.URLField(default="https://www.twitch.tv/", null=True)),
("name", models.TextField(default="Game name unknown", null=True)),
(
"box_art_url",
models.URLField(default="https://static-cdn.jtvnw.net/ttv-static/404_boxart.jpg", null=True),
),
("slug", models.TextField(null=True)),
],
),
migrations.CreateModel(
name="Owner",
fields=[
("created_at", models.DateTimeField(auto_created=True, null=True)),
("twitch_id", models.TextField(primary_key=True, serialize=False)),
("modified_at", models.DateTimeField(auto_now=True, null=True)),
("name", models.TextField(default="Unknown", null=True)),
],
),
migrations.CreateModel(
name="User",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("password", models.CharField(max_length=128, verbose_name="password")),
("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")),
(
"is_superuser",
models.BooleanField(
default=False,
help_text="Designates that this user has all permissions without explicitly assigning them.",
verbose_name="superuser status",
),
),
(
"username",
models.CharField(
error_messages={"unique": "A user with that username already exists."},
help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
max_length=150,
unique=True,
validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
verbose_name="username",
),
),
("first_name", models.CharField(blank=True, max_length=150, verbose_name="first name")),
("last_name", models.CharField(blank=True, max_length=150, verbose_name="last name")),
("email", models.EmailField(blank=True, max_length=254, verbose_name="email address")),
(
"is_staff",
models.BooleanField(
default=False,
help_text="Designates whether the user can log into this admin site.",
verbose_name="staff status",
),
),
(
"is_active",
models.BooleanField(
default=True,
help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", # noqa: E501
verbose_name="active",
),
),
("date_joined", models.DateTimeField(default=django.utils.timezone.now, verbose_name="date joined")),
(
"groups",
models.ManyToManyField(
blank=True,
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", # noqa: E501
related_name="user_set",
related_query_name="user",
to="auth.group",
verbose_name="groups",
),
),
(
"user_permissions",
models.ManyToManyField(
blank=True,
help_text="Specific permissions for this user.",
related_name="user_set",
related_query_name="user",
to="auth.permission",
verbose_name="user permissions",
),
),
],
options={
"verbose_name": "user",
"verbose_name_plural": "users",
"abstract": False,
},
managers=[
("objects", django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name="DropCampaign",
fields=[
("created_at", models.DateTimeField(auto_created=True, null=True)),
("id", models.TextField(primary_key=True, serialize=False)),
("modified_at", models.DateTimeField(auto_now=True, null=True)),
("account_link_url", models.URLField(null=True)),
("description", models.TextField(null=True)),
("details_url", models.URLField(null=True)),
("ends_at", models.DateTimeField(null=True)),
("starts_at", models.DateTimeField(null=True)),
("image_url", models.URLField(null=True)),
("name", models.TextField(default="Unknown", null=True)),
("status", models.TextField(null=True)),
(
"game",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="drop_campaigns",
to="core.game",
),
),
],
),
migrations.AddField(
model_name="game",
name="org",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="games",
to="core.owner",
),
),
migrations.CreateModel(
name="RewardCampaign",
fields=[
("created_at", models.DateTimeField(auto_created=True, null=True)),
("twitch_id", models.TextField(primary_key=True, serialize=False)),
("modified_at", models.DateTimeField(auto_now=True, null=True)),
("name", models.TextField(null=True)),
("brand", models.TextField(null=True)),
("starts_at", models.DateTimeField(null=True)),
("ends_at", models.DateTimeField(null=True)),
("status", models.TextField(null=True)),
("summary", models.TextField(null=True)),
("instructions", models.TextField(null=True)),
("reward_value_url_param", models.TextField(null=True)),
("external_url", models.URLField(null=True)),
("about_url", models.URLField(null=True)),
("is_site_wide", models.BooleanField(null=True)),
("sub_goal", models.PositiveBigIntegerField(null=True)),
("minute_watched_goal", models.PositiveBigIntegerField(null=True)),
("image_url", models.URLField(null=True)),
(
"game",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="reward_campaigns",
to="core.game",
),
),
],
),
migrations.CreateModel(
name="Reward",
fields=[
("created_at", models.DateTimeField(auto_created=True, null=True)),
("twitch_id", models.TextField(primary_key=True, serialize=False)),
("modified_at", models.DateTimeField(auto_now=True, null=True)),
("name", models.TextField(null=True)),
("banner_image_url", models.URLField(null=True)),
("thumbnail_image_url", models.URLField(null=True)),
("earnable_until", models.DateTimeField(null=True)),
("redemption_instructions", models.TextField(null=True)),
("redemption_url", models.URLField(null=True)),
(
"campaign",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="rewards",
to="core.rewardcampaign",
),
),
],
),
migrations.CreateModel(
name="TimeBasedDrop",
fields=[
("created_at", models.DateTimeField(auto_created=True, null=True)),
("twitch_id", models.TextField(primary_key=True, serialize=False)),
("modified_at", models.DateTimeField(auto_now=True, null=True)),
("required_subs", models.PositiveBigIntegerField(null=True)),
("ends_at", models.DateTimeField(null=True)),
("name", models.TextField(default="Unknown", null=True)),
("required_minutes_watched", models.PositiveBigIntegerField(null=True)),
("starts_at", models.DateTimeField(null=True)),
(
"drop_campaign",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="drops",
to="core.dropcampaign",
),
),
],
),
migrations.CreateModel(
name="Benefit",
fields=[
("created_at", models.DateTimeField(auto_created=True, null=True)),
("twitch_id", models.TextField(primary_key=True, serialize=False)),
("modified_at", models.DateTimeField(auto_now=True, null=True)),
("twitch_created_at", models.DateTimeField(null=True)),
("entitlement_limit", models.PositiveBigIntegerField(null=True)),
("image_url", models.URLField(null=True)),
("is_ios_available", models.BooleanField(null=True)),
("name", models.TextField(null=True)),
(
"time_based_drop",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="benefits",
to="core.timebaseddrop",
),
),
],
),
migrations.CreateModel(
name="Webhook",
fields=[
("created_at", models.DateTimeField(auto_created=True, null=True)),
("id", models.TextField(primary_key=True, serialize=False)),
("avatar", models.TextField(null=True)),
("channel_id", models.TextField(null=True)),
("guild_id", models.TextField(null=True)),
("name", models.TextField(null=True)),
("type", models.TextField(null=True)),
("token", models.TextField()),
("url", models.TextField()),
("modified_at", models.DateTimeField(auto_now=True, null=True)),
("seen_drops", models.ManyToManyField(related_name="seen_drops", to="core.dropcampaign")),
(
"subscribed_live_games",
models.ManyToManyField(related_name="subscribed_live_games", to="core.game"),
),
(
"subscribed_live_owners",
models.ManyToManyField(related_name="subscribed_live_owners", to="core.owner"),
),
("subscribed_new_games", models.ManyToManyField(related_name="subscribed_new_games", to="core.game")),
(
"subscribed_new_owners",
models.ManyToManyField(related_name="subscribed_new_owners", to="core.owner"),
),
],
options={
"unique_together": {("id", "token")},
},
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 5.1 on 2024-09-02 23:28
from __future__ import annotations
from typing import TYPE_CHECKING
from django.db import migrations
if TYPE_CHECKING:
from django.db.migrations.operations.base import Operation
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("core", "0001_initial"),
]
operations: list[Operation] = [
migrations.RenameField(
model_name="dropcampaign",
old_name="id",
new_name="twitch_id",
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 5.1 on 2024-09-07 19:19
from __future__ import annotations
from typing import TYPE_CHECKING
from django.db import migrations
if TYPE_CHECKING:
from django.db.migrations.operations.base import Operation
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("core", "0002_rename_id_dropcampaign_twitch_id"),
]
operations: list[Operation] = [
migrations.RenameField(
model_name="rewardcampaign",
old_name="sub_goal",
new_name="subs_goal",
),
]

View File

@ -1,48 +0,0 @@
# Generated by Django 5.1 on 2024-09-09 02:34
from __future__ import annotations
from typing import TYPE_CHECKING
from django.db import migrations, models
if TYPE_CHECKING:
from django.db.migrations.operations.base import Operation
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("core", "0003_rename_sub_goal_rewardcampaign_subs_goal"),
]
operations: list[Operation] = [
migrations.AlterField(
model_name="dropcampaign",
name="name",
field=models.TextField(null=True),
),
migrations.AlterField(
model_name="game",
name="box_art_url",
field=models.URLField(null=True),
),
migrations.AlterField(
model_name="game",
name="game_url",
field=models.URLField(null=True),
),
migrations.AlterField(
model_name="game",
name="name",
field=models.TextField(null=True),
),
migrations.AlterField(
model_name="owner",
name="name",
field=models.TextField(null=True),
),
migrations.AlterField(
model_name="timebaseddrop",
name="name",
field=models.TextField(null=True),
),
]

View File

@ -1,38 +0,0 @@
# Generated by Django 5.1 on 2024-09-15 19:40
from __future__ import annotations
from typing import TYPE_CHECKING
from django.db import migrations
if TYPE_CHECKING:
from django.db.migrations.operations.base import Operation
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("core", "0004_alter_dropcampaign_name_alter_game_box_art_url_and_more"),
]
operations: list[Operation] = [
migrations.AlterModelOptions(
name="benefit",
options={"ordering": ["-twitch_created_at"]},
),
migrations.AlterModelOptions(
name="dropcampaign",
options={"ordering": ["ends_at"]},
),
migrations.AlterModelOptions(
name="reward",
options={"ordering": ["-earnable_until"]},
),
migrations.AlterModelOptions(
name="rewardcampaign",
options={"ordering": ["-starts_at"]},
),
migrations.AlterModelOptions(
name="timebaseddrop",
options={"ordering": ["required_minutes_watched"]},
),
]

View File

@ -1,50 +0,0 @@
# Generated by Django 5.1.1 on 2024-09-16 19:32
from __future__ import annotations
from typing import TYPE_CHECKING
from django.db import migrations, models
import core.models
if TYPE_CHECKING:
from django.db.migrations.operations.base import Operation
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("core", "0005_alter_benefit_options_alter_dropcampaign_options_and_more"),
]
operations: list[Operation] = [
migrations.AddField(
model_name="benefit",
name="image",
field=models.ImageField(null=True, upload_to=core.models.get_benefit_image_path),
),
migrations.AddField(
model_name="dropcampaign",
name="image",
field=models.ImageField(null=True, upload_to=core.models.get_drop_campaign_image_path),
),
migrations.AddField(
model_name="game",
name="image",
field=models.ImageField(null=True, upload_to=core.models.get_game_image_path),
),
migrations.AddField(
model_name="reward",
name="banner_image",
field=models.ImageField(null=True, upload_to=core.models.get_reward_banner_image_path),
),
migrations.AddField(
model_name="reward",
name="thumbnail_image",
field=models.ImageField(null=True, upload_to=core.models.get_reward_thumbnail_image_path),
),
migrations.AddField(
model_name="rewardcampaign",
name="image",
field=models.ImageField(null=True, upload_to=core.models.get_reward_image_path),
),
]

View File

@ -1,31 +0,0 @@
# Generated by Django 5.1.1 on 2024-09-21 00:08
from __future__ import annotations
from typing import TYPE_CHECKING
from django.db import migrations, models
if TYPE_CHECKING:
from django.db.migrations.operations.base import Operation
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("core", "0006_benefit_image_dropcampaign_image_game_image_and_more"),
]
operations: list[Operation] = [
migrations.AlterModelOptions(
name="game",
options={"ordering": ["name"]},
),
migrations.AlterModelOptions(
name="owner",
options={"ordering": ["name"]},
),
migrations.AlterField(
model_name="game",
name="slug",
field=models.TextField(null=True, unique=True),
),
]

View File

@ -1,28 +0,0 @@
# Generated by Django 5.1.1 on 2024-09-21 16:51
from __future__ import annotations
from typing import TYPE_CHECKING
from django.db import migrations, models
if TYPE_CHECKING:
from django.db.migrations.operations.base import Operation
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("core", "0007_alter_game_options_alter_owner_options_and_more"),
]
operations: list[Operation] = [
migrations.AddField(
model_name="dropcampaign",
name="scraped_json",
field=models.JSONField(help_text="The JSON data from the Twitch API.", null=True),
),
migrations.AddField(
model_name="rewardcampaign",
name="scraped_json",
field=models.JSONField(help_text="The JSON data from the Twitch API.", null=True),
),
]

View File

@ -1,50 +0,0 @@
# Generated by Django 5.1.1 on 2024-09-21 23:56
from __future__ import annotations
from typing import TYPE_CHECKING
import django.db.models.deletion
from django.db import migrations, models
if TYPE_CHECKING:
from django.db.migrations.operations.base import Operation
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("core", "0008_dropcampaign_scraped_json_and_more"),
]
operations: list[Operation] = [
migrations.CreateModel(
name="ScrapedJson",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("json_data", models.JSONField(help_text="The JSON data from the Twitch API.", unique=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
],
options={
"ordering": ["-created_at"],
},
),
migrations.AlterField(
model_name="dropcampaign",
name="scraped_json",
field=models.ForeignKey(
help_text="Reference to the JSON data from the Twitch API.",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="core.scrapedjson",
),
),
migrations.AlterField(
model_name="rewardcampaign",
name="scraped_json",
field=models.ForeignKey(
help_text="Reference to the JSON data from the Twitch API.",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="core.scrapedjson",
),
),
]