Skip to content

Commit fab37f3

Browse files
committed
feat: extend github store capabilities
1 parent 9eee7a6 commit fab37f3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/store/index.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
const debug = require('debug')('store')
22

3+
const getAllGithubOrganizations = knex => async () => {
4+
debug('Getting all GitHub organizations...')
5+
return knex('github_organizations').select()
6+
}
7+
8+
const updateGithubOrganization = knex => async (organization) => {
9+
const { login } = organization
10+
debug(`Updating organization (${login})...`)
11+
return knex('github_organizations').where({ login }).update(organization)
12+
}
13+
314
const addGithubOrganization = knex => async (organization) => {
415
const organizationExists = await knex('github_organizations').where({ html_url: organization.html_url }).first()
516
debug(`Checking if organization (${organization.login}) exists...`)
@@ -31,7 +42,9 @@ const initializeStore = (knex) => {
3142
debug('Initializing store...')
3243
return {
3344
addProject: addProject(knex),
34-
addGithubOrganization: addGithubOrganization(knex)
45+
addGithubOrganization: addGithubOrganization(knex),
46+
getAllGithubOrganizations: getAllGithubOrganizations(knex),
47+
updateGithubOrganization: updateGithubOrganization(knex)
3548
}
3649
}
3750

0 commit comments

Comments
 (0)