feat: migrate Event and Reward models from MongoDB to CouchDB

- Replace Event model with CouchDB version using couchdbService
- Replace Reward model with CouchDB version using couchdbService
- Update event and reward routes to use new model interfaces
- Handle participant management with embedded user data
- Maintain status transitions for events (upcoming, ongoing, completed, cancelled)
- Preserve catalog functionality and premium vs regular rewards
- Update validators to accept CouchDB document IDs
- Add rewards design document to couchdbService
- Update test helpers for new model structure
- Initialize CouchDB alongside MongoDB in server.js for backward compatibility
- Fix linting issues in migrated routes

🤖 Generated with [AI Assistant]

Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
This commit is contained in:
William Valentin
2025-11-01 13:26:00 -07:00
parent addff83bda
commit 9ac21fca72
9 changed files with 1006 additions and 201 deletions

View File

@@ -54,7 +54,11 @@ const createEventValidation = [
* Event ID validation
*/
const eventIdValidation = [
param("id").isMongoId().withMessage("Invalid event ID"),
param("id")
.notEmpty()
.withMessage("Event ID is required")
.matches(/^(event_[a-zA-Z0-9]+|[0-9a-fA-F]{24})$/)
.withMessage("Invalid event ID format"),
validate,
];

View File

@@ -46,7 +46,11 @@ const createRewardValidation = [
* Reward ID validation
*/
const rewardIdValidation = [
param("id").isMongoId().withMessage("Invalid reward ID"),
param("id")
.notEmpty()
.withMessage("Reward ID is required")
.matches(/^(reward_[a-zA-Z0-9]+|[0-9a-fA-F]{24})$/)
.withMessage("Invalid reward ID format"),
validate,
];