logout functionality and documentation
This commit is contained in:
@@ -18,7 +18,9 @@ emailVerifiedAt = null
|
||||
POST: http://localhost:3070/api/user
|
||||
```
|
||||
|
||||
**Request Body**
|
||||
**Request Body customer**
|
||||
|
||||
accontType = customer and bussiness_customer
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -26,6 +28,10 @@ POST: http://localhost:3070/api/user
|
||||
"lastName": "Bimsara",
|
||||
"email": "ibimsara00@gmail.com",
|
||||
"password": "Hello@12346"
|
||||
"accountType": "customer",
|
||||
|
||||
"address": "Colombo, Sri Lanka",
|
||||
"phoneNumber": "0771234567"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -45,21 +51,20 @@ POST: http://localhost:3070/api/user
|
||||
}
|
||||
```
|
||||
|
||||
After registration, the user receives an email containing a verification link.
|
||||
```
|
||||
|
||||
#### Verify Email
|
||||
After registration, the user receives an email containing a verification link.
|
||||
|
||||
|
||||
|
||||
#### Verify Email
|
||||
|
||||
Verifies the customer's email using the raw verification token received by email.
|
||||
|
||||
The backend hashes the received token and compares the resulting hash with the `tokenHash` stored in the `email_verifications` table.
|
||||
|
||||
The token must:
|
||||
|
||||
```text
|
||||
Exist in the database
|
||||
Not have been used
|
||||
Not have expired
|
||||
store in redis and expire token
|
||||
```
|
||||
|
||||
**Endpoint**
|
||||
@@ -107,7 +112,44 @@ usedAt = <current date and time>
|
||||
|
||||
This prevents the same verification token from being successfully used again.
|
||||
|
||||
---
|
||||
#### Get user's details
|
||||
|
||||
**Endpoint**
|
||||
|
||||
```
|
||||
GET: http://localhost:3070/api/profile
|
||||
```
|
||||
|
||||
**Respond**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "User profile retrieved successfully",
|
||||
"data": {
|
||||
"user": {
|
||||
"id": "usr_572gtlpi",
|
||||
"firstName": "Isuru",
|
||||
"lastName": "Bimsara",
|
||||
"email": "ibimsara00@gmail.com",
|
||||
"accountType": "customer",
|
||||
"accountStatus": "ACTIVE",
|
||||
"emailVerifiedAt": "2026-08-20T16:26:04.000Z",
|
||||
"passwordChangedAt": "2026-08-21T05:29:16.000Z",
|
||||
"createdAt": "2026-08-20T16:25:30.000Z",
|
||||
"updatedAt": "2026-08-21T05:29:16.000Z"
|
||||
},
|
||||
"accountDetails": {
|
||||
"customer_id": "cust_c8avqwbc",
|
||||
"user_id": "usr_572gtlpi",
|
||||
"address": "Colombo, Sri Lanka",
|
||||
"phoneNumber": "0771234567",
|
||||
"createdAt": "2026-08-20T16:25:31.000Z",
|
||||
"updatedAt": "2026-08-20T16:25:31.000Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### Get All Users
|
||||
|
||||
Reference in New Issue
Block a user