[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:
Description
This PR introduces the following refactor changes:
hooks and serializer compiler are not registered anymore on every httpInterface.js, but only once in index.js, to avoid multiple registers for collections
validator compiler is still applied to each HTTP interface to avoid OOM, but it has been moved to compilers.js
AdditionalCaster class does not need anymore to compute the fields that are either ObjectId, Date, or Geopoint at startup: in the new castItem method, field types are inferred using the instanceof keyword.
there are only 2 Ajv instances registered at runtime, while at startup there is an ajv instance for each collection to validate the json schema
Also, the following bug due to updating dependencies has been fixed:
serializerCompiler has been added to use fastifiy-fast-json, along with AdditionalCaster explicitly
Plus, for code styling, a .eslintrc.js file has been added, and its content has been moved from the configuration used within package.json
PR Checklist
[x] The commit message follows our guidelines included in the CONTRIBUTING.md
[x] Tests for the changes have been added (for bug fixes / features)
[x] Docs have been added / updated (for bug fixes / features)
Pull Request Type
Description
This PR introduces the following refactor changes:
httpInterface.js
, but only once inindex.js
, to avoid multiple registers for collectionscompilers.js
AdditionalCaster
class does not need anymore to compute the fields that are eitherObjectId
,Date
, orGeopoint
at startup: in the newcastItem
method, field types are inferred using theinstanceof
keyword.Also, the following bug due to updating dependencies has been fixed:
serializerCompiler
has been added to usefastifiy-fast-json
, along withAdditionalCaster explicitly
Plus, for code styling, a
.eslintrc.js
file has been added, and its content has been moved from the configuration used withinpackage.json
PR Checklist
Does this PR introduce a breaking change?
Other information