Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static async createAlert(alertSchema) {
- return new Promise((resolve, reject) => {
- if (!testAlert(alertSchema)) {
- reject({error: testAlert.errors})
- }
- const alertsCollection = db.collection('serviceRequests')
- alertsCollection.add(alertSchema).then(ref => {
- resolve(ref)
- })
- .catch(err => {
- reject(err)
- })
- })
- }
- static async deleteAlert(alertRef) {
- return new Promise((resolve, reject) => {
- const alertsCollection = db.collection('serviceRequests')
- alertsCollection.doc(alertRef).delete().then(ret => {
- resolve(ret)
- }).catch(err => {
- reject(err)
- })
- })
- }
- // TODO: besoin de la fonction getCurrentUserFamily()
- /*
- static async getAlertFromCurrentUserFamily() {
- return new Promise((resolve, reject) => {
- const alertsCollection = db.collection('serviceRequests')
- const uid = auth.currentUser.uid
- alertsCollection.doc("lol").get().then(l => {
- resolve(l)
- }).catch(err => {
- reject(err)
- })
- })
- }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement