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

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

3Map API endpoints

route method auth reqDto resDto
https://3map-server.trimweb.it/ping GET ResEmptySuccessful
https://3map-server.trimweb.it/auth/signUp POST ReqSignUp ResEmptySuccessful
https://3map-server.trimweb.it/auth/adminLogin POST ReqAdminToken ResAdminToken
https://3map-server.trimweb.it/auth/verifyUser/:token GET
https://3map-server.trimweb.it/auth/requestLinkChangePsw POST ReqLinkChangePsw
https://3map-server.trimweb.it/auth/changePsw/:token POST ReqAdminToken
https://3map-server.trimweb.it/auth/projectLogin/:projectName GET admin ResProjectToken
https://3map-server.trimweb.it/admin/addProject POST admin Project ResEmptySuccessful
https://3map-server.trimweb.it/admin/collabs GET admin ResCollabs
https://3map-server.trimweb.it/admin/getUsernameList/:str GET admin ResUsernameList
https://3map-server.trimweb.it/admin/getProject/:projectName GET admin Project
https://3map-server.trimweb.it/admin/deleteProject/:projectName DELETE admin ResEmptySuccessful
https://3map-server.trimweb.it/project/getProject GET project Project
https://3map-server.trimweb.it/project/validateToken GET project ResValidateToken
https://3map-server.trimweb.it/project/getRecordList GET project ResRecordList
https://3map-server.trimweb.it/project/queryRecordList POST project ReqQueryRecordList ResRecordList
https://3map-server.trimweb.it/project/queryAvailableDates POST project ReqQueryRecordList ResQueryAvailableDates
https://3map-server.trimweb.it/project/deleteRecord/:recordId DELETE project ResEmptySuccessful
https://3map-server.trimweb.it/project/deleteRecordList DELETE project ReqDeleteRecordIdList ResEmptySuccessful
https://3map-server.trimweb.it/project/uploadRecordList POST project ReqUploadRecordList ResEmptySuccessful
https://3map-server.trimweb.it/static/uploadFilesAdmin/:projectName POST admin FILE ResEmptySuccessful
https://3map-server.trimweb.it/static/uploadFilesProject POST project FILE ResEmptySuccessful
https://3map-server.trimweb.it/static/uploadSingleFileAdmin/:projectName POST admin FILE ResEmptySuccessful
https://3map-server.trimweb.it/static/uploadSingleFileProject POST project FILE ResEmptySuccessful
https://3map-server.trimweb.it/static/:projectName/admin/:fileName GET FILE
https://3map-server.trimweb.it/static/:projectName/project/:fileName GET FILE

Readme

Keywords

Package Sidebar

Install

npm i 3map-models

Weekly Downloads

14

Version

2.0.12

License

ISC

Unpacked Size

1.87 MB

Total Files

141

Last publish

Collaborators

  • polly3223