Skip to content

Expose is_active, report_count and moderator address over the API #1038

Description

@BigBen-7

GistPin — GrantFox bounty issue. Reviewed against the acceptance criteria below. Read contracts/README.md first — it has the full ABI, event schema, and error codes for the deployed contract.

Context

The contract exposes read-only state (is_active, report_count,
get_admin) that isn't surfaced over HTTP yet.

Problem

There's no way for a client of the REST API to check whether a specific gist
is still active, how many reports it has, or who the current moderator is —
all of which are already computed on-chain (and, after the indexer issues
land, mirrored in Postgres).

Scope

In scope:

  • GET /v1/gists/:id response includes is_active and report_count
    (sourced from Postgres, not a live chain call, for performance — the
    indexer keeps this fresh).
  • New lightweight endpoint GET /v1/moderator (or similar — your call, keep
    it RESTful) returning the current moderator address.
  • Swagger docs (@ApiProperty/@ApiOperation) for all new fields/routes,
    consistent with the existing style in gists.controller.ts.

Out of scope: the report-submission endpoint itself (separate issue),
any write operations.

Acceptance Criteria

  • GET /v1/gists/:id includes is_active and report_count
  • A new endpoint exposes the current moderator address
  • Swagger (/v1/docs) documents all new/changed response fields
  • Unit tests cover the new response shape
  • npm run build && npm run test:cov pass

How to verify your own work

cd Backend && npm run start:dev
curl http://localhost:3000/v1/gists/<some-id>
open http://localhost:3000/v1/docs

Depends on: the "hidden column" and "event persistence" issues for the
data to be meaningful (can be built against a manually-seeded DB in the
meantime).
Estimated effort: Small (a day or less). Good pick if you want a
self-contained, low-risk first contribution. Suitable for a first-time contributor.

Metadata

Metadata

Assignees

Labels

BackendBackend issuesGrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaigngood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions