@@ -10,28 +10,30 @@ import * as admin from 'firebase-admin';
1010import * as functions from 'firebase-functions' ;
1111
1212/** Unblocks the provided user from Github, clearing their records from our listing. */
13- export const unblockUser = functions
14- . runWith ( {
13+ export const unblockUser = functions . https . onCall < UnblockUserParams > (
14+ {
1515 secrets : [ 'ANGULAR_ROBOT_APP_PRIVATE_KEY' , 'ANGULAR_ROBOT_APP_ID' ] ,
16- } )
17- . https . onCall ( async ( { username} : UnblockUserParams , request ) => {
16+ } ,
17+ async ( request ) => {
18+ const { username} = request . data ;
1819 await checkAuthenticationAndAccess ( request ) ;
1920 /** The authenticated Github client for performing actions. */
2021 const github = await getAuthenticatedGithubClient ( ) ;
2122 /** The Firestore record of the user to be unblocked */
2223 const doc = await blockedUsersCollection ( ) . doc ( username ) . get ( ) ;
2324
2425 await performUnblock ( github , doc ) ;
25- } ) ;
26+ } ,
27+ ) ;
2628
2729/** Unblocks the all listed users who's block has expired, runs daily. */
28- export const dailyUnblock = functions
29- . runWith ( {
30+ export const dailyUnblock = functions . scheduler . onSchedule (
31+ {
32+ schedule : 'every day 08:00' ,
3033 secrets : [ 'ANGULAR_ROBOT_APP_PRIVATE_KEY' , 'ANGULAR_ROBOT_APP_ID' ] ,
31- } )
32- . pubsub . schedule ( 'every day 08:00' )
33- . timeZone ( 'America/Los_Angeles' )
34- . onRun ( async ( ) => {
34+ timeZone : 'America/Los_Angeles' ,
35+ } ,
36+ async ( ) => {
3537 /** The authenticated Github client for performing actions. */
3638 const github = await getAuthenticatedGithubClient ( ) ;
3739 /** The Firestore records for all users who's block has expired. */
@@ -40,7 +42,8 @@ export const dailyUnblock = functions
4042 . get ( ) ;
4143
4244 await Promise . all ( usersToUnblock . docs . map ( async ( user ) => performUnblock ( github , user ) ) ) ;
43- } ) ;
45+ } ,
46+ ) ;
4447
4548async function performUnblock ( github : Octokit , doc : admin . firestore . DocumentSnapshot < BlockedUser > ) {
4649 await github . orgs
0 commit comments