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

hicommonwealth / commonwealth / 19508639478

19 Nov 2025 04:27PM UTC coverage: 37.649%. Remained the same
19508639478

push

github

web-flow
fix updates with event id (#13205)

Co-authored-by: rotorsoft <rotorsoft@outlook.com>

2041 of 5832 branches covered (35.0%)

Branch coverage included in aggregate %.

0 of 2 new or added lines in 2 files covered. (0.0%)

3 existing lines in 1 file now uncovered.

3574 of 9082 relevant lines covered (39.35%)

45.82 hits per line

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

4.55
/libs/model/src/aggregates/token-allocation/UpdateClaimCliffTransactionHash.command.ts
1
import { InvalidState, logger, type Command } from '@hicommonwealth/core';
2
import * as schemas from '@hicommonwealth/schemas';
3
import { QueryTypes } from 'sequelize';
4
import { models } from '../../database';
5
import { validateClaimTxnHash } from '../../utils/validateClaimTxnHash';
6

7
const log = logger(import.meta);
31✔
8

9
export function UpdateClaimCliffTransactionHash(): Command<
10
  typeof schemas.UpdateClaimTransactionHash
11
> {
12
  return {
×
13
    ...schemas.UpdateClaimTransactionHash,
14
    auth: [],
15
    secure: true,
16
    body: async ({ payload, actor }) => {
NEW
17
      const { event_id, transaction_hash } = payload;
×
18

19
      const claimAddress = await models.ClaimAddresses.findOne({
×
20
        where: {
21
          event_id,
22
          user_id: actor.user.id,
23
        },
24
      });
25

26
      if (!claimAddress) {
×
27
        log.error('Claim address not found for user', undefined, {
×
28
          user_id: actor.user.id,
29
        });
30
        throw new InvalidState('Claim address not found');
×
31
      }
32

33
      if (
×
34
        claimAddress.magna_cliff_claim_tx_hash &&
×
35
        claimAddress.magna_cliff_claim_tx_at
36
      ) {
37
        return false;
×
38
      }
39

40
      if (!claimAddress.address) {
×
41
        throw new InvalidState(
×
42
          'Cannot set transaction hash without a claim address',
43
        );
44
      }
45

46
      const txnAt = await validateClaimTxnHash(
×
47
        transaction_hash,
48
        claimAddress.address,
49
      );
50

51
      const [, updated] = await models.sequelize.query(
×
52
        `
53
          UPDATE "ClaimAddresses"
54
          SET 
55
            magna_cliff_claim_tx_hash = :transaction_hash,
56
            magna_cliff_claim_tx_at = :transaction_at
57
          WHERE
58
            event_id = :event_id
59
            user_id = :user_id
60
            AND magna_cliff_claimed_at IS NOT NULL
61
            AND magna_cliff_claim_data IS NOT NULL
62
            AND magna_cliff_claim_tx_hash IS NULL;
63
        `,
64
        {
65
          type: QueryTypes.UPDATE,
66
          replacements: {
67
            event_id,
68
            user_id: actor.user.id,
69
            transaction_hash,
70
            transaction_at: txnAt,
71
          },
72
        },
73
      );
74

75
      return updated > 0;
×
76
    },
77
  };
78
}
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