From 73227f7cba8afa2ccf978e93e820d577f881d862 Mon Sep 17 00:00:00 2001 From: Vincentius Dennis Date: Wed, 9 Dec 2020 13:25:09 +0700 Subject: [PATCH] [#8] Update view and delete user documentation --- doc/users.md | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 171 insertions(+), 2 deletions(-) diff --git a/doc/users.md b/doc/users.md index ed5e762..c62c2fa 100644 --- a/doc/users.md +++ b/doc/users.md @@ -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 : } } ``` + +## 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" + } +} +``` + +## 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