Skip to content

Instantly share code, notes, and snippets.

@PamornT
Created May 29, 2022 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PamornT/bfc2d162362946bc7f279ae472be9541 to your computer and use it in GitHub Desktop.
Save PamornT/bfc2d162362946bc7f279ae472be9541 to your computer and use it in GitHub Desktop.
const checkPointExists = async(event) => {
try {
const userId = event.source.userId
const trackingId = event.videoPlayComplete.trackingId
const data = await admin.firestore()
.collection('collectPoint')
.where('userId', '==', userId)
.where('trackingId', '==', trackingId)
.get()
return !data.empty
} catch (error) {
console.error(error)
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment