New Feature: Watch Listings (#215)

* adding new feature: watch listings for changes

* adding todo for watch feature

* sort by watch
This commit is contained in:
Christian Kellner
2025-10-05 14:23:32 +02:00
committed by GitHub
parent 9f1e27d011
commit a5efd9af32
14 changed files with 383 additions and 70 deletions

View File

@@ -0,0 +1,8 @@
// Migration: Adding a changeset field to the listings table in preparation for
// a price watch feature
export function up(db) {
db.exec(`
ALTER TABLE listings ADD COLUMN change_set jsonb;
`);
}

View File

@@ -0,0 +1,15 @@
// Migration: Adding a new table to store if somebody "watches" (a.k.a favorite) a listing
export function up(db) {
db.exec(`
CREATE TABLE IF NOT EXISTS watch_list
(
id TEXT PRIMARY KEY,
listing_id TEXT NOT NULL,
user_id TEXT NOT NULL,
FOREIGN KEY (listing_id) REFERENCES listings (id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
);
CREATE UNIQUE INDEX IF NOT EXISTS idx_watch_list ON watch_list (listing_id, user_id);
`);
}