• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hicommonwealth / commonwealth / 13423178478

19 Feb 2025 10:01PM UTC coverage: 46.385% (+0.001%) from 46.384%
13423178478

Pull #11066

github

web-flow
Merge 6675579e4 into c9fa3ca05
Pull Request #11066: Update thread view schema

1306 of 3095 branches covered (42.2%)

Branch coverage included in aggregate %.

3 of 6 new or added lines in 2 files covered. (50.0%)

8 existing lines in 3 files now uncovered.

2486 of 5080 relevant lines covered (48.94%)

38.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.56
/libs/model/src/contest/CancelContestManagerMetadata.command.ts
1
import { logger, type Command } from '@hicommonwealth/core';
2
import * as schemas from '@hicommonwealth/schemas';
3
import { NeynarAPIClient } from '@neynar/nodejs-sdk';
4
import { config } from '../config';
5
import { models } from '../database';
6
import { authRoles } from '../middleware';
7
import { mustExist } from '../middleware/guards';
8

9
const log = logger(import.meta);
29✔
10

11
export function CancelContestManagerMetadata(): Command<
12
  typeof schemas.CancelContestManagerMetadata
13
> {
14
  return {
3✔
15
    ...schemas.CancelContestManagerMetadata,
16
    auth: [authRoles('admin')],
17
    body: async ({ payload }) => {
18
      const contestManager = await models.ContestManager.findOne({
2✔
19
        where: {
20
          community_id: payload.community_id,
21
          contest_address: payload.contest_address,
22
        },
23
      });
24
      mustExist('Contest Manager', contestManager);
2✔
25

26
      // only delete webhooks in prod, otherwise non-prod environments may delete a prod contest webhook
27
      if (config.APP_ENV === 'production' && contestManager.neynar_webhook_id) {
1!
NEW
28
        const client = new NeynarAPIClient(config.CONTESTS.NEYNAR_API_KEY!);
×
NEW
29
        try {
×
NEW
30
          await client.deleteWebhook(contestManager.neynar_webhook_id);
×
31
          contestManager.neynar_webhook_id = null;
×
32
          contestManager.neynar_webhook_secret = null;
×
33
        } catch (err) {
34
          log.warn(
×
35
            `failed to delete neynar webhook: ${contestManager.neynar_webhook_id}`,
36
          );
37
        }
38
      }
39

40
      contestManager.cancelled = true;
1✔
41
      await contestManager.save();
1✔
42
      return {
1✔
43
        contest_managers: [contestManager.get({ plain: true })],
44
      };
45
    },
46
  };
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc