@@ -346,16 +346,15 @@ exports.decProjectProgress = functions.database.ref('/v2/projects/{projectId}/re
346346
347347exports . addProjectTopicKey = functions . https . onRequest ( async ( _ , res ) => {
348348 try {
349- const projectRef = admin . database ( ) . ref ( 'v2/projects' ) ;
350- const snapshot = projectRef . once ( 'value' ) ;
351- const data = ( await snapshot ) . val ( ) ;
349+ const projectRef = await admin . database ( ) . ref ( 'v2/projects' ) . once ( 'value' ) ;
350+ const data = projectRef . val ( ) ;
352351
353352 if ( data ) {
354353 const newProjectData : { [ key : string ] : string } = { } ;
355354
356355 Object . keys ( data ) . forEach ( ( id ) => {
357356 if ( data [ id ] ?. projectTopic ) {
358- const newProjectTopicKey = data [ id ] ? .projectTopic ?. toLowerCase ( ) as string ;
357+ const newProjectTopicKey = data [ id ] . projectTopic ?. toLowerCase ( ) as string ;
359358 newProjectData [ `v2/projects/${ id } /projectTopicKey` ] = newProjectTopicKey ;
360359 }
361360 } ) ;
@@ -377,16 +376,15 @@ exports.addProjectTopicKey = functions.https.onRequest(async (_, res) => {
377376
378377exports . addUserNameLowercase = functions . https . onRequest ( async ( _ , res ) => {
379378 try {
380- const userRef = admin . database ( ) . ref ( 'v2/users' ) ;
381- const snapshot = userRef . once ( 'value' ) ;
382- const data = ( await snapshot ) . val ( ) ;
379+ const userRef = await admin . database ( ) . ref ( 'v2/users' ) . once ( 'value' ) ;
380+ const data = userRef . val ( ) ;
383381
384382 if ( data ) {
385383 const newUserData : { [ key : string ] : string } = { } ;
386384
387385 Object . keys ( data ) . forEach ( ( id ) => {
388386 if ( data [ id ] ?. username ) {
389- const newUserNameKey = data [ id ] ? .username ?. toLowerCase ( ) as string ;
387+ const newUserNameKey = data [ id ] . username ?. toLowerCase ( ) as string ;
390388 newUserData [ `v2/users/${ id } /userNameKey` ] = newUserNameKey ;
391389 }
392390 } ) ;
0 commit comments