|
@ -1,7 +1,6 @@ |
|
|
import moment from "moment"; |
|
|
import moment from "moment"; |
|
|
import sendFormAnswer from "../../api/Ingestion/sendFormAnswer"; |
|
|
import sendFormAnswer from "../../api/Ingestion/sendFormAnswer"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const AssembleIngestionObject = ( |
|
|
const AssembleIngestionObject = ( |
|
|
{ images, description }, |
|
|
{ images, description }, |
|
|
user, |
|
|
user, |
|
@ -17,7 +16,7 @@ const AssembleIngestionObject = ( |
|
|
array_to_json: [ |
|
|
array_to_json: [ |
|
|
{ |
|
|
{ |
|
|
formcode: code, |
|
|
formcode: code, |
|
|
formsanswersuserinformer: "admin@wpd.com",//user.id,
|
|
|
|
|
|
|
|
|
formsanswersuserinformer: "admin@wpd.com", //user.id,
|
|
|
fieldsanswerslongitude: location["longitude"], |
|
|
fieldsanswerslongitude: location["longitude"], |
|
|
fieldsanswerslatitude: location["latitude"], |
|
|
fieldsanswerslatitude: location["latitude"], |
|
|
fields: [ |
|
|
fields: [ |
|
@ -49,7 +48,7 @@ const AssembleIngestionPluviometer = ({ |
|
|
array_to_json: [ |
|
|
array_to_json: [ |
|
|
{ |
|
|
{ |
|
|
formcode: "PLUVIOMETERS_FORM", |
|
|
formcode: "PLUVIOMETERS_FORM", |
|
|
formsanswersuserinformer: "admin@wpd.com",//user.id,
|
|
|
|
|
|
|
|
|
formsanswersuserinformer: "admin@wpd.com", //user.id,
|
|
|
fias: [ |
|
|
fias: [ |
|
|
{ |
|
|
{ |
|
|
fieldsanswersdate: moment(date).format("DD-MM-YYYY"), |
|
|
fieldsanswersdate: moment(date).format("DD-MM-YYYY"), |
|
@ -64,7 +63,13 @@ const AssembleIngestionPluviometer = ({ |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const AssembleIngestionPluvRegistration = ( date, time, user, address, coordinates ) => { |
|
|
|
|
|
|
|
|
async function AssembleIngestionPluvRegistration( |
|
|
|
|
|
date, |
|
|
|
|
|
time, |
|
|
|
|
|
user, |
|
|
|
|
|
address, |
|
|
|
|
|
coordinates |
|
|
|
|
|
) { |
|
|
console.log(user); |
|
|
console.log(user); |
|
|
console.log(coordinates); |
|
|
console.log(coordinates); |
|
|
const pluvResgistrationObject = { |
|
|
const pluvResgistrationObject = { |
|
@ -72,7 +77,7 @@ const AssembleIngestionPluvRegistration = ( date, time, user, address, coordinat |
|
|
array_to_json: [ |
|
|
array_to_json: [ |
|
|
{ |
|
|
{ |
|
|
formcode: "PLUVIOMETER_REGISTRATION", |
|
|
formcode: "PLUVIOMETER_REGISTRATION", |
|
|
formsanswersuserinformer: "admin@wpd.com",//user.id,
|
|
|
|
|
|
|
|
|
formsanswersuserinformer: "admin@wpd.com", //user.id,
|
|
|
fieldsanswerslongitude: coordinates["longitude"], |
|
|
fieldsanswerslongitude: coordinates["longitude"], |
|
|
fieldsanswerslatitude: coordinates["latitude"], |
|
|
fieldsanswerslatitude: coordinates["latitude"], |
|
|
fields: [ |
|
|
fields: [ |
|
@ -80,16 +85,21 @@ const AssembleIngestionPluvRegistration = ( date, time, user, address, coordinat |
|
|
fieldsanswerseventaddress: address, |
|
|
fieldsanswerseventaddress: address, |
|
|
fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"), |
|
|
fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"), |
|
|
fieldsanswerseventtime: moment(time).format("HH:mm"), |
|
|
fieldsanswerseventtime: moment(time).format("HH:mm"), |
|
|
fieldsanswersinstitutename: user.institutionName ? user.institutionName : null, |
|
|
|
|
|
fieldsanswerrinstitutetype: user.institutionType ? user.institutionType : null |
|
|
|
|
|
|
|
|
fieldsanswersinstitutename: user.institutionName |
|
|
|
|
|
? user.institutionName |
|
|
|
|
|
: null, |
|
|
|
|
|
fieldsanswerrinstitutetype: user.institutionType |
|
|
|
|
|
? user.institutionType |
|
|
|
|
|
: null, |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
const a = sendFormAnswer(pluvResgistrationObject); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const a = await sendFormAnswer(pluvResgistrationObject); |
|
|
|
|
|
return a; |
|
|
|
|
|
} |
|
|
export { |
|
|
export { |
|
|
AssembleIngestionObject, |
|
|
AssembleIngestionObject, |
|
|
AssembleIngestionPluviometer, |
|
|
AssembleIngestionPluviometer, |
|
|