Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB 📦 setup using TypeORM with Postgres #3

Merged
merged 6 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"application/xml": "xml",
"application/zip": "zip"
},
"cSpell.words": ["commitlint", "mahabubx", "nestjs", "precommit"]
"cSpell.words": ["commitlint", "knexjs", "mahabubx", "nestjs", "precommit", "typeorm"]
}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Nest.js project starter kit (Knex.js & Postgres)
# Nest.js project starter kit (TypeORM & Postgres)

**Tech Usages:**
```yml
Runtime: Node.js v20 (LTS)
Framework: Nest.js (v10)
Databases: PostgreSQL (knex.js), and Redis (native-driver)
Databases: PostgreSQL (TypeORM), and Redis (native-driver)
Mailer: NodeMailer (tempMail)
```
> Docker-compose ready!
Expand All @@ -16,9 +16,9 @@ Mailer: NodeMailer (tempMail)
- [x] Setup `ESLint` & `Prettier`
- [x] Setup `husky` & `lint-staged` for lint-proof commits
- [x] Setup and config `env` variables & docker-composed instances
- [ ] Setup `Knex.js` with `PostgreSQL`
- [ ] Setup Validation-pipes for incoming request body
- [ ] Implement User Module with CRUD
- [x] Setup `TypeORM` with `PostgreSQL`
- [x] Setup Validation-pipes for incoming request body
- [ ] Implement User Module with CRUD with Basic `JWT` Auth.
- [ ] Implement Todo Module with CRUD
- [ ] Setup `RBAC/PBAC` with `nest-access-control`
- [ ] Config **Todo with required permissions**
Expand Down
90 changes: 90 additions & 0 deletions docs/auth/register.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
### Register a User [Ugly error try]
POST http://localhost:4000/auth/register HTTP/1.1
content-type: application/json

{
"name": "test",
"email": "test",
"password": "test"
}

## Response [400 Bad Request]

{
"message": [
"Passwords do not match",
"confirmPassword must be longer than or equal to 8 characters",
"confirmPassword should not be empty",
"email must be an email",
"password must be longer than or equal to 8 characters"
],
"error": "Bad Request",
"statusCode": 400
}

### Register a User [confirmPassword is empty]
POST http://localhost:4000/auth/register HTTP/1.1
content-type: application/json

{
"name": "test",
"email": "[email protected]",
"password": "test1234"
}

## Response [400 Bad Request]

{
"message": [
"Passwords do not match",
"confirmPassword must be longer than or equal to 8 characters",
"confirmPassword should not be empty"
],
"error": "Bad Request",
"statusCode": 400
}

### Register a User [passwords are okay] :: Success try
POST http://localhost:4000/auth/register HTTP/1.1
content-type: application/json

{
"name": "test",
"email": "[email protected]",
"password": "test1234",
"confirmPassword": "test1234"
}

## Response [201 Created]

{
"message": "Registration successful!",
"user": {
"name": "test",
"email": "[email protected]",
"password": "test1234",
"confirmPassword": "test1234",
"id": 9,
"role": "user",
"isEmailVerified": false
},
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OSwiZW1haWwiOiJ0ZXN0QHVzZXIxLm1haWwiLCJyb2xlIjoidXNlciIsImlhdCI6MTcxMzAzOTQzMSwiZXhwIjoxNzEzMDQzMDMxfQ.fW_-J2CmrslZDUPK4PknIsKxlE1Jr7P0UUkTzGKpXII"
}

### Register a User [passwords are okay] :: Deplicate try
POST http://localhost:4000/auth/register HTTP/1.1
content-type: application/json

{
"name": "test",
"email": "[email protected]",
"password": "test1234",
"confirmPassword": "test1234"
}

## Response [409 Conflict]

{
"statusCode": 409,
"message": "Email already exists!"
}
Loading
Loading