import moment from "moment"; import React from "react"; import sendFormAnswer from "../../api/Ingestion/sendFormAnswer"; const AssembleIngestionObject = ( { images, description }, situation, code, location, date, time, address ) => { const ingestionObject = { responseData: { array_to_json: [ { formcode: code, formsanswersuserinformer: "admin@wpd.com", fieldsanswerslongitude: location["longitude"], fieldsanswerslatitude: location["latitude"], fields: [ { fieldsanswerssituation: situation ? situation : "CHUVA FRACA", fieldsanswerseventaddress: address, fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"), fieldsanswerseventtime: moment(time).format("HH:mm"), fieldsanswerscomments: description, }, ], }, ], }, }; const a = sendFormAnswer(ingestionObject); }; const AssembleIngestionPluviometer = ({ pluviometer, description, images, date, time, }) => { const pluviometerObject = { responseData: { array_to_json: [ { formcode: "PLUVIOMETERS_FORM", formsanswersuserinformer: "admin@wpd.com", fias: [ { fieldsanswersdate: moment(date).format("DD-MM-YYYY"), fieldsanswersrainamount: pluviometer, fieldsanswerseventtime: moment(time).format("HH:mm"), fielsanswercomment: description, }, ], }, ], }, }; }; const AssembleIngestionPluvRegistration = ({ date, time, user }) => { const pluvResgistrationObject = { responseData: { array_to_json: [ { formcode: "PLUVIOMETER_REGISTRATION", formsanswersuserinformer: "admin@wpd.com", //user fieldsanswerslongitude: -46.5637, //location["longitude"], fieldsanswerslatitude: -23.623, //location["latitude"], fields: [ { fieldsanswerseventaddress: "Rua Rio de Janeiros, 81", //address fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"), fieldsanswerseventtime: moment(time).format("HH:mm"), fieldsanswersinstitutename: "E. E. Vagner", fieldsanswerrinstitutetype: "Escola", }, ], }, ], }, }; const a = sendFormAnswer(ingestionObject); }; export { AssembleIngestionObject, AssembleIngestionPluviometer, AssembleIngestionPluvRegistration, };