Add initial version of feeds app
All checks were successful
Deploy to Server / deploy (push) Successful in 11s
All checks were successful
Deploy to Server / deploy (push) Successful in 11s
This commit is contained in:
parent
e889b58aec
commit
a02b5d5f66
17 changed files with 993 additions and 15 deletions
186
feeds/migrations/0001_initial.py
Normal file
186
feeds/migrations/0001_initial.py
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
# Generated by Django 6.0.3 on 2026-03-24 01:13
|
||||
|
||||
import django.contrib.postgres.indexes
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
"""Initial migration for Feed and Entry models."""
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Feed",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"url",
|
||||
models.URLField(
|
||||
help_text="The canonical URL of the RSS/Atom feed. Must be unique.",
|
||||
max_length=2048,
|
||||
unique=True,
|
||||
verbose_name="Feed URL",
|
||||
),
|
||||
),
|
||||
(
|
||||
"domain",
|
||||
models.CharField(
|
||||
db_index=True,
|
||||
help_text="Domain name extracted from the feed URL.",
|
||||
max_length=255,
|
||||
verbose_name="Domain",
|
||||
),
|
||||
),
|
||||
(
|
||||
"etag",
|
||||
models.CharField(
|
||||
blank=True,
|
||||
default="",
|
||||
help_text="HTTP ETag header for conditional requests.",
|
||||
max_length=255,
|
||||
verbose_name="ETag",
|
||||
),
|
||||
),
|
||||
(
|
||||
"last_modified",
|
||||
models.CharField(
|
||||
blank=True,
|
||||
default="",
|
||||
help_text="HTTP Last-Modified header for conditional requests.",
|
||||
max_length=255,
|
||||
verbose_name="Last Modified",
|
||||
),
|
||||
),
|
||||
(
|
||||
"is_active",
|
||||
models.BooleanField(
|
||||
default=True,
|
||||
help_text="Whether this feed is currently being fetched.",
|
||||
verbose_name="Is Active",
|
||||
),
|
||||
),
|
||||
(
|
||||
"created_at",
|
||||
models.DateTimeField(
|
||||
auto_now_add=True,
|
||||
help_text="Timestamp when this feed was first added.",
|
||||
verbose_name="Created At",
|
||||
),
|
||||
),
|
||||
(
|
||||
"last_fetched_at",
|
||||
models.DateTimeField(
|
||||
blank=True,
|
||||
help_text="Timestamp when this feed was last fetched.",
|
||||
null=True,
|
||||
verbose_name="Last Fetched At",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Feed",
|
||||
"verbose_name_plural": "Feeds",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Entry",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"entry_id",
|
||||
models.CharField(
|
||||
db_index=True,
|
||||
help_text="Unique entry ID (guid, id, or link) from the feed.",
|
||||
max_length=512,
|
||||
verbose_name="Entry ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"fetched_at",
|
||||
models.DateTimeField(
|
||||
auto_now_add=True,
|
||||
db_index=True,
|
||||
help_text="Timestamp when this entry was archived.",
|
||||
verbose_name="Fetched At",
|
||||
),
|
||||
),
|
||||
(
|
||||
"published_at",
|
||||
models.DateTimeField(
|
||||
blank=True,
|
||||
db_index=True,
|
||||
help_text="Timestamp when this entry was published (if available).",
|
||||
null=True,
|
||||
verbose_name="Published At",
|
||||
),
|
||||
),
|
||||
(
|
||||
"content_hash",
|
||||
models.BigIntegerField(
|
||||
db_index=True,
|
||||
help_text="xxhash64 integer of the entry content for deduplication.",
|
||||
verbose_name="Content Hash",
|
||||
),
|
||||
),
|
||||
(
|
||||
"data",
|
||||
models.JSONField(
|
||||
blank=True,
|
||||
help_text="Parsed entry data as JSON.",
|
||||
null=True,
|
||||
verbose_name="Entry Data",
|
||||
),
|
||||
),
|
||||
(
|
||||
"error_message",
|
||||
models.TextField(
|
||||
blank=True,
|
||||
default="",
|
||||
help_text="Error message if archiving failed.",
|
||||
verbose_name="Error Message",
|
||||
),
|
||||
),
|
||||
(
|
||||
"feed",
|
||||
models.ForeignKey(
|
||||
help_text="The feed this entry was fetched from.",
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="entries",
|
||||
to="feeds.feed",
|
||||
verbose_name="Feed",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Entry",
|
||||
"verbose_name_plural": "Entries",
|
||||
"indexes": [
|
||||
django.contrib.postgres.indexes.GinIndex(
|
||||
fields=["data"], name="feeds_entry_data_c87562_gin"
|
||||
)
|
||||
],
|
||||
"unique_together": {("feed", "entry_id", "content_hash")},
|
||||
},
|
||||
),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue