-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Paro/rfq indexer updates suggs (#3243)
* fixing terminology * rfq-indexer-docs * Update RFQ Indexer API Readme (#3221) * adding dispute events to ponder and linting * numbering typo Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * small fixes * sync with master * API changes for disputes * fixing pending txs missing proofs * proof/dispute active & other tweaks/suggs * dispute col rename originChain prefix --------- Co-authored-by: defi-moses <[email protected]> Co-authored-by: Moses <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5c3686c
commit c63eb6e
Showing
16 changed files
with
346 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/rfq-indexer/api/src/controllers/disputesController.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Request, Response } from 'express' | ||
|
||
import { db } from '../db' | ||
import { qDisputes } from '../queries' | ||
import { nest_results } from '../utils/nestResults' | ||
|
||
export const disputesController = async (req: Request, res: Response) => { | ||
try { | ||
const query = db | ||
.with('disputes', () => qDisputes({activeOnly: true})) | ||
.selectFrom('disputes') | ||
.selectAll() | ||
.orderBy('blockTimestamp_dispute', 'desc') | ||
|
||
const results = await query.execute() | ||
const disputes = nest_results(results) | ||
|
||
if (disputes && disputes.length > 0) { | ||
res.json(disputes) | ||
} else { | ||
res.status(200).json({ message: 'No active disputes found' }) | ||
} | ||
} catch (error) { | ||
console.error('Error fetching active disputes:', error) | ||
res.status(500).json({ message: 'Internal server error' }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.