mirror of https://github.com/requarks/wiki
parent
925b3e1550
commit
0bd9c36db5
@ -0,0 +1,17 @@
|
||||
query {
|
||||
contribute {
|
||||
contributors {
|
||||
company
|
||||
currency
|
||||
description
|
||||
id
|
||||
image
|
||||
name
|
||||
profile
|
||||
tier
|
||||
totalDonated
|
||||
twitter
|
||||
website
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
const request = require('request-promise')
|
||||
const _ = require('lodash')
|
||||
|
||||
module.exports = {
|
||||
Query: {
|
||||
async contribute() { return {} }
|
||||
},
|
||||
ContributeQuery: {
|
||||
async contributors(obj, args, context, info) {
|
||||
const resp = await request({
|
||||
uri: 'https://opencollective.com/wikijs/members/all.json',
|
||||
json: true
|
||||
})
|
||||
const dude = _.filter(resp, c => {
|
||||
return c.role === 'BACKER' && c.totalAmountDonated > 0
|
||||
}).map(c => ({
|
||||
company: _.get(c, 'company', '') || '',
|
||||
currency: _.get(c, 'currency', 'USD') || 'USD',
|
||||
description: _.get(c, 'description', '') || '',
|
||||
id: _.get(c, 'MemberId', 0),
|
||||
image: _.get(c, 'image', '') || '',
|
||||
name: _.get(c, 'name', 'Anonymous') || '',
|
||||
profile: _.get(c, 'profile', ''),
|
||||
tier: _.toLower(_.get(c, 'tier', 'backers')),
|
||||
totalDonated: _.get(c, 'totalAmountDonated', 0),
|
||||
twitter: _.get(c, 'twitter', '') || '',
|
||||
website: _.get(c, 'website', '') || ''
|
||||
}))
|
||||
console.info(dude)
|
||||
return dude
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
# ===============================================
|
||||
# CONTRIBUTE
|
||||
# ===============================================
|
||||
|
||||
extend type Query {
|
||||
contribute: ContributeQuery
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# QUERIES
|
||||
# -----------------------------------------------
|
||||
|
||||
type ContributeQuery {
|
||||
contributors: [ContributeContributor]
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# TYPES
|
||||
# -----------------------------------------------
|
||||
|
||||
type ContributeContributor {
|
||||
company: String!
|
||||
currency: String!
|
||||
description: String!
|
||||
id: Int!
|
||||
image: String!
|
||||
name: String!
|
||||
profile: String!
|
||||
tier: String!
|
||||
totalDonated: Int!
|
||||
twitter: String!
|
||||
website: String!
|
||||
}
|
Loading…
Reference in new issue