(c *gin.Context)
| 26 | } |
| 27 | |
| 28 | func proofChainQuery(c *gin.Context) { |
| 29 | req := ProofChainRequest{} |
| 30 | if err := c.BindQuery(&req); err != nil { |
| 31 | errorResp(c, http.StatusBadRequest, xerrors.Errorf("Param error")) |
| 32 | return |
| 33 | } |
| 34 | if len(req.PersonaPubkeyHex) == 0 { |
| 35 | errorResp(c, http.StatusBadRequest, xerrors.Errorf("Param missing")) |
| 36 | return |
| 37 | } |
| 38 | |
| 39 | list, pagination, err := performProofChainQuery(req) |
| 40 | if err != nil { |
| 41 | errorResp(c, http.StatusInternalServerError, xerrors.Errorf("Error in DB: %w", err)) |
| 42 | return |
| 43 | } |
| 44 | |
| 45 | c.JSON(http.StatusOK, ProofChainResponse{ |
| 46 | Pagination: pagination, |
| 47 | ProofChains: list, |
| 48 | }) |
| 49 | } |
| 50 | |
| 51 | func performProofChainQuery(req ProofChainRequest) ([]model.ProofChainItem, ProofChainPaginationResponse, error) { |
| 52 | pagination := ProofChainPaginationResponse{ |
nothing calls this directly
no test coverage detected