How to use firebase-function-tools - 3 common examples

To help you get started, we’ve selected a few firebase-function-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TarikHuber / react-most-wanted / packages / cra-template-rmw / template / functions / db / userChatMessages / onCreate.f.js View on Github external
let notifyUser = null

      if (snapValues.authorUid !== receiverUid) {
        const payload = {
          notification: {
            title: `${snapValues.authorName} `,
            body: lastMessage,
            icon: snapValues.authorPhotoUrl
              ? snapValues.authorPhotoUrl
              : '/apple-touch-icon.png',
            click_action: `https://www.react-most-wanted.com/chats/edit/${senderUid}`,
            tag: `chat`,
          },
        }

        notifyUser = notifications.notifyUser(receiverUid, payload).then(() => {
          return senderChatMessageRef
            .update({
              isReceived: context.timestamp,
            })
            .then(() => {
              return senderChatRef.update({
                isReceived: context.timestamp,
              })
            })
        })
      }

      return Promise.all([
        udateReceiverChatMessage,
        udateSenderChat,
        udateReceiverChat,
github TarikHuber / react-most-wanted / packages / cra-template-rmw / template / functions / storage / thumbnails.js View on Github external
export default async function(object) {
  const thumbnail = await createThumbnail(object)

  if (thumbnail) {
    const { fileDir, downloadURL } = thumbnail

    await admin
      .database()
      .ref(fileDir)
      .update({ thumbnail: downloadURL })
  }

  return
}
github TarikHuber / react-most-wanted / packages / cra-template-rmw / template / functions / db / usersCount / onDelete.f.js View on Github external
export default database.ref('/users_count').onDelete((data, context) => {
  const getDBUsers = admin
    .database()
    .ref('users')
    .once('value')
  const getAuthUsers = usersUtil.listAllUsers()

  return Promise.all([getDBUsers, getAuthUsers]).then(resulsts => {
    const dbUsers = resulsts[0]
    const authUsers = resulsts[1]
    let promises = []

    let userUids = []
    let providerCount = {}
    let usersPublicData = {}
    let usersNotificationTokens = {}

    authUsers.forEach(userRecord => {
      const user = userRecord.toJSON()
      let userPublicProviderData = {}

      const creationTime = moment(user.metadata.creationTime)

firebase-function-tools

firebase-function-tools

MIT
Latest version published 4 years ago

Package Health Score

60 / 100
Full package analysis