refactor: organize DAOs into dedicated db/dao/ directory
- Move listing_dao.rs and user_dao.rs to src/db/dao/ - Create dao/mod.rs with proper re-exports for ListingDAO and UserDAO - Update import paths in DAO files to work from new location - Update db/mod.rs to import from new dao module - All tests still pass - no functionality changes
This commit is contained in:
@@ -10,9 +10,9 @@ CREATE TABLE users (
|
||||
telegram_id INTEGER UNIQUE NOT NULL,
|
||||
username TEXT,
|
||||
display_name TEXT,
|
||||
is_banned BOOLEAN DEFAULT FALSE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
is_banned INTEGER DEFAULT 0,
|
||||
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TEXT DEFAULT CURRENT_TIMESTAMP
|
||||
) STRICT;
|
||||
|
||||
-- Main listing table (handles all listing types)
|
||||
@@ -32,12 +32,12 @@ CREATE TABLE listings (
|
||||
slots_available INTEGER DEFAULT 1,
|
||||
|
||||
-- Timing
|
||||
starts_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
ends_at TIMESTAMP NOT NULL,
|
||||
starts_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
ends_at TEXT NOT NULL,
|
||||
anti_snipe_minutes INTEGER DEFAULT 5,
|
||||
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (seller_id) REFERENCES users(id)
|
||||
) STRICT;
|
||||
|
||||
@@ -47,10 +47,10 @@ CREATE TABLE proxy_bids (
|
||||
listing_id INTEGER NOT NULL,
|
||||
buyer_id INTEGER NOT NULL,
|
||||
max_amount INTEGER NOT NULL, -- stored as cents
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
is_active INTEGER DEFAULT 1,
|
||||
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (listing_id) REFERENCES listings(id),
|
||||
FOREIGN KEY (buyer_id) REFERENCES users(id),
|
||||
@@ -68,14 +68,14 @@ CREATE TABLE bids (
|
||||
description TEXT,
|
||||
|
||||
-- Status
|
||||
is_cancelled BOOLEAN DEFAULT FALSE,
|
||||
is_cancelled INTEGER DEFAULT 0,
|
||||
slot_number INTEGER, -- For multi-slot listings
|
||||
|
||||
-- NULL = manual bid, NOT NULL = generated from proxy
|
||||
proxy_bid_id INTEGER,
|
||||
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (listing_id) REFERENCES listings(id),
|
||||
FOREIGN KEY (buyer_id) REFERENCES users(id),
|
||||
FOREIGN KEY (proxy_bid_id) REFERENCES proxy_bids(id)
|
||||
@@ -88,8 +88,8 @@ CREATE TABLE listing_medias (
|
||||
telegram_file_id TEXT NOT NULL,
|
||||
media_type TEXT NOT NULL, -- 'photo', 'video'
|
||||
position INTEGER DEFAULT 0,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (listing_id) REFERENCES listings(id)
|
||||
) STRICT;
|
||||
|
||||
@@ -97,10 +97,10 @@ CREATE TABLE listing_medias (
|
||||
CREATE TABLE user_settings (
|
||||
user_id INTEGER PRIMARY KEY,
|
||||
language_code TEXT DEFAULT 'en',
|
||||
notify_outbid BOOLEAN DEFAULT TRUE,
|
||||
notify_won BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
notify_outbid INTEGER DEFAULT 1,
|
||||
notify_won INTEGER DEFAULT 1,
|
||||
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id)
|
||||
) STRICT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user