Skip to content

Instantly share code, notes, and snippets.

@mateusduraes
Created January 9, 2020 17:18
Show Gist options
  • Save mateusduraes/c4ef21f921338140e83bb8e5cb6b83e4 to your computer and use it in GitHub Desktop.
Save mateusduraes/c4ef21f921338140e83bb8e5cb6b83e4 to your computer and use it in GitHub Desktop.
* Database (Firestore)
* Authentication
* Functions
* Triggers
Registrando objetos com AngularFire2 - See docs
Estrutura do banco
{
channels: {
1: {
title: 'blabla'
}
},
messages: {
1: {
channelId: 1,
message: 'ola'
}
}
}
Listando mensagens com AngularFire2 - See docs
db.collection('/messages').where('channelId', 1)
Triggers
https://firebase.google.com/docs/functions/firestore-events
Exemplo push notification
onCreate('messages/{id}', () => {
// send push
})
Exemplo update last message
onCreate('messages/{id}', () => {
// update last message
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment