{"record":{"id":"a74721b51c665163","repo":"yikart/AiToEarn","slug":"accountid-videoid-commentid","errorCode":null,"errorMessage":"accountId, videoId和commentId是必须的","messagePattern":"accountId, videoId和commentId是必须的","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"project/aitoearn-electron/server/src/modules/plat/tiktok/tiktok.controller.ts","lineNumber":331,"sourceCode":"  @ApiBody({\n    schema: {\n      type: 'object',\n      properties: {\n        accountId: { type: 'string', description: 'TikTok账号ID' },\n        videoId: { type: 'string', description: '视频ID' },\n        commentId: { type: 'string', description: '评论ID' }\n      },\n      required: ['accountId', 'videoId', 'commentId']\n    }\n  })\n  async deleteComment(\n    @GetToken() systemToken: TokenInfo,\n    @Body('accountId') accountId: string,\n    @Body('videoId') videoId: string,\n    @Body('commentId') commentId: string\n  ) {\n    if (!accountId || !videoId || !commentId) {\n      throw new BadRequestException('accountId, videoId和commentId是必须的');\n    }\n\n    const accessToken = await this.tikTokAuthService.getUserAccessToken(accountId);\n    return this.tikTokService.deleteComment(accessToken, videoId, commentId);\n  }\n\n  /**\n   * 视频点赞或取消点赞\n   */\n  @Post('videos/rate')\n  @ApiOperation({ summary: '视频点赞或取消点赞' })\n  @ApiBody({\n    schema: {\n      type: 'object',\n      properties: {\n        accountId: { type: 'string', description: 'TikTok账号ID' },\n        videoId: { type: 'string', description: '视频ID' },\n        rating: { type: 'string', description: '操作类型: like 或 unlike' }","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-electron/server/src/modules/plat/tiktok/tiktok.controller.ts#L313-L349","documentation":"The TikTok deleteComment endpoint returns 400 BadRequestException when accountId, videoId, or commentId is missing, empty, or falsy in the request body. The library requires all three identifiers to resolve the account's access token and target the exact comment to delete on TikTok. It is a client-input guard thrown before any TikTok API call.","triggerScenarios":"POSTing to deleteComment with a body missing one of accountId, videoId, commentId, or sending empty-string values for any of them.","commonSituations":"Frontend forms not collecting commentId; partial serialization of the comment object; stale clients built before commentId was added to the API contract.","solutions":["Ensure the request body includes non-empty accountId, videoId, and commentId strings.","Fix the caller that constructs the body so it forwards commentId from the comment object being deleted.","Update outdated client code that calls this endpoint with the old (videoId, accountId-only) shape."],"exampleFix":"// before\nawait api.post('/tiktok/comment/delete', { accountId, videoId });\n// after\nawait api.post('/tiktok/comment/delete', { accountId, videoId, commentId });","handlingStrategy":"validation","validationCode":"const ok = [accountId, videoId, commentId].every(v => typeof v === 'string' && v.length > 0);\nif (!ok) throw new Error('accountId, videoId and commentId are required');","typeGuard":"function hasRequired(v: unknown): v is { accountId: string; videoId: string; commentId: string } {\n  const o = v as Record<string, unknown>;\n  return typeof o.accountId === 'string' && o.accountId !== '' &&\n         typeof o.videoId === 'string' && o.videoId !== '' &&\n         typeof o.commentId === 'string' && o.commentId !== '';\n}","tryCatchPattern":"try {\n  await api.post('/tiktok/comment/delete', { accountId, videoId, commentId });\n} catch (e) {\n  if (e.response?.status === 400) {\n    console.error('Missing required fields:', e.response.data?.message);\n  }\n}","preventionTips":["Centralize a body-builder for TikTok comment operations that asserts required IDs.","Type the request payloads so TypeScript enforces commentId presence.","Log the outgoing body (redacted) when a 400 occurs to spot missing fields quickly."],"tags":["bad-request","validation","tiktok","missing-parameter"],"backgroundTag":"missing-required-parameter","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}