rename communityEcology → board across backend

Model, schemas, API routes, activity log, and all server handlers
updated. Old ecology/ and community-ecology routes removed, new
board/ routes added. Tests updated and new board-suggestions tests
written (10 cases).
This commit is contained in:
Jennie Robinson Faber 2026-04-14 12:00:15 +01:00
parent 59d6e97787
commit 091ec58073
20 changed files with 405 additions and 80 deletions

View file

@ -5,15 +5,15 @@ export default defineEventHandler(async (event) => {
await connectDB()
const member = await requireAuth(event)
const body = await validateBody(event, communityEcologyUpdateSchema)
const body = await validateBody(event, boardUpdateSchema)
const updateData = {
'communityEcology.topics': body.topics || [],
'communityEcology.offerPeerSupport': body.offerPeerSupport || false,
'communityEcology.availability': body.availability || '',
'communityEcology.slackHandle': body.slackHandle || '',
'communityEcology.personalMessage': body.personalMessage || '',
'communityEcology.details': body.details || '',
'board.topics': body.topics || [],
'board.offerPeerSupport': body.offerPeerSupport || false,
'board.availability': body.availability || '',
'board.slackHandle': body.slackHandle || '',
'board.personalMessage': body.personalMessage || '',
'board.details': body.details || '',
}
if (body.offerPeerSupport && body.slackHandle) {
@ -27,12 +27,12 @@ export default defineEventHandler(async (event) => {
updateData.slackUserId = slackUserId
} else {
console.warn(
`[Community Ecology] Could not find Slack user ID for handle: ${body.slackHandle}`,
`[Board] Could not find Slack user ID for handle: ${body.slackHandle}`,
)
}
}
} catch (error) {
console.error('[Community Ecology] Error fetching Slack user ID:', error.message)
console.error('[Board] Error fetching Slack user ID:', error.message)
}
}
@ -50,21 +50,21 @@ export default defineEventHandler(async (event) => {
})
}
logActivity(member._id, 'community_ecology_updated', {
logActivity(member._id, 'board_updated', {
topicCount: (body.topics || []).length,
offerPeerSupport: body.offerPeerSupport || false,
})
return {
success: true,
communityEcology: updated.communityEcology,
board: updated.board,
}
} catch (error) {
if (error.statusCode) throw error
console.error('Community ecology update error:', error)
console.error('Board update error:', error)
throw createError({
statusCode: 500,
statusMessage: 'Failed to update community ecology settings',
statusMessage: 'Failed to update board settings',
})
}
})