-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#8] Update User Documentation based on review
- Loading branch information
Showing
1 changed file
with
50 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
``` | ||
|
@@ -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", | ||
|
@@ -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) | ||
|
@@ -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 | ||
``` | ||
{ | ||
|
@@ -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 | ||
``` | ||
|
@@ -310,7 +269,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 11 | ||
#### Case : Negative Case 8 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -333,7 +292,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 12 | ||
#### Case : Negative Case 9 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -356,7 +315,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 13 | ||
#### Case : Negative Case 10 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -379,7 +338,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 14 | ||
#### Case : Negative Case 11 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -403,7 +362,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 15 | ||
#### Case : Negative Case 12 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -427,7 +386,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 16 | ||
#### Case : Negative Case 13 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -451,7 +410,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 17 | ||
#### Case : Negative Case 14 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -476,7 +435,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 18 | ||
#### Case : Negative Case 15 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -490,7 +449,7 @@ Request Payload | |
} | ||
``` | ||
|
||
Response HTTP Status Code : 400 | ||
Response HTTP Status Code : 404 | ||
|
||
Response Payload | ||
``` | ||
|
@@ -501,7 +460,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 19 | ||
#### Case : Negative Case 16 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -525,7 +484,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 20 | ||
#### Case : Negative Case 17 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -550,7 +509,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 21 | ||
#### Case : Negative Case 18 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -576,7 +535,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 22 | ||
#### Case : Negative Case 19 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -601,7 +560,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 23 | ||
#### Case : Negative Case 20 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -627,7 +586,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 24 | ||
#### Case : Negative Case 21 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -653,7 +612,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 25 | ||
#### Case : Negative Case 22 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -679,7 +638,7 @@ Response Payload | |
} | ||
``` | ||
|
||
#### Case : Negative Case 26 | ||
#### Case : Negative Case 23 | ||
|
||
Request Payload | ||
``` | ||
|
@@ -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" | ||
|
@@ -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", | ||
|
@@ -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", | ||
|
@@ -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", | ||
|