0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-01 10:52:46 +00:00

Fix metadata in Google docs

Update view counts via service account since modifying another users' file properties requires increased permission scope
This commit is contained in:
Trevor Buckner
2020-11-22 23:53:34 -05:00
parent 3b52888877
commit 7462e66858
4 changed files with 86 additions and 31 deletions

View File

@@ -149,6 +149,10 @@ app.get('/share/:id', (req, res, next)=>{
const googleId = req.params.id.slice(0, -12);
const shareId = req.params.id.slice(-12);
GoogleActions.readFileMetadata(config.get('google_api_key'), googleId, shareId, 'share')
.then((brew)=>{
GoogleActions.increaseView(googleId, shareId, 'share', brew);
return brew;
})
.then((brew)=>{
req.brew = brew; //TODO Need to sanitize later
return next();