Skip to content

Commit

Permalink
Move uploaded Storage objects to Google Drive
Browse files Browse the repository at this point in the history
When files are uploaded to the Storage bucket path `independent-assessments/*`, a Cloud Function will move them into Google Drive.
For now, the runtime variables at `src/moveIndependentAssessmentToGoogleDrive.js:10` are hardcoded. Eventually these will be driven by metadata that comes with the upload.
  • Loading branch information
ollietreend committed Mar 29, 2019
1 parent 6d27613 commit 6079a59
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 150 deletions.
10 changes: 10 additions & 0 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,13 @@ exports.sendApplicationSubmittedEmail = functions.firestore
}
return true;
});

exports.moveIndependentAssessmentToGoogleDrive = functions.storage
.object()
.onFinalize((object) => {
if (object.name.startsWith('independent-assessments/')) {
const handler = require('./src/moveIndependentAssessmentToGoogleDrive');
return handler(object);
}
return true;
});
Loading

0 comments on commit 6079a59

Please sign in to comment.