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:
@@ -321,6 +321,37 @@ class CouchDBService {
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
_id: "_design/rewards",
|
||||
views: {
|
||||
"by-cost": {
|
||||
map: `function(doc) {
|
||||
if (doc.type === "reward" && doc.cost) {
|
||||
emit(doc.cost, doc);
|
||||
}
|
||||
}`
|
||||
},
|
||||
"by-premium": {
|
||||
map: `function(doc) {
|
||||
if (doc.type === "reward" && doc.isPremium) {
|
||||
emit(doc.isPremium, doc);
|
||||
}
|
||||
}`
|
||||
}
|
||||
},
|
||||
indexes: {
|
||||
"rewards-by-cost": {
|
||||
index: { fields: ["type", "cost"] },
|
||||
name: "rewards-by-cost",
|
||||
type: "json"
|
||||
},
|
||||
"rewards-by-premium": {
|
||||
index: { fields: ["type", "isPremium"] },
|
||||
name: "rewards-by-premium",
|
||||
type: "json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
_id: "_design/general",
|
||||
indexes: {
|
||||
|
||||
Reference in New Issue
Block a user