mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 16:15:19 -05:00
feat: add passkey authentication and enhance user preferences - Add passkey login security event type with fingerprint icon - Include request and site context in email confirmation for backend - Add user_id exact match filter to prevent incorrect user lookups - Enable PATCH method for updating user preferences via API - Add moderation_preferences support to user settings - Optimize ticket queries with select_related and prefetch_related This commit introduces passkey authentication tracking, improves user profile filtering accuracy, and extends the preferences API to support updates. Query optimizations reduce database hits for ticket listings.
97 lines
4.1 KiB
Python
97 lines
4.1 KiB
Python
# Generated by Django 5.2.10 on 2026-01-11 18:06
|
|
|
|
import apps.core.choices.fields
|
|
import django.db.models.deletion
|
|
import uuid
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("moderation", "0009_add_claim_fields"),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="ModerationAuditLog",
|
|
fields=[
|
|
("id", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
(
|
|
"action",
|
|
apps.core.choices.fields.RichChoiceField(
|
|
allow_deprecated=False,
|
|
choice_group="moderation_audit_actions",
|
|
choices=[
|
|
("approved", "Approved"),
|
|
("rejected", "Rejected"),
|
|
("claimed", "Claimed"),
|
|
("unclaimed", "Unclaimed"),
|
|
("escalated", "Escalated"),
|
|
("converted_to_edit", "Converted to Edit"),
|
|
("status_changed", "Status Changed"),
|
|
("notes_added", "Notes Added"),
|
|
("auto_approved", "Auto Approved"),
|
|
],
|
|
db_index=True,
|
|
domain="moderation",
|
|
help_text="The action that was performed",
|
|
max_length=50,
|
|
),
|
|
),
|
|
(
|
|
"previous_status",
|
|
models.CharField(blank=True, help_text="Status before the action", max_length=50, null=True),
|
|
),
|
|
(
|
|
"new_status",
|
|
models.CharField(blank=True, help_text="Status after the action", max_length=50, null=True),
|
|
),
|
|
("notes", models.TextField(blank=True, help_text="Notes or comments about the action", null=True)),
|
|
(
|
|
"is_system_action",
|
|
models.BooleanField(
|
|
db_index=True, default=False, help_text="Whether this was an automated system action"
|
|
),
|
|
),
|
|
("is_test_data", models.BooleanField(default=False, help_text="Whether this is test data")),
|
|
(
|
|
"created_at",
|
|
models.DateTimeField(auto_now_add=True, db_index=True, help_text="When this action was performed"),
|
|
),
|
|
(
|
|
"moderator",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="The moderator who performed the action (null for system actions)",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="moderation_audit_logs",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"submission",
|
|
models.ForeignKey(
|
|
help_text="The submission this audit log entry is for",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="audit_logs",
|
|
to="moderation.editsubmission",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Moderation Audit Log",
|
|
"verbose_name_plural": "Moderation Audit Logs",
|
|
"ordering": ["-created_at"],
|
|
"indexes": [
|
|
models.Index(fields=["submission", "created_at"], name="moderation__submiss_2f5e56_idx"),
|
|
models.Index(fields=["moderator", "created_at"], name="moderation__moderat_591c14_idx"),
|
|
models.Index(fields=["action", "created_at"], name="moderation__action_a98c47_idx"),
|
|
],
|
|
},
|
|
),
|
|
]
|