- Break down monolithic src/db/models.rs into focused model files
- Create src/db/models/ directory with individual files:
- listing_type.rs - ListingType enum and variants
- user.rs - User struct and NewUser helper
- listing.rs - Listing struct and NewListing helper
- bid.rs - Bid struct and NewBid helper
- proxy_bid.rs - ProxyBid struct and NewProxyBid helper
- listing_media.rs - ListingMedia for file attachments
- user_settings.rs - UserSettings for user preferences
- mod.rs - Re-exports all models for seamless access
- Remove old monolithic models.rs file
- Maintain backward compatibility through re-exports
Benefits:
- Improved code organization and maintainability
- Better separation of concerns for each model
- Easier navigation and IDE support
- Reduced merge conflicts in team development
- Scalable foundation for adding new models
- Refactor MoneyAmount to store as INTEGER cents instead of TEXT decimals
- Move CurrencyType to separate currency_type.rs module
- Rename money.rs to money_amount.rs for clarity
- Update database schema to use INTEGER for all monetary columns
- Remove complex CAST AS REAL workarounds from database queries
- Add comprehensive test coverage for cent-based arithmetic and storage
- Enable STRICT mode and foreign key constraints in SQLite
- Add rstest dependency for parameterized testing
Benefits:
- Faster INTEGER-based comparisons vs TEXT casting
- Exact financial precision without floating-point errors
- Simpler, cleaner SQL queries
- Better performance for auction bid operations
Major Changes:
- Set up SQLx database connection and migration system
- Create complete initial database schema with all tables
- Rename 'auction' to 'listing' throughout codebase for better terminology
- Update bot commands: /newauction -> /newlisting, /myauctions -> /mylistings
- Update all database tables: auctions -> listings, auction_medias -> listing_medias
- Update foreign key relationships and indexes
- Add automatic database migration on startup
- Update documentation and README
- Complete backlog tasks: task-001, task-002, task-010
The bot now has a solid database foundation ready for implementing core business logic.
All tests pass and code compiles successfully.