feat: Introduce lists and reviews apps, refactor user list functionality from accounts, and add user profile fields.

This commit is contained in:
pacnpal
2025-12-26 09:27:44 -05:00
parent ed04b30469
commit cd8868a591
37 changed files with 5900 additions and 281 deletions

View File

@@ -0,0 +1,284 @@
# Generated by Django 5.1.6 on 2025-12-26 14:13
import apps.core.choices.fields
import django.db.models.deletion
import pgtrigger.compiler
import pgtrigger.migrations
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("pghistory", "0006_delete_aggregateevent"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="ListItem",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("object_id", models.PositiveIntegerField(help_text="ID of the item")),
("rank", models.PositiveIntegerField(help_text="Position in the list")),
("notes", models.TextField(blank=True, help_text="User's notes about this item")),
(
"content_type",
models.ForeignKey(
help_text="Type of item (park, ride, etc.)",
on_delete=django.db.models.deletion.CASCADE,
to="contenttypes.contenttype",
),
),
],
options={
"verbose_name": "List Item",
"verbose_name_plural": "List Items",
"ordering": ["rank"],
"abstract": False,
},
),
migrations.CreateModel(
name="UserList",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("title", models.CharField(help_text="Title of the list", max_length=100)),
(
"category",
apps.core.choices.fields.RichChoiceField(
allow_deprecated=False,
choice_group="top_list_categories",
choices=[
("RC", "Roller Coaster"),
("DR", "Dark Ride"),
("FR", "Flat Ride"),
("WR", "Water Ride"),
("PK", "Park"),
],
domain="accounts",
help_text="Category of items in this list",
max_length=2,
),
),
("description", models.TextField(blank=True, help_text="Description of the list")),
("is_public", models.BooleanField(default=True, help_text="Whether this list is visible to others")),
(
"user",
models.ForeignKey(
help_text="User who created this list",
on_delete=django.db.models.deletion.CASCADE,
related_name="user_lists",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"verbose_name": "User List",
"verbose_name_plural": "User Lists",
"ordering": ["-updated_at"],
"abstract": False,
},
),
migrations.CreateModel(
name="ListItemEvent",
fields=[
("pgh_id", models.AutoField(primary_key=True, serialize=False)),
("pgh_created_at", models.DateTimeField(auto_now_add=True)),
("pgh_label", models.TextField(help_text="The event label.")),
("id", models.BigIntegerField()),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("object_id", models.PositiveIntegerField(help_text="ID of the item")),
("rank", models.PositiveIntegerField(help_text="Position in the list")),
("notes", models.TextField(blank=True, help_text="User's notes about this item")),
(
"content_type",
models.ForeignKey(
db_constraint=False,
help_text="Type of item (park, ride, etc.)",
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
related_query_name="+",
to="contenttypes.contenttype",
),
),
(
"pgh_context",
models.ForeignKey(
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="pghistory.context",
),
),
(
"pgh_obj",
models.ForeignKey(
db_constraint=False,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="events",
to="lists.listitem",
),
),
(
"user_list",
models.ForeignKey(
db_constraint=False,
help_text="List this item belongs to",
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
related_query_name="+",
to="lists.userlist",
),
),
],
options={
"abstract": False,
},
),
migrations.AddField(
model_name="listitem",
name="user_list",
field=models.ForeignKey(
help_text="List this item belongs to",
on_delete=django.db.models.deletion.CASCADE,
related_name="items",
to="lists.userlist",
),
),
migrations.CreateModel(
name="UserListEvent",
fields=[
("pgh_id", models.AutoField(primary_key=True, serialize=False)),
("pgh_created_at", models.DateTimeField(auto_now_add=True)),
("pgh_label", models.TextField(help_text="The event label.")),
("id", models.BigIntegerField()),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("title", models.CharField(help_text="Title of the list", max_length=100)),
(
"category",
apps.core.choices.fields.RichChoiceField(
allow_deprecated=False,
choice_group="top_list_categories",
choices=[
("RC", "Roller Coaster"),
("DR", "Dark Ride"),
("FR", "Flat Ride"),
("WR", "Water Ride"),
("PK", "Park"),
],
domain="accounts",
help_text="Category of items in this list",
max_length=2,
),
),
("description", models.TextField(blank=True, help_text="Description of the list")),
("is_public", models.BooleanField(default=True, help_text="Whether this list is visible to others")),
(
"pgh_context",
models.ForeignKey(
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="pghistory.context",
),
),
(
"pgh_obj",
models.ForeignKey(
db_constraint=False,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="events",
to="lists.userlist",
),
),
(
"user",
models.ForeignKey(
db_constraint=False,
help_text="User who created this list",
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
related_query_name="+",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"abstract": False,
},
),
pgtrigger.migrations.AddTrigger(
model_name="userlist",
trigger=pgtrigger.compiler.Trigger(
name="insert_insert",
sql=pgtrigger.compiler.UpsertTriggerSql(
func='INSERT INTO "lists_userlistevent" ("category", "created_at", "description", "id", "is_public", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "title", "updated_at", "user_id") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."id", NEW."is_public", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."title", NEW."updated_at", NEW."user_id"); RETURN NULL;',
hash="702082b0a9ed526aa1bffbec0839e9a2d7641f42",
operation="INSERT",
pgid="pgtrigger_insert_insert_7a128",
table="lists_userlist",
when="AFTER",
),
),
),
pgtrigger.migrations.AddTrigger(
model_name="userlist",
trigger=pgtrigger.compiler.Trigger(
name="update_update",
sql=pgtrigger.compiler.UpsertTriggerSql(
condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
func='INSERT INTO "lists_userlistevent" ("category", "created_at", "description", "id", "is_public", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "title", "updated_at", "user_id") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."id", NEW."is_public", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."title", NEW."updated_at", NEW."user_id"); RETURN NULL;',
hash="843e25a795f48bb1dfbb3c5723598823a71e0da8",
operation="UPDATE",
pgid="pgtrigger_update_update_1d718",
table="lists_userlist",
when="AFTER",
),
),
),
migrations.AlterUniqueTogether(
name="listitem",
unique_together={("user_list", "rank")},
),
pgtrigger.migrations.AddTrigger(
model_name="listitem",
trigger=pgtrigger.compiler.Trigger(
name="insert_insert",
sql=pgtrigger.compiler.UpsertTriggerSql(
func='INSERT INTO "lists_listitemevent" ("content_type_id", "created_at", "id", "notes", "object_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "rank", "updated_at", "user_list_id") VALUES (NEW."content_type_id", NEW."created_at", NEW."id", NEW."notes", NEW."object_id", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."rank", NEW."updated_at", NEW."user_list_id"); RETURN NULL;',
hash="09893103c0995cb295cdf83421583a93266593bb",
operation="INSERT",
pgid="pgtrigger_insert_insert_bb169",
table="lists_listitem",
when="AFTER",
),
),
),
pgtrigger.migrations.AddTrigger(
model_name="listitem",
trigger=pgtrigger.compiler.Trigger(
name="update_update",
sql=pgtrigger.compiler.UpsertTriggerSql(
condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
func='INSERT INTO "lists_listitemevent" ("content_type_id", "created_at", "id", "notes", "object_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "rank", "updated_at", "user_list_id") VALUES (NEW."content_type_id", NEW."created_at", NEW."id", NEW."notes", NEW."object_id", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."rank", NEW."updated_at", NEW."user_list_id"); RETURN NULL;',
hash="5617f50c7404a18a24f08bd237aecd466b496339",
operation="UPDATE",
pgid="pgtrigger_update_update_2b5a0",
table="lists_listitem",
when="AFTER",
),
),
),
]