(req ProofChainRequest)
| 49 | } |
| 50 | |
| 51 | func 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 | } |
no test coverage detected