3map-models
TypeScript icon, indicating that this package has built-in type declarations

2.0.11 • Public • Published

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
);

Readme

Keywords

Package Sidebar

Install

npm i 3map-models

Weekly Downloads

103

Version

2.0.11

License

ISC

Unpacked Size

1.84 MB

Total Files

140

Last publish

Collaborators

  • polly3223