Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#8] Update view and delete user documentation
Browse files Browse the repository at this point in the history
vdennis committed Dec 9, 2020
1 parent bbdfa32 commit 73227f7
Showing 1 changed file with 171 additions and 2 deletions.
173 changes: 171 additions & 2 deletions doc/users.md
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@ kios_id | string | 5fb5e626-65ac-473d-af2c-3ff2cf944ef7
HTTP Code | Status | Description
--- | --- | ---
400 | Bad Request | Bad request payload
403 | Forbidden | dont have permission
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
@@ -60,7 +61,14 @@ HTTP Code | Status | Description
}
```

Response Payload
```
{
"status_code": "CDC-403",
"status_message": "dont have permission to add",
"data": null
}
```

```
{
"status_code": "cdc-404",
@@ -120,6 +128,7 @@ for add, you need get :
- point above also applies to region_code, kios_code, branch_code, and branch_name.

#### Validation
- super user access
- name: required and not empty
- username: required and not empty
- email: required and not empty
@@ -885,7 +894,6 @@ HTTP Code | Status | Description
}
```

Response Payload
```
{
"status_code": "cdc-404",
@@ -1688,3 +1696,164 @@ Response Payload :
}
}
```

## <a name="view"></a>View

### Endpoint
GET /user/:id

### Header
Key | Value
--- | ---
Content-Type | application/json
Accept | application/json
Email | admin@cdc.id

### Response Payloads
HTTP Code | Status | Description
--- | --- | ---
404 | Not Found | user not found in database
500 | Internal Server Error | some un-handle error in server
200 | OK | OK

```
{
"status_code": "cdc-404",
"status_message": "user id not found",
"data": null
}
```

```
{
"status_code": "CDC-200",
"status_message": "OK",
"data": {
"id":"1",
"name" : "dennis",
"username" : "vdennis",
"password" : "7f2994ecd8c1498cd0661589df5051f096fe1aca",
"email" : "vdennis@cdc.id",
"type_akses" : 4,
"company_id" : "5fb5df66-5f80-416d-a055-401bcf944ef7",
"company_code" : "WARI",
"company_name" : "PT. WAHANAARTHA RITELINDO",
"region_id" : "5fb5e66d-e47c-47fd-b4bf-4064cf944ef7",
"region_code" : "WARI-03",
"branch_id" : "5fb5e437-69dc-4eb6-8f8c-4022cf944ef7",
"branch_code" : "77777",
"branch_name" : "WARI TEST 2",
"kios_id" : "5fb5e626-65ac-473d-af2c-3ff2cf944ef7",
"kios_code" : "77777",
"created" : "2020-12-02 09:03:44",
"modified" : "2020-12-14 12:07:14"
}
}
```

### Logic

#### Validation

### Scenario Test

#### Case : Negative Case

response HTTP Status Code : 404

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

#### Case : Positive Case

Response HTTP Status Code : 200

Response Payload :
```
{
"status_code": "CDC-200",
"status_message": "OK",
"data": {
"id":"1",
"name" : "dennis",
"username" : "vdennis",
"password" : "7f2994ecd8c1498cd0661589df5051f096fe1aca",
"email" : "vdennis@cdc.id",
"type_akses" : 4,
"company_id" : "5fb5df66-5f80-416d-a055-401bcf944ef7",
"company_code" : "WARI",
"company_name" : "PT. WAHANAARTHA RITELINDO",
"region_id" : "5fb5e66d-e47c-47fd-b4bf-4064cf944ef7",
"region_code" : "WARI-03",
"branch_id" : "5fb5e437-69dc-4eb6-8f8c-4022cf944ef7",
"branch_code" : "77777",
"branch_name" : "WARI TEST 2",
"kios_id" : "5fb5e626-65ac-473d-af2c-3ff2cf944ef7",
"kios_code" : "77777",
"created" : "2020-12-02 09:03:44",
"modified" : "2020-12-14 12:07:14"
}
}
```

## <a name="delete"></a>Delete

### Endpoint
DELETE /user/:id

### Header
Key | Value
--- | ---
Content-Type | *
Accept | application/json
Email | admin@cdc.id

### Response Payloads
HTTP Code | Status | Description
--- | --- | ---
404 | Not Found | user not found in database
403 | Forbidden | dont have permission
500 | Internal Server Error | some un-handle error in server
204 | No Content | Delete data user

### Logic

#### Validation
- super user access

### Scenario Test

#### Case : Negative Case 1

response HTTP Status Code : 403

Response Payload :
```
{
"status_code": "cdc-403",
"status_message": "dont have permission to delete",
}
```

#### Case : Negative Case 2

response HTTP Status Code : 404

Response Payload :
```
{
"status_code": "cdc-404",
"status_message": "user not found",
}
```

#### Case : Positive Case

response HTTP Status Code : 204

0 comments on commit 73227f7

Please sign in to comment.