Skip to content

Commit

Permalink
fix: pin status metrics returns data object (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored Nov 15, 2021
1 parent c6a7171 commit 20877ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
module.exports = () => {
return {
statusCode: 200,
body: '30000'
body: [{
pin_from_status_total: '30000'
}]
}
}
4 changes: 2 additions & 2 deletions packages/db/postgres/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ const pinStatusMapping = {

export async function getPinStatusMetrics (client, key) {
const pinStatus = pinStatusMapping[key]
const { count, error } = await client.rpc('pin_from_status_total', { query_status: pinStatus })
const { data, error } = await client.rpc('pin_from_status_total', { query_status: pinStatus })

if (error) {
throw new DBError(error)
}

return {
total: count
total: data[0].pin_from_status_total
}
}

0 comments on commit 20877ae

Please sign in to comment.