File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
const debug = require ( 'debug' ) ( 'store' )
2
2
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
+
3
14
const addGithubOrganization = knex => async ( organization ) => {
4
15
const organizationExists = await knex ( 'github_organizations' ) . where ( { html_url : organization . html_url } ) . first ( )
5
16
debug ( `Checking if organization (${ organization . login } ) exists...` )
@@ -31,7 +42,9 @@ const initializeStore = (knex) => {
31
42
debug ( 'Initializing store...' )
32
43
return {
33
44
addProject : addProject ( knex ) ,
34
- addGithubOrganization : addGithubOrganization ( knex )
45
+ addGithubOrganization : addGithubOrganization ( knex ) ,
46
+ getAllGithubOrganizations : getAllGithubOrganizations ( knex ) ,
47
+ updateGithubOrganization : updateGithubOrganization ( knex )
35
48
}
36
49
}
37
50
You can’t perform that action at this time.
0 commit comments