confirm each tag in auth event
This commit is contained in:
@@ -307,7 +307,7 @@ const eventController = {
|
|||||||
if (body.tags) {
|
if (body.tags) {
|
||||||
await Tag.bulkCreate(body.tags.map(t => ({ tag: t, confirmed: !!req.user })), { ignoreDuplicates: true })
|
await Tag.bulkCreate(body.tags.map(t => ({ tag: t, confirmed: !!req.user })), { ignoreDuplicates: true })
|
||||||
const tags = await Tag.findAll({ where: { tag: { [Op.in]: body.tags } } })
|
const tags = await Tag.findAll({ where: { tag: { [Op.in]: body.tags } } })
|
||||||
await Promise.all(tags.map(t => t.update({ weigth: Number(t.weigth) + 1 })))
|
await Promise.all(tags.map(t => t.update({ weigth: Number(t.weigth) + 1, confirmed: true })))
|
||||||
await event.addTags(tags)
|
await event.addTags(tags)
|
||||||
event.tags = tags
|
event.tags = tags
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user