spee.ch/server/controllers/api/channel/claims/getChannelClaims.js

15 lines
699 B
JavaScript

const db = require('../../../../models');
const chainquery = require('chainquery');
const getClaimData = require('server/utils/getClaimData');
const { returnPaginatedChannelClaims } = require('./channelPagination.js');
const getChannelClaims = async (channelName, channelShortId, page) => {
const channelId = await chainquery.claim.queries.getLongClaimId(channelName, channelShortId);
const channelClaims = await chainquery.claim.queries.getAllChannelClaims(channelId);
const processedChannelClaims = await channelClaims.map((claim) => getClaimData(claim));
return returnPaginatedChannelClaims(channelName, channelId, processedChannelClaims, page);
};
module.exports = getChannelClaims;