feat(board): redesign classifieds + Slack channel creation
Adds AdminGhost bot token for admin-only Slack channel creation, refreshes BoardPostCard/Form layouts, and expands admin board-channels management.
This commit is contained in:
parent
6f3d088763
commit
9a560f2a3b
14 changed files with 544 additions and 158 deletions
|
|
@ -14,6 +14,20 @@ export default defineEventHandler(async (event) => {
|
|||
if (body.slackChannelId !== undefined) updateData.slackChannelId = body.slackChannelId
|
||||
if (body.tagSlugs !== undefined) updateData.tagSlugs = body.tagSlugs
|
||||
|
||||
if (body.tagSlugs && body.tagSlugs.length) {
|
||||
const conflict = await BoardChannel.findOne({
|
||||
_id: { $ne: id },
|
||||
tagSlugs: { $in: body.tagSlugs },
|
||||
}).lean()
|
||||
if (conflict) {
|
||||
const taken = (conflict.tagSlugs || []).filter((s) => body.tagSlugs.includes(s))
|
||||
throw createError({
|
||||
statusCode: 409,
|
||||
statusMessage: `Tag${taken.length > 1 ? 's' : ''} already mapped to "${conflict.name}": ${taken.join(', ')}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const channel = await BoardChannel.findByIdAndUpdate(
|
||||
id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue