mirror of
https://github.com/wahyd4/links.git
synced 2026-08-09 05:06:16 +10:00
66 lines
3.3 KiB
Python
66 lines
3.3 KiB
Python
# Generated by Django 5.2.12 on 2026-05-11 10:59
|
|
|
|
import django.db.models.deletion
|
|
import netscan.fields
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='PriceWatcher',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=200)),
|
|
('url', models.URLField(max_length=2000)),
|
|
('css_selector', models.CharField(help_text='CSS selector for the price element, e.g. span.price or .product-price', max_length=500)),
|
|
('check_interval_hours', models.IntegerField(choices=[(6, 'Every 6 hours'), (12, 'Every 12 hours'), (24, 'Every day'), (48, 'Every 2 days'), (72, 'Every 3 days'), (168, 'Every 7 days')], default=24)),
|
|
('alert_threshold_pct', models.DecimalField(decimal_places=2, default=0, help_text='Minimum % price drop to trigger an alert (0 = any drop)', max_digits=5)),
|
|
('telegram_bot_token', netscan.fields.EncryptedCharField(blank=True)),
|
|
('telegram_chat_id', netscan.fields.EncryptedCharField(blank=True)),
|
|
('enabled', models.BooleanField(default=True)),
|
|
('last_checked_at', models.DateTimeField(blank=True, null=True)),
|
|
('last_price', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
],
|
|
options={
|
|
'ordering': ['name'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='PriceSnapshot',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('price', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
|
|
('raw_text', models.CharField(blank=True, max_length=500)),
|
|
('error', models.CharField(blank=True, max_length=500)),
|
|
('checked_at', models.DateTimeField(auto_now_add=True)),
|
|
('watcher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='snapshots', to='pricemon.pricewatcher')),
|
|
],
|
|
options={
|
|
'ordering': ['-checked_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='PriceAlert',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('old_price', models.DecimalField(decimal_places=2, max_digits=12)),
|
|
('new_price', models.DecimalField(decimal_places=2, max_digits=12)),
|
|
('drop_pct', models.DecimalField(decimal_places=2, max_digits=5)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('dismissed', models.BooleanField(default=False)),
|
|
('watcher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='alerts', to='pricemon.pricewatcher')),
|
|
],
|
|
options={
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
]
|