From 98f60abbd24eefedb6ed6d921ee32b1161663b56 Mon Sep 17 00:00:00 2001 From: AhmadGozali19 Date: Sun, 13 Dec 2020 11:43:53 +0700 Subject: [PATCH] [#5] documentation update add view list for get list companies with parameters --- doc/companies.md | 136 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/doc/companies.md b/doc/companies.md index 2dbea7c..0b26eeb 100644 --- a/doc/companies.md +++ b/doc/companies.md @@ -5,6 +5,7 @@ Module | HTTP Method | URL | Description [View](#view) | GET | /companies/:id | View Data Companies [Edit](#edit) | PUT | /companies/:id | Edit Data Companies [Delete](#delete) | DELETE | /companies/:id | Delete Data Companies +[ViewList](#viewlist) | GET | /companies | View List Data Companies ## Add Data Companies @@ -845,3 +846,138 @@ HTTP Code | Status | Description #### Case : Positive Case Response HTTP Status Code : 204 + +## View List Data Companies + +### Endpoint +GET /companies + +### Header +Key | Value +--- | --- +Content-Type | application/json +Accept | application/json + +### Param Query +Name | Example Value | Deskription +--- | --- | --- +search | jawara | keyword for search companies. default is empty. +page | 1 | current page. default 1. +limit | 20 | limit data in 1 pages. default 20. +order | companies.name | order of list. default companies.id +sort | asc | sort of list. option value is asc + +URL : GET /companies?search=jawara&order=companies.name + +### Response Payloads +HTTP Code | Status | Description +--- | --- | --- +500 | Internal Server Error | some un-handle error in server +200 | OK | OK +``` +{ + "status_code": "CDC-200", + "status_message": "sucsess", + "data": { + "companies": [], + "pagination": { + "search": "", + "page": 1, + "limit": 20, + "order": "companies.name", + "sort": "desc", + "count": 0 + } + } +} +``` + +``` +{ + "status_code": "CDC-200", + "status_message": "OK", + "data": { + "companies" : [ + "id":"5e8d6470-f654-24c8-93ac-332e6c3dra2e", + "company_code": "TC", + "name": "Test Company", + "address": "JL. Test Company", + "npwp": "123", + "nomor_kukuh": "123", + "tgl_kukuh": "2020-12-08", + "phone_num": "021", + "fax_num": "021", + "seri_pajak": "12", + "kota": "JAKARTA" + ], + "pagination": { + "search": "", + "page": 1, + "limit": 20, + "order": "companies.name", + "sort": "desc", + "count": 1 + } + } +} +``` + +### Scenario Test + +#### Case : Positive Case 1 + +Response HTTP Status Code : 200 + +Response Payload : +``` +{ + "status_code": "CDC-200", + "status_message": "sucsess", + "data": { + "companies": [], + "pagination": { + "search": "", + "page": 1, + "limit": 20, + "order": "companies.name", + "sort": "desc", + "count": 0 + } + } +} +``` + +#### Case : Positive Case 2 + +Response HTTP Status Code : 200 + +Response Payload : +``` +{ + "status_code": "CDC-200", + "status_message": "OK", + "data": { + "companies" : [ + "id":"5e8d6470-f654-24c8-93ac-332e6c3dra2e", + "company_code": "TC", + "name": "Test Company", + "address": "JL. Test Company", + "npwp": "123", + "nomor_kukuh": "123", + "tgl_kukuh": "2020-12-08", + "phone_num": "021", + "fax_num": "021", + "seri_pajak": "12", + "kota": "JAKARTA" + ], + "pagination": { + "search": "", + "page": 1, + "limit": 20, + "order": "companies.name", + "sort": "desc", + "count": 1 + } + } +} +```