Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
fix(DTO): implements input data validation trough DTOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Juknum authored Nov 9, 2023
1 parent a24a78d commit 056357d
Show file tree
Hide file tree
Showing 123 changed files with 3,740 additions and 3,684 deletions.
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ This repository contains the source code of the API used by the [Sith 4](https:/
## Table of contents

- [Installation](#installation)
- [Project](#project)
- [Environment variables](#environment-variables)
- [Database](#database)
- [PostgreSQL Installation](#postgresql-installation)
- [Configuration](#configuration)
- [First time setup](#first-time-setup)
- [Project](#project)
- [Environment variables](#environment-variables)
- [Database](#database)
- [PostgreSQL Installation](#postgresql-installation)
- [Configuration](#configuration)
- [First time setup](#first-time-setup)
- [Launch](#launch)
- [Tests](#tests)
- [Linting](#linting)
Expand Down Expand Up @@ -79,13 +79,13 @@ brew services start postgresql@13 # start postgresql service

After the installation, you can use [pgAdmin](https://www.pgadmin.org/) to create a server with the following parameters:

| `.env` | pgAdmin 4 | value |
| :------------------: | :------------------: | :---------------------------------------------------------------------------------------- |
| `DB_HOST` | Host | `127.0.0.1` |
| `DB_PORT` | Port | `5432` |
| `DB_USERNAME` | Username | Should be the username you used to install postgresql or any user you have created for it |
| `DB_PASSWORD` | Password | leave it empty, unless you have set a password for your postgresql user |
| `DB_DATABASE` | Maintenance database | `postgres` |
| `.env` | pgAdmin 4 | value |
| :-----------: | :------------------: | :---------------------------------------------------------------------------------------- |
| `DB_HOST` | Host | `127.0.0.1` |
| `DB_PORT` | Port | `5432` |
| `DB_USERNAME` | Username | Should be the username you used to install postgresql or any user you have created for it |
| `DB_PASSWORD` | Password | leave it empty, unless you have set a password for your postgresql user |
| `DB_DATABASE` | Maintenance database | `postgres` |

> **Note**
> You can also use [TablePlus](https://tableplus.com/) to manage your databases as a lightweight (but more limited, in the free edition) alternative to pgAdmin.
Expand Down Expand Up @@ -121,16 +121,21 @@ pnpm run start:prod
```

## Tests

Both unit and e2e tests are available and run with [Jest](https://jestjs.io/). You can run them with the following command:

```bash
# unit tests
# all tests
pnpm test

# unique test file
pnpm test -- "auth.e2e-spec.ts"
```

> After running the tests, a coverage report is generated in the `./coverage` folder.
## Linting

This project uses [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/) to lint the code. You can run the linter with the following command:

```bash
Expand Down
17 changes: 9 additions & 8 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ const config: JestConfigWithTsJest = {
coverageReporters: ['text', 'lcov'],
collectCoverage: true,
coverageDirectory: 'coverage',
// coverageThreshold: {
// global: {
// branches: 100,
// functions: 100,
// lines: 100,
// statements: 100,
// },
// },
coverageThreshold: {
global: {
branches: 95,
functions: 95,
lines: 95,
statements: 95,
},
},
detectOpenHandles: true,
maxConcurrency: 1,
moduleNameMapper: {
'@env': '<rootDir>/src/env.ts',
'@mikro-orm.config': '<rootDir>/src/mikro-orm.config.ts',
'@app.module': '<rootDir>/src/app.module.ts',
'@main': '<rootDir>/src/main.ts',
'^src/(.*)$': '<rootDir>/src/$1',
'^@database/(.*)$': '<rootDir>/src/database/$1',
'^@exported/(.*)$': '<rootDir>/src/exported/$1',
Expand Down
56 changes: 29 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,59 +23,61 @@
},
"dependencies": {
"@ae_utbm/typings": "file:src/exported",
"@mikro-orm/cli": "^5.8.9",
"@mikro-orm/core": "^5.8.9",
"@mikro-orm/migrations": "^5.8.9",
"@mikro-orm/cli": "^5.9.1",
"@mikro-orm/core": "^5.9.1",
"@mikro-orm/migrations": "^5.9.1",
"@mikro-orm/nestjs": "^5.2.2",
"@mikro-orm/postgresql": "^5.8.9",
"@mikro-orm/reflection": "^5.8.9",
"@mikro-orm/seeder": "^5.8.9",
"@mikro-orm/postgresql": "^5.9.1",
"@mikro-orm/reflection": "^5.9.1",
"@mikro-orm/seeder": "^5.9.1",
"@mikro-orm/sql-highlighter": "^1.0.1",
"@nestjs/common": "^10.2.7",
"@nestjs/common": "^10.2.8",
"@nestjs/config": "^3.1.1",
"@nestjs/core": "^10.2.7",
"@nestjs/core": "^10.2.8",
"@nestjs/jwt": "^10.1.1",
"@nestjs/passport": "^10.0.2",
"@nestjs/platform-express": "^10.2.7",
"@nestjs/platform-express": "^10.2.8",
"@nestjs/schedule": "^3.0.4",
"@nestjs/swagger": "^7.1.13",
"@nestjs/swagger": "^7.1.14",
"bcrypt": "^5.1.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"file-type": "^16.5.4",
"jsonwebtoken": "^9.0.2",
"nestjs-i18n": "^10.3.6",
"nodemailer": "^6.9.6",
"nestjs-i18n": "^10.3.7",
"nodemailer": "^6.9.7",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"sharp": "^0.32.6",
"type-fest": "^4.4.0",
"type-fest": "^4.6.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@nestjs/cli": "^10.1.18",
"@nestjs/schematics": "^10.0.2",
"@nestjs/testing": "^10.2.7",
"@types/bcrypt": "^5.0.0",
"@types/express": "^4.17.19",
"@nestjs/cli": "^10.2.1",
"@nestjs/schematics": "^10.0.3",
"@nestjs/testing": "^10.2.8",
"@types/bcrypt": "^5.0.1",
"@types/express": "^4.17.20",
"@types/jest": "29.5.2",
"@types/jsonwebtoken": "^9.0.3",
"@types/multer": "^1.4.8",
"@types/jsonwebtoken": "^9.0.4",
"@types/multer": "^1.4.9",
"@types/node": "20.5.7",
"@types/nodemailer": "^6.4.11",
"@types/passport-jwt": "^3.0.10",
"@types/supertest": "^2.0.14",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"eslint": "^8.51.0",
"@types/nodemailer": "^6.4.13",
"@types/passport-jwt": "^3.0.12",
"@types/supertest": "^2.0.15",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-extended": "^4.0.2",
"prettier": "^2.8.8",
"source-map-support": "^0.5.21",
Expand Down
Loading

0 comments on commit 056357d

Please sign in to comment.