Skip to content

Commit

Permalink
fix saving events
Browse files Browse the repository at this point in the history
  • Loading branch information
ramilexe committed Mar 26, 2021
1 parent f29394a commit 34ccec8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/repositories/graphqlRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ export default class GraphqlRepository {
src
txData
txHash
blockByMhKey {
data
key
}
ethHeaderCidByHeaderId {
id
td
Expand Down
5 changes: 4 additions & 1 deletion src/services/dataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ VALUES

return getConnection().transaction(async (entityManager) => {
const transactionCidsRepository: TransactionCidsRepository = entityManager.getCustomRepository(TransactionCidsRepository);
const blockRepository: BlockRepository = entityManager.getCustomRepository(BlockRepository);

await blockRepository.add(ethTransaction.mhKey, ethTransaction.blockByMhKey.data); // eslint-disable-line
const transaction = await transactionCidsRepository.add(headerId, ethTransaction);

return transaction;
Expand All @@ -299,7 +302,7 @@ VALUES
const headerCidsRepository: HeaderCidsRepository = entityManager.getCustomRepository(HeaderCidsRepository);
const blockRepository: BlockRepository = entityManager.getCustomRepository(BlockRepository);

const newBlock = await blockRepository.add(relatedNode.mhKey, relatedNode.blockByMhKey.data); // eslint-disable-line
await blockRepository.add(relatedNode.mhKey, relatedNode.blockByMhKey.data); // eslint-disable-line
const header = await headerCidsRepository.add(relatedNode);

return header;
Expand Down
1 change: 1 addition & 0 deletions src/types/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type EthTransactionCid = {
txData: Buffer;
txHash: string;
ethHeaderCidByHeaderId: EthHeaderCid;
blockByMhKey: BlockByMhKey;
};

export type EthHeaderCid = {
Expand Down

0 comments on commit 34ccec8

Please sign in to comment.