Simplify the feature to pure discovery (filter by topic, see matching members, copy Slack handle). Drop the connection request/confirm flow entirely — Connection model, 7 API endpoints, useConnections composable, and TagInput component deleted. - Rename communityConnections → communityEcology in schema, API, pages - Delete legacy fields: offering, lookingFor, peerSupport - New /ecology page, /api/ecology/suggestions, community-ecology.patch - Nav: "Connections" → "Ecology", remove pending-count badge - Fix auth/member.get.js missing craftTags + communityEcology - Add community_ecology_updated activity log type - Expose slackHandle conditionally when offerPeerSupport is true - Add migration script at scripts/migrate-to-ecology.js (run before deploy)
61 lines
1.3 KiB
JavaScript
61 lines
1.3 KiB
JavaScript
import mongoose from 'mongoose'
|
|
|
|
const ACTIVITY_TYPES = [
|
|
'member_joined',
|
|
'event_registered',
|
|
'event_cancelled',
|
|
'event_waitlisted',
|
|
'circle_changed',
|
|
'contribution_changed',
|
|
'email_changed',
|
|
'profile_updated',
|
|
'subscription_created',
|
|
'subscription_cancelled',
|
|
'status_changed',
|
|
'role_changed',
|
|
'admin_profile_update',
|
|
'slack_invited',
|
|
'email_sent',
|
|
'community_connections_updated',
|
|
'community_ecology_updated',
|
|
'connection_requested',
|
|
'connection_confirmed',
|
|
'tag_suggested'
|
|
]
|
|
|
|
const activityLogSchema = new mongoose.Schema({
|
|
member: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'Member',
|
|
required: true
|
|
},
|
|
type: {
|
|
type: String,
|
|
enum: ACTIVITY_TYPES,
|
|
required: true
|
|
},
|
|
visibility: {
|
|
type: String,
|
|
enum: ['member', 'admin', 'public'],
|
|
default: 'member'
|
|
},
|
|
metadata: {
|
|
type: mongoose.Schema.Types.Mixed,
|
|
default: () => ({})
|
|
},
|
|
performedBy: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'Member'
|
|
},
|
|
timestamp: {
|
|
type: Date,
|
|
default: Date.now
|
|
}
|
|
})
|
|
|
|
// Indexes
|
|
activityLogSchema.index({ member: 1, timestamp: -1 })
|
|
activityLogSchema.index({ member: 1, visibility: 1, timestamp: -1 })
|
|
activityLogSchema.index({ type: 1, timestamp: -1 })
|
|
|
|
export default mongoose.models.ActivityLog || mongoose.model('ActivityLog', activityLogSchema)
|