MCPcopy Create free account
hub / github.com/NextDotID/proof_server / performProofChainQuery

Function performProofChainQuery

controller/proof_chain.go:51–70  ·  view source on GitHub ↗
(req ProofChainRequest)

Source from the content-addressed store, hash-verified

49}
50
51func performProofChainQuery(req ProofChainRequest) ([]model.ProofChainItem, ProofChainPaginationResponse, error) {
52 pagination := ProofChainPaginationResponse{
53 Total: 0,
54 Per: PER_PAGE,
55 Current: req.Page,
56 Next: 0,
57 }
58 if pagination.Current <= 0 { // `page` param not provided. Set it to 1.
59 pagination.Current = 1
60 }
61 offsetCount := pagination.Per * (pagination.Current - 1)
62
63 total, rs, err := model.ProofChainFindByPersona(req.PersonaPubkeyHex, false, offsetCount, pagination.Per)
64 pagination.Total = total
65 if total > int64(pagination.Per*pagination.Current) {
66 pagination.Next = pagination.Current + 1
67 }
68
69 return rs, pagination, err
70}

Callers 1

proofChainQueryFunction · 0.85

Calls 1

ProofChainFindByPersonaFunction · 0.92

Tested by

no test coverage detected