3map-models
v2.0.10
Published
It's the node package that defines all models for 3Map application.
Downloads
544
Readme
3Map-models
It's the node package that defines all models for 3Map application.
It manages the serialization of DTOs (Data Transfer Objects) and contains common functions. It is meant to be used both on the server and on the client.
Example call for typedRecordDecoder
const projectList = [...]
const formSpecificIdList = [
"dd94707b-902c-43b3-b5a8-98064a843180",
"0b8cdbe9-e801-4fac-bdca-0550b3ec0dee",
"cf478952-8809-4835-a2c0-3da45c0ea98b",
"7e4f1526-6339-437d-89b9-af43ddf9a927",
"dd606f8d-527e-4709-924b-2d57d4784337",
"6ed151b6-f782-4c8a-a8fd-b147cab904d5",
];
const fieldTypes = {
"Weather station": "TEXT_REQUIRED",
"Weather condition": "LIST",
"Date of measurement": "DATE_REQUIRED",
"Rain (mm/day)": "NUMBER",
"Temperature MAX (°C)": "NUMBER",
"Temperature MIN (°C)": "NUMBER",
"Traditional observations/local knowledge": "TEXT",
"Weather impacts": "TEXT",
"Actions to take": "TEXT",
"Actions taken": "TEXT",
"Additional comments": "TEXT",
} as const;
const fieldTypeAlias = {
"Date of measurement": ["Date of measure"],
"Traditional observations/local knowledge": [
"Traditional observations / Predictions",
],
"Actions to take": ["Action to take"],
"Actions taken": ["Action taken"],
"Additional comments": ["Remarks"],
};
const typedDecoder = typedRecordDecoder(
projectList,
formSpecificIdList,
fieldTypes,
fieldTypeAlias
);