- Update the
src/types/env.d.tswith the new variable (all variables must have thestringtype) - Add the new env var in to
.env.dockerfile (env vars with sensitive content MUST have no value, just the key or an example non-real value)
- Create a new folder
src/<API_VERSION>/utils/yup/(string, number, date, ...) - Create a new file, inside this new folder, with the name of your new custom validator
- If there aren't any custom validator to use as example in this repo, look in another of Techmmunity repositories.
- Create the custom validator
- Import the custom validator in
src/<API_VERSION>/utils/yup/index.tsfile - Add the new typing in
src/types/env.d.tsfile (if the file doesn't exists, look in another of Techmmunity repositories for some examples)
- Create a new folder with the correspondent version name (v2, v3, ...)
- Create a new module file for this version
<API_VERSION>.module.tsinside the new folder - Import this new module inside the
src/app.module.tsfolder - Copy the index config of the previous version to the new version config folder
- Copy the database config of the previous version to the new version config folder, or create a new one
- Include the database connection configuration in the
<API_VERSION>.module.tsfile - Update the api version inside the
nest-cli.jsonfile - Update the api version in the scripts of
package.json - Update the api version inside the
src/swagger.tsfile
WARNING: DON'T DUPLICATE FILES! Only create new files or import the files of the previous version if needed.
- Install the nest cli globally with
yarn global add @nestjs/cli - Run this command:
nest g mo <ENTITY_NAME> - Run this command:
nest g co <ENTITY_NAME> - Run this command:
nest g s <ENTITY_NAME> - The new entity will be created inside the
src/<API_VERSION>/apifolder - The module of the new entity will be automatically import inside the
src/<API_VERSION>/<API_VERSION>.module.tsfile. You must remove it. - Import the module of the new entity inside the
src/<API_VERSION>/api/index.tsfile and add it to the array of modules. - Delete the
src/<API_VERSION>/api/<ENTITY_NAME>/<ENTITY_NAME>.controller.spec.tsfile - Delete the
src/<API_VERSION>/api/<ENTITY_NAME>/<ENTITY_NAME>.service.spec.tsfile - Add
@ApiTagdecorator in the controller of the new entity - Change the base url of the controller of the new entity to contain the api version (ApiConfig.version)
- Save the file of the controller of the new entity to prettier automatically format the file
- Save the file of the module of the new entity to prettier automatically format the file