Skip to content

Commit

Permalink
feat(meanings model): include captures_count field
Browse files Browse the repository at this point in the history
  • Loading branch information
Mloweedgar committed Feb 19, 2022
1 parent 89d19b5 commit 7de6322
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions server/models/Earnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@ const axios = require('axios').default;
const stakeholderUrl = `${process.env.TREETRACKER_STAKEHOLDER_API_URL}/stakeholders`;

const Earning = async ({
id,
worker_id,
funder_id,
amount,
currency,
calculated_at,
consolidation_rule_id,
consolidation_period_start,
consolidation_period_end,
payment_confirmation_id,
payment_system,
payment_confirmed_by,
payment_confirmation_method,
payment_confirmed_at,
paid_at,
status,
batch_id,
id,
worker_id,
funder_id,
captures_count,
amount,
currency,
calculated_at,
consolidation_rule_id,
consolidation_period_start,
consolidation_period_end,
payment_confirmation_id,
payment_system,
payment_confirmed_by,
payment_confirmation_method,
payment_confirmed_at,
paid_at,
status,
batch_id,
}) => {
const consolidation_rule = `CONSOLIDATION_RULE_${consolidation_rule_id}`;
const growerResponse = await axios.get(`${stakeholderUrl}?id=${worker_id}`);
Expand All @@ -29,6 +30,7 @@ const Earning = async ({
return Object.freeze({
id,
worker_id,
captures_count,
grower: `${growerResponse.data.stakeholders[0]?.first_name} ${growerResponse.data.stakeholders[0]?.last_name}`,
funder_id,
funder: funderResponse.data.stakeholders[0]?.org_name,
Expand Down

0 comments on commit 7de6322

Please sign in to comment.