center-for-threat-informed-defense / attack-workbench-rest-api

An application allowing users to explore, create, annotate, and share extensions of the MITRE ATT&CK® knowledge base. This repository contains the REST API service for storing, querying, and editing ATT&CK objects.
https://ctid.mitre-engenuity.org/
Apache License 2.0
41 stars 22 forks source link

Refactor services to use async instead of callbacks #264

Open ElJocko opened 1 year ago

ElJocko commented 1 year ago

Mongoose 7.x.x removes support for callbacks, so all calls to Mongoose models and documents need to be refactored to use async instead of callbacks before the REST API can upgrade to use the latest version. Mongoose 6.x.x is currently being maintained, but will only receive security updates after August 2023.

It may be advantageous to combine this refactoring with a change to the services to use a set of generic functions that eliminate most of the redundant code across the services.

Most calls to the Mongoose functions are located in the object services, but changing the service functions to async will require changing the controller functions that call the services (or adding shims, but we might as well bring everything up to the same level)