Advertisement
Guest User

Untitled

a guest
Aug 24th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict";
  2.  
  3. const moment = require('moment')
  4. const admin = require("firebase-admin")
  5. const functions = require("firebase-functions")
  6.  
  7. admin.initializeApp(functions.config().firebase)
  8.  
  9. // const nodemailer = require('nodemailer')
  10.  
  11. // const gmailEmail = functions.config().gmail.email;
  12. // const gmailPassword = functions.config().gmail.password;
  13. // const mailTransport = nodemailer.createTransport({
  14. //  service: 'gmail',
  15. //  auth: {
  16. //      user: gmailEmail,
  17. //      pass: gmailPassword,
  18. //  },
  19. // });
  20.  
  21. // const APP_NAME = 'Nur Al-Zaytouna'
  22.  
  23. // exports.sendWelcomeEmail = functions.auth.user().onCreate((event) => {
  24. //  const user = event.data
  25.  
  26. //  const email = user.email
  27. //  const displayName = user.displayName
  28.  
  29. //  return sendEmail(email, displayName);
  30. // });
  31.  
  32. // function sendEmail(email, displayName) {
  33. //  const mailOptions = {
  34. //      from: `${APP_NAME} noreply`,
  35. //      to: email,
  36. //  };
  37.  
  38. //  mailOptions.subject = `Bienvenue à ${APP_NAME}!`;
  39. //  mailOptions.text = `Bienvenue ${displayName || ''} à Nur Al Zaytouna! \n L'équipe Nur`
  40.    
  41. //  return mailTransport.sendMail(mailOptions).then(() => {
  42. //      return console.log('New welcome email sent to:', email);
  43. //  });
  44. // }
  45.  
  46. // exports.postFacebookContent = functions.https.onRequest((req, res) => {
  47.  
  48. //  console.log(JSON.stringify(req.body))
  49.  
  50. //  return admin.auth().getUser("nk0LlyCqEJhhPAl7QXC9MdIhmYr1").then(user => {
  51.  
  52. //      let postData = {
  53. //          userID: user.uid,
  54. //          timestamp: admin.database.ServerValue.TIMESTAMP,
  55. //          numberOfLikes: 0,
  56. //          numberOfComments: 0,
  57. //          numberOfShares: 0,
  58. //          userPic: user.photoURL,
  59. //          displayName: user.displayName,
  60. //          postText: req.body.entry[0].changes[0].value.message || ''
  61. //      }
  62.  
  63. //      if (req.body.entry[0].changes[0].value.item === "photo") {
  64. //          postData.photo = req.body.entry[0].changes[0].value.link || null
  65. //      }
  66.  
  67. //      if (req.body.entry[0].changes[0].value.item === "video") {
  68. //          postData.video = req.body.entry[0].changes[0].value.link || null
  69. //      }
  70.  
  71. //      const newKey = admin.database().ref('/posts').push().key
  72.  
  73. //      let updates = {}
  74. //      updates['/posts/' + newKey] = postData
  75. //      updates['/users/' + user.uid + '/posts/' + newKey] = postData
  76.  
  77. //      return admin.database().ref().update(updates).then(() => {
  78. //          console.log('success')
  79. //          return res.status(200).send()
  80. //      })
  81. //  })
  82.  
  83. //  // if (req.query['hub.verify_token'] === '123456789') {
  84. //  //  res.status(200).send(req.query['hub.challenge'])
  85. //  // } else {
  86. //  //  res.status(404).send('Error Token')
  87. //  // }
  88. // })
  89.  
  90. exports.sendShareNotification = functions.database
  91.     .ref('/shares/{ShareKey}')
  92.     .onWrite((change, context) => {
  93.  
  94.         //const shareData = event.data.val()
  95.         const shareData = change.after.val()
  96.  
  97.         // WhoShared: Backend.auth().currentUser.uid,
  98.         // Owner: this.props.uid,
  99.         // PostID: this.props.Key
  100.  
  101.         return Promise.all([
  102.             admin.auth().getUser(shareData.WhoShared),
  103.             admin.database().ref('/users/' + shareData.Owner + '/token').once('value'),
  104.             admin.database().ref(`/users/${shareData.Owner}/numberOfNotifications`).once('value')
  105.         ]).then(results => {
  106.             const UserWhoShared = results[0]
  107.             const PostOwnerToken = results[1].val()
  108.             let numberOfNotifications = results[2].val() ? results[2].val() : 0
  109.  
  110.             if (PostOwnerToken === null) {
  111.                 return console.log('The user has no token')
  112.             }
  113.  
  114.             const payload = {
  115.                 notification: {
  116.                     title: 'Nur Al-Zaytouna',
  117.                     body: `${UserWhoShared.displayName} a partagé votre post.`
  118.                 },
  119.                 data: {
  120.                     title: `Nur Al-Zaytouna`,
  121.                     body: `${UserWhoShared.displayName} a partagé votre post.`
  122.                 }
  123.             }
  124.  
  125.             return admin.messaging().sendToDevice(PostOwnerToken, payload).then(response => {
  126.                 return admin.database().ref(`/users/${shareData.Owner}/notifications`)
  127.                         .push({
  128.                             seen: false,
  129.                             type: 'share',
  130.                             UID: shareData.PostID,
  131.                             name: UserWhoShared.displayName,
  132.                             whoImage: UserWhoShared.photoURL || '',
  133.                             timestamp: admin.database.ServerValue.TIMESTAMP
  134.                         }).then(() => {
  135.                             numberOfNotifications++;
  136.                             return admin.database().ref(`/users/${shareData.Owner}/numberOfNotifications`).set(numberOfNotifications)
  137.                                     .then(() => {
  138.                                         return console.log('Operation Success')
  139.                                     })
  140.                         })
  141.             })
  142.         })
  143.     })
  144.  
  145. exports.sendCommentSecondNotification = functions.database
  146.     .ref('/posts/{PostUID}/comments/{CommentUID}')
  147.     .onWrite((change, context) => {
  148.         const Comment = change.after.val()
  149.         const PostUID = context.params.PostUID
  150.         const CommentUID = context.params.CommentUID
  151.  
  152.         // send notifications to all user that commented except the post's owner (handeled by the function below) and the one who commented
  153.         const getPostOwnerUID = admin.database().ref(`/posts/${PostUID}/userID`).once('value')
  154.         const getAllComments = admin.database().ref(`/posts/${PostUID}/comments`).once('value')
  155.  
  156.         return Promise.all([
  157.             getPostOwnerUID,
  158.             getAllComments
  159.         ]).then(results => {
  160.             const PostOwnerUID = results[0].val()
  161.             const CommentsSnapchot = results[1]
  162.  
  163.             const AllUsersWhoCommentedUIDS = []
  164.  
  165.             CommentsSnapchot.forEach(CommentSnapchot => {
  166.                 AllUsersWhoCommentedUIDS.push(CommentSnapchot.child('uid').val())
  167.             })
  168.  
  169.             let tokenPromises = []
  170.  
  171.             AllUsersWhoCommentedUIDS.forEach(userWhoCommentedUID => {
  172.                 if (userWhoCommentedUID !== PostOwnerUID && userWhoCommentedUID !== Comment.uid) {
  173.                     tokenPromises.push(
  174.                         admin.database().ref(`/users/${userWhoCommentedUID}/token`).once('value')
  175.                     )
  176.                 }
  177.             })
  178.  
  179.             return Promise.all(tokenPromises).then(results => {
  180.  
  181.                 let payload = {
  182.                     notification: {
  183.                         title: 'Nur Al-Zaytouna',
  184.                         body: `${Comment.displayName} a commenté un post que vous avez commenté.`
  185.                     },
  186.                     data: {
  187.                         title: 'Nur Al-Zaytouna',
  188.                         body: `${Comment.displayName} a commenté un post que vous avez commenté.`
  189.                     }
  190.                 }
  191.  
  192.                 let tokens = []
  193.  
  194.                 results.forEach(tokenSnapchot => {
  195.                     tokens.push(tokenSnapchot.val())
  196.                 })
  197.  
  198.                 return admin.messaging().sendToDevice(tokens, payload).then(response => {
  199.                     response.results.forEach((result, index) => {
  200.                         const error = result.error
  201.  
  202.                         if (error) {
  203.                             return console.error('Failure sending notification to', tokens[index], error)
  204.                         } else {
  205.                             return admin.database().ref(`/users/${AllUsersWhoCommentedUIDS[index]}/numberOfNotifications`).once('value')
  206.                                     .then(snapchot => {
  207.                                         let numberOfNotifications = snapchot.val() ? snapchot.val() : 0
  208.  
  209.                                         numberOfNotifications++
  210.  
  211.                                         return admin.database().ref(`/users/${AllUsersWhoCommentedUIDS[index]}/numberOfNotifications`).set(numberOfNotifications)
  212.                                                 .then(() => {
  213.                                                     return console.log('Operation Success');
  214.                                                 })
  215.                                     })
  216.                         }
  217.                     });
  218.  
  219.                     return console.log('Done')
  220.                 })
  221.             })
  222.         })
  223.     })
  224.  
  225. exports.sendCommentNotification = functions.database
  226.     .ref('/posts/{PostUID}/comments/{CommentUID}')
  227.     .onWrite((change, context) => {
  228.         const Comment = change.after.val()
  229.         const PostUID = context.params.PostUID
  230.         const CommentUID = context.params.CommentUID
  231.  
  232.         const getPostOwnerUID = admin.database().ref(`/posts/${PostUID}/userID`).once('value')
  233.  
  234.         return admin.database().ref(`/posts/${PostUID}/userID`).once('value').then(snapchot => {
  235.             const ownerUID = snapchot.val()
  236.  
  237.             if (ownerUID === Comment.uid) {
  238.                 return console.log('Same user commented')
  239.             }
  240.  
  241.             const getUserWhoCommentedPromise = admin.auth().getUser(Comment.uid)
  242.             const getPostOwnerTokenPromise = admin.database().ref(`/users/${ownerUID}/token`).once('value')
  243.             const getNumberOfNotificationsPromise = admin.database().ref(`/users/${ownerUID}/numberOfNotifications`).once('value')
  244.  
  245.             return Promise.all([
  246.                 getUserWhoCommentedPromise,
  247.                 getPostOwnerTokenPromise,
  248.                 getNumberOfNotificationsPromise
  249.             ]).then(results => {
  250.                 const UserWhoCommented = results[0]
  251.                 const PostOwnerToken = results[1].val()
  252.                 let numberOfNotifications = results[2].val() ? results[2].val() : 0
  253.  
  254.                 if (PostOwnerToken === null) {
  255.                     return console.log('No token found')
  256.                 }
  257.  
  258.                 const payload = {
  259.                     notification: {
  260.                         title: 'Nur Al-Zaytouna',
  261.                         body: `${UserWhoCommented.displayName} a commenté votre post.`
  262.                     },
  263.                     data: {
  264.                         title: `Nur Al-Zaytouna`,
  265.                         body: `${UserWhoCommented.displayName} a commenté votre post.`
  266.                     }
  267.                 }
  268.  
  269.                 return admin.messaging().sendToDevice(PostOwnerToken, payload).then(response => {
  270.                     return admin.database().ref(`/users/${ownerUID}/notifications`)
  271.                             .push({
  272.                                 seen: false,
  273.                                 type: 'comment',
  274.                                 UID: PostUID,
  275.                                 name: UserWhoCommented.displayName,
  276.                                 whoImage: UserWhoCommented.photoURL || '',
  277.                                 timestamp: admin.database.ServerValue.TIMESTAMP
  278.                             }).then(() => {
  279.                                 numberOfNotifications++;
  280.                                 return admin.database().ref(`/users/${ownerUID}/numberOfNotifications`).set(numberOfNotifications)
  281.                                         .then(() => {
  282.                                             return console.log('Operation Success')
  283.                                         })
  284.                             })
  285.                 })
  286.             })
  287.         })
  288.     })
  289.  
  290. exports.sendLikeNotification = functions.database
  291.     .ref('/posts/{PostUid}/likes/{UserWhoLikedThePostUid}')
  292.     .onWrite((change, context) => {
  293.         const PostUid = context.params.PostUid;
  294.         const UserWhoLikedThePostUid = context.params.UserWhoLikedThePostUid;
  295.  
  296.         // If un-follow we exit the function.
  297.         if (!event.data.val()) {
  298.             return console.log('Dislike');
  299.         }
  300.  
  301.         const getUserWhoLikedPromise = admin.auth().getUser(UserWhoLikedThePostUid)
  302.         const getPostOwnerUID = admin.database().ref(`/posts/${PostUid}/userID`).once('value')
  303.        
  304.         return Promise.all([
  305.             getUserWhoLikedPromise,
  306.             getPostOwnerUID
  307.         ]).then(results => {
  308.             const UserWhoLiked = results[0]
  309.             const PostOwnerUIDSnapchot = results[1]
  310.  
  311.             if (UserWhoLikedThePostUid === PostOwnerUIDSnapchot.val()) {
  312.                 return console.log(
  313.                     'Same person liked his post'   
  314.                 );
  315.             }
  316.  
  317.             const getTokenPromise = admin.database().ref(`/users/${PostOwnerUIDSnapchot.val()}/token`).once('value')
  318.             const getNumberOfNotificationsPromise = admin.database().ref(`/users/${PostOwnerUIDSnapchot.val()}/numberOfNotifications`).once('value')
  319.  
  320.             return Promise.all([
  321.                 getTokenPromise,
  322.                 getNumberOfNotificationsPromise
  323.             ])
  324.             .then(results => {
  325.                 const tokenSnapshot = results[0];
  326.                 let numberOfNotifications = results[1].val() ? results[1].val() : 0
  327.  
  328.                 // Check if there are any device tokens.
  329.                 if (tokenSnapshot.val() === null) {
  330.                     return console.log(
  331.                         "There are no notification tokens to send to."
  332.                     );
  333.                 }
  334.  
  335.                 const token = tokenSnapshot.val()
  336.  
  337.                 const payload = {
  338.                     notification: {
  339.                         title: 'Nur Al-Zaytouna',
  340.                         body: `${UserWhoLiked.displayName} aime votre publication.`
  341.                     },
  342.                     data: {
  343.                         title: `Nur Al-Zaytouna`,
  344.                         body: `${UserWhoLiked.displayName} aime votre publication.`
  345.                     }
  346.                 };
  347.  
  348.                 return admin.messaging().sendToDevice(token, payload).then(response => {
  349.                     return admin.database().ref(`/users/${PostOwnerUIDSnapchot.val()}/notifications`)
  350.                             .push({
  351.                                 seen: false,
  352.                                 type: 'like',
  353.                                 UID: PostUid,
  354.                                 name: UserWhoLiked.displayName,
  355.                                 whoImage: UserWhoLiked.photoURL || '',
  356.                                 timestamp: admin.database.ServerValue.TIMESTAMP
  357.                             }).then(() => {
  358.                                 numberOfNotifications++;
  359.                                 return admin.database().ref(`/users/${PostOwnerUIDSnapchot.val()}/numberOfNotifications`).set(numberOfNotifications)
  360.                                         .then(() => {
  361.                                             return console.log('Operation Success')
  362.                                         })
  363.                             })
  364.                 })
  365.             })
  366.         })
  367.     })
  368.  
  369.  
  370. exports.sendFollowerNotification = functions.database
  371.     .ref("/followers/{followedUid}/{followerUid}")
  372.     .onWrite((change, context) => {
  373.         const followerUid = context.params.followerUid;
  374.         const followedUid = context.params.followedUid;
  375.         // If un-follow we exit the function.
  376.         if (!change.after.val()) {
  377.             return console.log(
  378.                 "User ",
  379.                 followerUid,
  380.                 "un-followed user",
  381.                 followedUid
  382.             );
  383.         }
  384.         console.log(
  385.             "We have a new follower UID:",
  386.             followerUid,
  387.             "for user:",
  388.             followedUid
  389.         );
  390.  
  391.         // Get the list of device notification tokens.
  392.         const getDeviceTokenPromise = admin
  393.             .database()
  394.             .ref(`/users/${followedUid}/token`)
  395.             .once("value");
  396.  
  397.         // Get the follower profile.
  398.         const getFollowerProfilePromise = admin.auth().getUser(followerUid)
  399.         const getNumberOfNotificationsPromise = admin.database().ref(`/users/${followedUid}/numberOfNotifications`).once('value')
  400.  
  401.         return Promise.all([
  402.             getDeviceTokenPromise,
  403.             getFollowerProfilePromise,
  404.             getNumberOfNotificationsPromise
  405.         ]).then(results => {
  406.             const tokenSnapshot = results[0];
  407.             const follower = results[1];
  408.             let numberOfNotifications = results[2].val() ? results[2].val() : 0
  409.  
  410.             // Check if there are any device tokens.
  411.             if (tokenSnapshot.val() === null || tokenSnapshot.val() === undefined) {
  412.                 return console.log(
  413.                     "There are no notification tokens to send to."
  414.                 );
  415.             }
  416.  
  417.             // Notification details.
  418.             const payload = {
  419.                 notification: {
  420.                     title: 'Nur Al-Zaytouna',
  421.                     body: `${follower.displayName} a commencé a vous suivre.`
  422.                 },
  423.                 data: {
  424.                     title: "Nouveau abonnée!",
  425.                     body: `${follower.displayName} a commencé a vous suivre.`
  426.                 }
  427.             };
  428.  
  429.             // Listing all tokens.
  430.             const token = tokenSnapshot.val()
  431.  
  432.             // Send notifications to all tokens.
  433.             return admin
  434.                 .messaging()
  435.                 .sendToDevice(token, payload)
  436.                 .then(response => {
  437.                     return admin.database().ref(`/users/${followedUid}/notifications`)
  438.                             .push({
  439.                                 seen: false,
  440.                                 type: 'follow',
  441.                                 UID: followerUid,
  442.                                 name: follower.displayName,
  443.                                 whoImage: follower.photoURL || '',
  444.                                 timestamp: admin.database.ServerValue.TIMESTAMP
  445.                             }).then(() => {
  446.                                 numberOfNotifications++
  447.                                 return admin.database().ref(`/users/${followedUid}/numberOfNotifications`).set(numberOfNotifications)
  448.                                         .then(() => {
  449.                                             return console.log('Operation Success')
  450.                                         })
  451.                             })
  452.                 });
  453.         });
  454.     });
  455.  
  456.  
  457. exports.writePostToFollowersFeed = functions.database.ref('/users/{UserUID}/posts/{PostUID}').onWrite((change, context) => {
  458.  
  459.     // get followers of UserUID
  460.     const UserUID = context.params.UserUID
  461.     const PostUID = context.params.PostUID
  462.  
  463.     const followers = []
  464.  
  465.     return admin.database().ref(`/users/${UserUID}/followers`).once('value')
  466.  
  467.     .then((snapshot) => {
  468.         let promises = []
  469.  
  470.         promises.push(
  471.             admin.database().ref(`/feed/${UserUID}/${PostUID}`).set(true)
  472.         )
  473.  
  474.         snapshot.forEach(follower => {
  475.             // false
  476.             if (follower.val()) {
  477.                 promises.push(
  478.                     admin.database().ref(`/feed/${follower.key}/${PostUID}`).set(true)
  479.                 )
  480.             }
  481.         })
  482.  
  483.         return Promise.all(promises)
  484.     })
  485.  
  486.     .then((results) => {
  487.         return console.log(`Done Posting this post ${PostUID} to the followers feeds`)
  488.     })
  489.  
  490.     .catch(error => {
  491.         console.log(error)
  492.     })
  493. })
  494.  
  495. exports.getFeedForUserUID = functions.region('europe-west1').https.onRequest((request, response) => {
  496.  
  497.     if (request.query.uid === undefined) {
  498.         return response.status(500).send('User UID required')
  499.     }
  500.  
  501.     const UserUID = request.query.uid
  502.     const lastPostUID = request.query.lastPostUID
  503.  
  504.     if (lastPostUID === 'end') {
  505.         return response.status(200).send([])
  506.     }
  507.  
  508.     // lastPostID
  509.     if (lastPostUID === undefined) {
  510.         return admin
  511.             .database()
  512.             .ref(`/feed/${UserUID}`)
  513.             .orderByKey()
  514.             .limitToLast(10)
  515.             .once('value')
  516.  
  517.             .then((snapshot) => {
  518.                 let postUIDS = []
  519.  
  520.                 snapshot.forEach(post => {
  521.                     postUIDS.push(post.key)
  522.                 })
  523.  
  524.                 postUIDS.reverse()
  525.  
  526.                 let dataPromises = []
  527.  
  528.                 postUIDS.forEach(pUID => {
  529.                     dataPromises.push (
  530.                         admin.database().ref(`/posts/${pUID}`).once('value')
  531.                     )
  532.                 })
  533.  
  534.                 return Promise.all(dataPromises)
  535.             })
  536.  
  537.             .then((results) => {
  538.                 let feed = []
  539.  
  540.                 results.forEach(postSnapshot => {
  541.                     feed.push(
  542.                         Object.assign({key: postSnapshot.key}, postSnapshot.val())
  543.                     )
  544.                 })
  545.  
  546.                 return response.status(200).send(feed)
  547.             })
  548.     } else {
  549.         return admin
  550.             .database()
  551.             .ref(`/feed/${UserUID}`)
  552.             .orderByKey()
  553.             .endAt(lastPostUID)
  554.             .limitToLast(10)
  555.             .once('value')
  556.  
  557.             .then((snapshot) => {
  558.                 let postUIDS = []
  559.  
  560.                 snapshot.forEach(post => {
  561.                     postUIDS.push(post.key)
  562.                 })
  563.  
  564.                 postUIDS.reverse()
  565.  
  566.                 let dataPromises = []
  567.  
  568.                 postUIDS.forEach(pUID => {
  569.                     dataPromises.push (
  570.                         admin.database().ref(`/posts/${pUID}`).once('value')
  571.                     )
  572.                 })
  573.  
  574.                 return Promise.all(dataPromises)
  575.             })
  576.  
  577.             .then((results) => {
  578.                 let feed = []
  579.  
  580.                 results.forEach(postSnapshot => {
  581.                     feed.push(Object.assign({key: postSnapshot.key}, postSnapshot.val()))
  582.                 })
  583.  
  584.                 feed.splice(0, 1)
  585.  
  586.                 return response.status(200).send(feed)
  587.             })
  588.     }
  589. })
  590.  
  591. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  592. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  593. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  594.  
  595. exports.addPost = functions.region('europe-west1').https.onRequest((request, response) => {
  596.  
  597.     if (request.method !== 'POST') {
  598.         return response.status(500).send('Only Post allowed')
  599.     }
  600.  
  601.     let postData = request.body
  602.  
  603.     const ref = admin.database().ref('/posts').push()
  604.  
  605.     return ref.set(postData)
  606.  
  607.     .then(() => {
  608.         return response.status(200).send()
  609.     })
  610.  
  611.     .catch(error => {
  612.         console.log(error)
  613.         return response.status(500).send(error)
  614.     })
  615.  
  616. })
  617.  
  618. exports.cronJob = functions.region('europe-west1').https.onRequest((request, response) => {
  619.  
  620.     // get cronned posts
  621.  
  622.     let cronPosts = []
  623.     let postsToPublish = []
  624.  
  625.     let serverTime = null
  626.  
  627.     return admin.database().ref('/cronnedposts').once('value')
  628.     .then((snapshot) => {
  629.  
  630.         snapshot.forEach(post => {
  631.             cronPosts.push(post.val())
  632.             // post.child('timestamp).val()
  633.         })
  634.  
  635.         return admin.database().ref("/.info/serverTimeOffset").once('value')
  636.     })
  637.  
  638.     // get current Time
  639.     .then((offset) => {
  640.         var offsetVal = offset.val() || 0
  641.         serverTime = Date.now() + offsetVal
  642.  
  643.         console.log(serverTime)
  644.  
  645.         cronPosts.forEach(post => {
  646.             if (moment(post.timestamp).isBefore(moment(serverTime).add('1', 'minutes'))) {
  647.                 postsToPublish.push(post)
  648.             }
  649.         })
  650.  
  651.         let promisesOfPostsToPublish = []
  652.  
  653.         postsToPublish.forEach(post => {
  654.             promisesOfPostsToPublish.push(
  655.                 admin.database().ref('/posts').push(post)
  656.             )
  657.         })
  658.  
  659.         return Promise.all(promisesOfPostsToPublish)
  660.     })
  661.  
  662.     .then((results) => {
  663.         return response.status(200).send('DONE')
  664.     })
  665.  
  666.     .catch(error => {
  667.         console.log(error)
  668.         return response.status(500).send(error)
  669.     })
  670.  
  671. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement