Skip to content

Commit

Permalink
[#8] Update User Documentation based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
vdennis committed Dec 4, 2020
1 parent 4edbb6a commit 088314d
Showing 1 changed file with 50 additions and 95 deletions.
145 changes: 50 additions & 95 deletions doc/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,18 @@ POST /add
### Database
![](./user-layer.png)

for add, you need get :
- company_id, company_code, company_name from companies tables
- branch_id, branch_code, branch_name from branches tables
- region_id, region_code from regions tables
- kios_id, kios_code from kios tables

### Headers
Key | Value
--- | ---
Content-Type | application/json
Accept | application/json
Email | application/json

### Request Payloads
Name | Type | Example Value
--- | --- | ---
name | string | dennis
username | string | vdennis
password | string | cdcgi2020
email | string | [email protected]
type_akses | string | 4
company_id | string | 5fb5df66-5f80-416d-a055-401bcf944ef7
Expand All @@ -56,6 +50,7 @@ kios_id | string | 5fb5e626-65ac-473d-af2c-3ff2cf944ef7
HTTP Code | Status | Description
--- | --- | ---
400 | Bad Request | Bad request payload
404 | Not Found | company_id, region_id, branch_id, or kios_id is invalid
500 | Internal Server Error | some un-handle error in server
201 | Created | Created
```
Expand All @@ -66,6 +61,15 @@ HTTP Code | Status | Description
}
```

Response Payload
```
{
"status_code": "cdc-404",
"status_message": "company_id not found in companies",
"data": null
}
```

```
{
"status_code": "CDC-201",
Expand Down Expand Up @@ -94,11 +98,31 @@ HTTP Code | Status | Description
```

### Logic
- is_login, last_login, last_activity are not required in stateless concepts

type_akses list :
- 0 = SUPER USER
- 1 = COMPANY
- 2 = REGION
- 3 = AHASS
- 4 = POS/KIOS
- 5 = ALL-WMS
- 6 = WMS-NETWORK DEV
- 7 = WMS-SE
- 8 = WMS-Salesman PMD

for add, you need get :
- Super User access.
- company_id from companies tables if type_akses in range 1-4.
- branch_id from branches tables if type_akses in range 3-4.
- region_id from regions tables if type_akses is 2.
- kios_id from kios tables if type_akses is 4.
- if you already have a company_id, you don't need to include company_code and company_name in the users table. Because it's will provide additional responsibility to update the users table while there is an update in the companies table.
- point above also applies to region_code, kios_code, branch_code, and branch_name.

#### Validation
- name: required and not empty
- username: required and not empty
- password: required and not empty and password score > 75
- email: required and not empty
- type_akses: required and not empty and must in range (1-8)
- company_id: required and not empty and must be registered in companies if type_akses in range (1-4)
Expand Down Expand Up @@ -214,27 +238,6 @@ Request Payload

Response HTTP Status Code : 400

Response Payload
```
{
"status_code": "cdc-400",
"status_message": "password is required",
"data": null
}
```

#### Case : Negative Case 7

Request Payload
```
{
"name": "dennis",
"username": "vdennis"
}
```

Response HTTP Status Code : 400

Response Payload
```
{
Expand All @@ -244,51 +247,7 @@ Response Payload
}
```

#### Case : Negative Case 8

Request Payload :
```
{
"name": "dennis",
"username": "vdennis",
"password": ""
}
```

Response HTTP Status Code : 400

Response Payload:
```
{
"status_code": "cdc-400",
"status_message": "password is empty",
"data": null
}
```

#### Case : Negative Case 9

Request Payload
```
{
"name": "dennis",
"username": "vdennis",
"password": "12345678"
}
```

Response HTTP Status Code : 400

Response Payload
```
{
"status_code": "cdc-400",
"status_message": "Please supply strong Password",
"data": null
}
```

#### Case : Negative Case 10
#### Case : Negative Case 7

Request Payload
```
Expand All @@ -310,7 +269,7 @@ Response Payload
}
```

#### Case : Negative Case 11
#### Case : Negative Case 8

Request Payload
```
Expand All @@ -333,7 +292,7 @@ Response Payload
}
```

#### Case : Negative Case 12
#### Case : Negative Case 9

Request Payload
```
Expand All @@ -356,7 +315,7 @@ Response Payload
}
```

#### Case : Negative Case 13
#### Case : Negative Case 10

Request Payload
```
Expand All @@ -379,7 +338,7 @@ Response Payload
}
```

#### Case : Negative Case 14
#### Case : Negative Case 11

Request Payload
```
Expand All @@ -403,7 +362,7 @@ Response Payload
}
```

#### Case : Negative Case 15
#### Case : Negative Case 12

Request Payload
```
Expand All @@ -427,7 +386,7 @@ Response Payload
}
```

#### Case : Negative Case 16
#### Case : Negative Case 13

Request Payload
```
Expand All @@ -451,7 +410,7 @@ Response Payload
}
```

#### Case : Negative Case 17
#### Case : Negative Case 14

Request Payload
```
Expand All @@ -476,7 +435,7 @@ Response Payload
}
```

#### Case : Negative Case 18
#### Case : Negative Case 15

Request Payload
```
Expand All @@ -490,7 +449,7 @@ Request Payload
}
```

Response HTTP Status Code : 400
Response HTTP Status Code : 404

Response Payload
```
Expand All @@ -501,7 +460,7 @@ Response Payload
}
```

#### Case : Negative Case 19
#### Case : Negative Case 16

Request Payload
```
Expand All @@ -525,7 +484,7 @@ Response Payload
}
```

#### Case : Negative Case 20
#### Case : Negative Case 17

Request Payload
```
Expand All @@ -550,7 +509,7 @@ Response Payload
}
```

#### Case : Negative Case 21
#### Case : Negative Case 18

Request Payload
```
Expand All @@ -576,7 +535,7 @@ Response Payload
}
```

#### Case : Negative Case 22
#### Case : Negative Case 19

Request Payload
```
Expand All @@ -601,7 +560,7 @@ Response Payload
}
```

#### Case : Negative Case 23
#### Case : Negative Case 20

Request Payload
```
Expand All @@ -627,7 +586,7 @@ Response Payload
}
```

#### Case : Negative Case 24
#### Case : Negative Case 21

Request Payload
```
Expand All @@ -653,7 +612,7 @@ Response Payload
}
```

#### Case : Negative Case 25
#### Case : Negative Case 22

Request Payload
```
Expand All @@ -679,7 +638,7 @@ Response Payload
}
```

#### Case : Negative Case 26
#### Case : Negative Case 23

Request Payload
```
Expand Down Expand Up @@ -713,7 +672,6 @@ Request Payload :
{
"name": "dennis",
"username": "vdennis",
"password": "cdcgi2020",
"email": "[email protected]",
"type_akses": "1",
"company_id": "5fb5df66-5f80-416d-a055-401bcf944ef7"
Expand Down Expand Up @@ -750,7 +708,6 @@ Request Payload :
{
"name": "dennis",
"username": "vdennis",
"password": "cdcgi2020",
"email": "[email protected]",
"type_akses": "2",
"company_id": "5fb5df66-5f80-416d-a055-401bcf944ef7",
Expand Down Expand Up @@ -790,7 +747,6 @@ Request Payload :
{
"name": "dennis",
"username": "vdennis",
"password": "cdcgi2020",
"email": "[email protected]",
"type_akses": "3",
"company_id": "5fb5df66-5f80-416d-a055-401bcf944ef7",
Expand Down Expand Up @@ -831,7 +787,6 @@ Request Payload :
{
"name": "dennis",
"username": "vdennis",
"password": "cdcgi2020",
"email": "[email protected]",
"type_akses": "4",
"company_id": "5fb5df66-5f80-416d-a055-401bcf944ef7",
Expand Down

0 comments on commit 088314d

Please sign in to comment.