Skip to content

Feat: add GET /auth/pools endpoint#7

Closed
mukama wants to merge 4 commits intotetherto:developfrom
mukama:feat/pools
Closed

Feat: add GET /auth/pools endpoint#7
mukama wants to merge 4 commits intotetherto:developfrom
mukama:feat/pools

Conversation

@mukama
Copy link
Contributor

@mukama mukama commented Feb 12, 2026

Summary

  • Add GET /auth/pools endpoint returning merged pool data (device list + stats)
  • Support filter, sort, fields params (JSON-encoded, using mingo query engine)
  • Returns pools array with summary (poolCount, totalHashrate, totalWorkers, totalBalance)

Example Queries

All pools (no filters):

/auth/pools

Filter by status:

/auth/pools?filter=%7B%22status%22%3A%22active%22%7D

(decoded: {"status":"active"})

Sort by hashrate descending:

/auth/pools?sort=%7B%22hashrate%22%3A-1%7D

(decoded: {"hashrate":-1})

Select specific fields only:

/auth/pools?fields=%7B%22name%22%3A1%2C%22hashrate%22%3A1%2C%22balance%22%3A1%7D

(decoded: {"name":1,"hashrate":1,"balance":1})

Combined — active pools sorted by hashrate, selected fields:

/auth/pools?filter=%7B%22status%22%3A%22active%22%7D&sort=%7B%22hashrate%22%3A-1%7D&fields=%7B%22name%22%3A1%2C%22hashrate%22%3A1%7D

Add pools API endpoint that aggregates pool device lists and stats
from ORK clusters, supports mingo-based filtering, sorting, and
field selection, and returns pool summary with totals.
list-things for t-minerpool returns empty; pool data lives in ext-data
stats responses. Replaced flattenResults/flattenStatsResults/mergePoolData
with flattenPoolStats that parses the actual stats array format.
@mukama mukama changed the base branch from main to develop February 13, 2026 10:21
'use strict'

const schemas = {
query: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be similar to list-things schema
schema: {
querystring: {
type: 'object',
properties: {
query: { type: 'string' },
sort: { type: 'string' },
fields: { type: 'string' },
overwriteCache: { type: 'boolean' }
}
}

const filtered = {}
for (const key of Object.keys(fields)) {
if (fields[key] && pool[key] !== undefined) {
filtered[key] = pool[key]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use mingo projection instead

Align with list-things pattern by renaming filter→query. Replace manual
sort and field filtering with mingo cursor methods for consistency.
@mukama
Copy link
Contributor Author

mukama commented Feb 15, 2026

Moved to #11

@mukama mukama closed this Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants