mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-04-25 08:46:23 +02:00
Add refresh controls and notification support
- Add refresh button to product list items with spinning animation - Add editable refresh interval dropdown on product detail page - Add user profile dropdown with settings link in navbar - Create Settings page for Telegram and Discord configuration - Add per-product notification options (price drop threshold, back in stock) - Integrate notifications into scheduler for automatic alerts - Add notification service supporting Telegram Bot API and Discord webhooks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8c5d20707d
commit
a6928a0c17
13 changed files with 1373 additions and 21 deletions
|
|
@ -5,9 +5,25 @@ CREATE TABLE IF NOT EXISTS users (
|
|||
id SERIAL PRIMARY KEY,
|
||||
email VARCHAR(255) UNIQUE NOT NULL,
|
||||
password_hash VARCHAR(255) NOT NULL,
|
||||
telegram_bot_token VARCHAR(255),
|
||||
telegram_chat_id VARCHAR(255),
|
||||
discord_webhook_url TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Migration: Add notification columns to users if they don't exist
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name = 'users' AND column_name = 'telegram_bot_token'
|
||||
) THEN
|
||||
ALTER TABLE users ADD COLUMN telegram_bot_token VARCHAR(255);
|
||||
ALTER TABLE users ADD COLUMN telegram_chat_id VARCHAR(255);
|
||||
ALTER TABLE users ADD COLUMN discord_webhook_url TEXT;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Products table
|
||||
CREATE TABLE IF NOT EXISTS products (
|
||||
id SERIAL PRIMARY KEY,
|
||||
|
|
@ -18,6 +34,8 @@ CREATE TABLE IF NOT EXISTS products (
|
|||
refresh_interval INTEGER DEFAULT 3600,
|
||||
last_checked TIMESTAMP,
|
||||
stock_status VARCHAR(20) DEFAULT 'unknown',
|
||||
price_drop_threshold DECIMAL(10,2),
|
||||
notify_back_in_stock BOOLEAN DEFAULT false,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(user_id, url)
|
||||
);
|
||||
|
|
@ -33,6 +51,18 @@ BEGIN
|
|||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Migration: Add notification columns to products if they don't exist
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name = 'products' AND column_name = 'price_drop_threshold'
|
||||
) THEN
|
||||
ALTER TABLE products ADD COLUMN price_drop_threshold DECIMAL(10,2);
|
||||
ALTER TABLE products ADD COLUMN notify_back_in_stock BOOLEAN DEFAULT false;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Price history table
|
||||
CREATE TABLE IF NOT EXISTS price_history (
|
||||
id SERIAL PRIMARY KEY,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue