|
|
@@ -37,8 +37,16 @@ POST {{baseUrl}}/auth/register/default
|
|
|
```
|
|
|
- email = "tester@tooeasy.local"
|
|
|
- password = "ChangeMe123!"
|
|
|
+- Response 201 Created:
|
|
|
+```json
|
|
|
+{
|
|
|
+ "token": "<JWT>",
|
|
|
+ "companyId": 1,
|
|
|
+ "userId": 1
|
|
|
+}
|
|
|
+```
|
|
|
|
|
|
-## POST {{baseUrl}}/auth/register
|
|
|
+#### POST {{baseUrl}}/auth/register
|
|
|
- Body (application/json) — fields from `RegisterDTO` (`src/main/java/com/platform2easy/genesis/web/dto/RegisterDTO.java`):
|
|
|
```json
|
|
|
{
|
|
|
@@ -61,9 +69,13 @@ POST {{baseUrl}}/auth/register/default
|
|
|
```
|
|
|
- Response 201 Created:
|
|
|
```json
|
|
|
-{ "token": "<JWT>" }
|
|
|
+{
|
|
|
+ "token": "<JWT>",
|
|
|
+ "companyId": 1,
|
|
|
+ "userId": 1
|
|
|
+}
|
|
|
```
|
|
|
-## Login
|
|
|
+
|
|
|
#### POST {{baseUrl}}/auth/login
|
|
|
- Body — `AuthenticationDTO` (`src/main/java/com/platform2easy/genesis/web/dto/AuthenticationDTO.java`):
|
|
|
```json
|
|
|
@@ -71,8 +83,65 @@ POST {{baseUrl}}/auth/register/default
|
|
|
```
|
|
|
- Response 200 OK:
|
|
|
```json
|
|
|
-{ "token": "<JWT>" }
|
|
|
+{
|
|
|
+ "token": "<JWT>",
|
|
|
+ "companyId": 1,
|
|
|
+ "userId": 1
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+#### POST {{baseUrl}}/auth/validate-token
|
|
|
+- Headers:
|
|
|
+ - Authorization: Bearer <JWT>
|
|
|
+- Response 200 OK (if token is valid):
|
|
|
+```json
|
|
|
+{
|
|
|
+ "token": "<JWT>",
|
|
|
+ "companyId": 1,
|
|
|
+ "userId": 1
|
|
|
+}
|
|
|
+```
|
|
|
+- Response 401 Unauthorized (if token is invalid or expired)
|
|
|
+
|
|
|
+## User Management
|
|
|
+
|
|
|
+#### GET {{baseUrl}}/auth/company/{companyId}
|
|
|
+- Headers:
|
|
|
+ - Authorization: Bearer <JWT>
|
|
|
+- Path params: companyId (Integer)
|
|
|
+- Response 200 OK: List of users from the specified company
|
|
|
+
|
|
|
+#### PUT {{baseUrl}}/auth/email/{id}
|
|
|
+- Headers:
|
|
|
+ - Authorization: Bearer <JWT>
|
|
|
+ - Content-Type: application/json
|
|
|
+- Path params: id (Long) - User ID
|
|
|
+- Request body:
|
|
|
+```json
|
|
|
+{
|
|
|
+ "userEmail": "new.email@example.com"
|
|
|
+}
|
|
|
+```
|
|
|
+- Response 200 OK: Updated user object
|
|
|
+
|
|
|
+#### PUT {{baseUrl}}/auth/password/{id}
|
|
|
+- Headers:
|
|
|
+ - Authorization: Bearer <JWT>
|
|
|
+ - Content-Type: application/json
|
|
|
+- Path params: id (Long) - User ID
|
|
|
+- Request body:
|
|
|
+```json
|
|
|
+{
|
|
|
+ "userPassword": "newSecurePassword123"
|
|
|
+}
|
|
|
```
|
|
|
+- Response 200 OK: Updated user object with hashed password
|
|
|
+
|
|
|
+#### DELETE {{baseUrl}}/auth/{id}
|
|
|
+- Headers:
|
|
|
+ - Authorization: Bearer <JWT>
|
|
|
+- Path params: id (Long) - User ID to delete
|
|
|
+- Response 204 No Content (on successful deletion)
|
|
|
|
|
|
## Commodity API (`com.platform2easy.genesis.web.controller.CommodityController`)
|
|
|
#### Base path: {{baseUrl}}/api/commodity
|
|
|
@@ -107,7 +176,7 @@ Notes:
|
|
|
- List all orderbook entries.
|
|
|
|
|
|
- GET {{baseUrl}}/api/orderbook?isToken=0|1
|
|
|
- - Query params: `isToken` (0 or 1). Filters by `orderbook_is_token` (1=true, 0=false).
|
|
|
+ - Query params: `isToken` (0 or 1). Filters by `orderbook_is_token` (1 = true = sell, 0 = false = buy).
|
|
|
|
|
|
- GET {{baseUrl}}/api/orderbook/{id}
|
|
|
- Path params: id (Long)
|
|
|
@@ -153,6 +222,15 @@ Notes:
|
|
|
"name": "Minha Empresa",
|
|
|
"flag": "ACTIVE"
|
|
|
}
|
|
|
+
|
|
|
+```
|
|
|
+- Response 201 Created:
|
|
|
+```json
|
|
|
+{
|
|
|
+ "id": 1,
|
|
|
+ "name": "Minha Empresa",
|
|
|
+ "flag": "ACTIVE"
|
|
|
+}
|
|
|
```
|
|
|
|
|
|
- PUT {{baseUrl}}/api/company/{id}
|