diff --git a/pages/api/v2/bots/[id]/index.ts b/pages/api/v2/bots/[id]/index.ts index 898092e..f9c1a5e 100644 --- a/pages/api/v2/bots/[id]/index.ts +++ b/pages/api/v2/bots/[id]/index.ts @@ -1,6 +1,7 @@ import { NextApiRequest } from 'next' import rateLimit from 'express-rate-limit' import { MessageEmbed } from 'discord.js' +import tracer from 'dd-trace' import { CaptchaVerify, get, put, remove, update } from '@utils/Query' import ResponseWrapper from '@utils/ResponseWrapper' @@ -83,6 +84,11 @@ const Bots = RequestHandler() }) const userinfo = await get.user.load(user) await getBotReviewLogChannel().send(new MessageEmbed().setAuthor(`${userinfo.username}#${userinfo.tag}`, KoreanbotsEndPoints.URL.root + KoreanbotsEndPoints.CDN.avatar(userinfo.id, { format: 'png', size: 256 }), KoreanbotsEndPoints.URL.user(userinfo.id)).setTitle('대기 중').setColor('GREY').setDescription(`[${result.id}/${result.date}](${KoreanbotsEndPoints.URL.submittedBot(result.id, result.date)})`).setTimestamp()) + await tracer.trace('botSubmits.submitted', (async span => { + span.setTag('id', result.id) + span.setTag('date', result.date) + span.setTag('user', userinfo.id) + })) return ResponseWrapper(res, { code: 200, data: result }) }) .delete(async (req: DeleteApiRequest, res) => { diff --git a/pages/api/v2/management/bots/submits/[id]/[date]/approve.ts b/pages/api/v2/management/bots/submits/[id]/[date]/approve.ts index 13fd2fa..a8f21bb 100644 --- a/pages/api/v2/management/bots/submits/[id]/[date]/approve.ts +++ b/pages/api/v2/management/bots/submits/[id]/[date]/approve.ts @@ -1,5 +1,6 @@ import { NextApiRequest } from 'next' import { MessageEmbed } from 'discord.js' +import tracer from 'dd-trace' import RequestHandler from '@utils/RequestHandler' import ResponseWrapper from '@utils/ResponseWrapper' @@ -19,8 +20,13 @@ const ApproveBotSubmit = RequestHandler() get.botSubmit.clear(JSON.stringify({ id: req.query.id, date: req.query.date })) get.bot.clear(req.query.id) const embed = new MessageEmbed().setTitle('승인').setColor('GREEN').setDescription(`[${submit.id}/${submit.date}](${KoreanbotsEndPoints.URL.submittedBot(submit.id, submit.date)})`).setTimestamp() - if(req.body.note) embed.addField('📃 정보', req.body.note) + if(req.body.reviewer) embed.addField('📃 정보', `심사자: ${req.body.reviewer}`) await getBotReviewLogChannel().send(embed) + await tracer.trace('botSubmits.approve', (async span => { + span.setTag('id', submit.id) + span.setTag('date', submit.date) + span.setTag('reviewer', req.body.reviewer) + })) return ResponseWrapper(res, { code: 200 }) }) @@ -30,7 +36,7 @@ interface ApiRequest extends NextApiRequest { date: string } body: { - note?: string + reviewer?: string } } diff --git a/pages/api/v2/management/bots/submits/[id]/[date]/deny.ts b/pages/api/v2/management/bots/submits/[id]/[date]/deny.ts index 933b7c5..95d3282 100644 --- a/pages/api/v2/management/bots/submits/[id]/[date]/deny.ts +++ b/pages/api/v2/management/bots/submits/[id]/[date]/deny.ts @@ -17,7 +17,7 @@ const DenyBotSubmit = RequestHandler() await update.denyBotSubmission(submit.id, submit.date, req.body.reason) get.botSubmit.clear(JSON.stringify({ id: req.query.id, date: req.query.date })) const embed = new MessageEmbed().setTitle('거부').setColor('RED').setDescription(`[${submit.id}/${submit.date}](${KoreanbotsEndPoints.URL.submittedBot(submit.id, submit.date)})`).setTimestamp() - if(req.body.note || req.body.reason) embed.addField('📃 정보', `${req.body.reason ? `사유: ${BotSubmissionDenyReasonPresetsName[req.body.reason] || req.body.reason}\n`: ''}${req.body.note ? `${req.body.note}` : ''}`) + if(req.body.reviewer || req.body.reason) embed.addField('📃 정보', `${req.body.reason ? `사유: ${BotSubmissionDenyReasonPresetsName[req.body.reason] || req.body.reason}\n`: ''}${req.body.reviewer ? `심사자: ${req.body.reviewer}` : ''}`) await getBotReviewLogChannel().send(embed) return ResponseWrapper(res, { code: 200 }) }) @@ -29,7 +29,7 @@ interface ApiRequest extends NextApiRequest { } body: { reason?: string - note?: string + reviewer: string } }