「薬処方時のデータ」のmedicineが送られてきたら、
「突合用の薬のマスタテーブル」のmedicineNameに対してfor文で突合し、
合致するものがあればpush通知を出すという処理をしたいです。
下記のように、/productの中に両方のプロパティを入れてみましたが、
node.js
1index.js 2 3 4const functions = require('firebase-functions'); 5// // Create and Deploy Your First Cloud Functions 6// // https://firebase.google.com/docs/functions/write-firebase-functions 7// The Firebase Admin SDK to access the Firebase Realtime Database. 8const admin = require('firebase-admin'); 9admin.initializeApp(functions.config().firebase); 10 11exports.product = functions.https.onRequest((request, response) => { 12 13 //POSTを受けると発火 14 if (request.method === "POST") { 15 const body = request.body; 16 17 18 const pushRef = admin.database().ref("/product").push(); 19 pushRef.set({ 20 //薬処方時のデータ 21 medicine: body["medicine"], 22 patientId: body["patientId"], 23 doctor: body["doctor"], 24 idisease: body["idisease"], 25 //突合用の薬のマスタテーブル 26 medicineName: body["medicineName"], 27 med: body["med"], 28 medicineId: body["medicineId"], 29 }, error => { 30 if (error) { 31 console.log("save error", error.message); 32 response.status(500).send(error.message).end(); 33 } else { 34 console.log("save Success!!"); 35 response.status(200).end(); 36 } 37 } 38 ); 39 40 } else { 41 response.status(404).end(); 42 } 43}); 44
データをfirebaseへ送信すると「薬処方時のデータ」の場合も「突合用の薬のマスタテーブル」の場合もPOSTにエラーが出ます
POST https://us-central1-bubbly-machine-189712.cloudfunctions.net/MedicineMasterTable 403 ()
簡単に「突合用の薬のマスタテーブル」をfirebaseに持たせ、POSTされた「薬処方時のデータ」を突合させる方法はありますか