Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5] Update Companies Documentation and add a figure of companies table #18

Merged
merged 9 commits into from
Dec 17, 2020

Conversation

AhmadGozali19
Copy link
Contributor

No description provided.

Copy link
Contributor

@jacky-htg jacky-htg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please resolve my comments below. thanks.

doc/companies.md Show resolved Hide resolved
doc/companies.md Outdated
HTTP Code | Status | Description
--- | --- | ---
400 | Bad Request | Bad request payload
404 | Not Found | User not found in database
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove 404

doc/companies.md Outdated
### Request Payloads
Name | Type | Example Value
--- | --- | ---
id | string | 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove id. use from path.

doc/companies.md Outdated
kota | string | JAKARTA
```
{
"id":"5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove id

doc/companies.md Outdated
HTTP Code | Status | Description
--- | --- | ---
400 | Bad Request | Bad request payload
404 | Not Found | User not found in database
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Company not found

doc/companies.md Outdated
}
```

#### Case : Negative Case 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invalid case

doc/companies.md Outdated
}
```

#### Case : Negative Case 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invalid case. but we need scenario case for company not found. grab id from path.

doc/companies.md Outdated

#### Case : Positive Case

Request Payload :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no request payload

doc/companies.md Show resolved Hide resolved
doc/companies.md Show resolved Hide resolved
doc/companies.md Show resolved Hide resolved
doc/companies.md Outdated
400 | Bad Request | Bad request payload
404 | Not Found | User not found in database
500 | Internal Server Error | some un-handle error in server
200 | OK | OK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove 200 OK since we use 201 Created

doc/companies.md Outdated
}
```

Response HTTP Status Code : 200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

201

doc/companies.md Outdated
"status_code": "CDC-201",
"status_message": "Created",
"data": {
"id":"5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id --> uuid, not number string

doc/companies.md Outdated
"status_code": "CDC-201",
"status_message": "Created",
"data": {
"id":"5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id --> uuid, not number string

doc/companies.md Outdated
"status_code": "CDC-200",
"status_message": "OK",
"data": {
"id":"5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id --> uuid, not number string

doc/companies.md Outdated
"status_code": "CDC-200",
"status_message": "OK",
"data": {
"id":"5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id --> uuid, not number string

doc/companies.md Outdated
400 | Bad Request | Bad request payload
404 | Not Found | User not found in database
500 | Internal Server Error | some un-handle error in server
200 | OK | OK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove 200 OK since we use 204 no content

doc/companies.md Outdated
```

```
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all response payload. 204 no content it;s mean really no content ion body response.

doc/companies.md Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Outdated Show resolved Hide resolved
doc/companies.md Show resolved Hide resolved
doc/companies.md Outdated
}
```

#### Case : Negative Case 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this scenario because it's invalid case. no param request, it's mean no data changed.

Copy link
Contributor

@jacky-htg jacky-htg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add endpoint for get list of companies with pagination. GET /companies

Param Query

Name Example Value Description
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

Example URL : GET /companies?search=jawara&order=companies.name

Response Payload

{
    "status_code": "cdc-200",
    "status_message": "sucsess",
    "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": 100
        }
    }
}

there is no 404 response. If result is empty, response status code is 200, with body response payload :

{
    "status_code": "cdc-200",
    "status_message": "sucsess",
    "data": {
        "companies": [],
        "pagination": {
            "search": "",
            "page": 1,
            "limit": 20,
            "order": "companies.name",
            "sort": "desc",
            "count": 0
        }
    }
}

[View](#view) | GET | /companies/:id | View Data Companies
[Edit](#edit) | PUT | /companies/:id | Edit Data Companies
[Delete](#delete) | DELETE | /companies/:id | Delete Data Companies

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add endpoint for get list of companies with pagination. GET /companies

Param Query

Name Example Value Description
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

Example URL : GET /companies?search=jawara&order=companies.name

Response Payload

{
    "status_code": "cdc-200",
    "status_message": "sucsess",
    "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": 100
        }
    }
}

there is no 404 response. If result is empty, response status code is 200, with body response payload :

{
    "status_code": "cdc-200",
    "status_message": "sucsess",
    "data": {
        "companies": [],
        "pagination": {
            "search": "",
            "page": 1,
            "limit": 20,
            "order": "companies.name",
            "sort": "desc",
            "count": 0
        }
    }
}

doc/companies.md Outdated
"status_message": "OK",
"data": {
"companies" : [
"id":"5e8d6470-f654-24c8-93ac-332e6c3dra2e",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{

doc/companies.md Show resolved Hide resolved
doc/companies.md Show resolved Hide resolved
Copy link
Contributor

@jacky-htg jacky-htg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please resolve your code on file doc/companies.md line 900.
companies are array of company object. please wrap the company data using {}

@jacky-htg jacky-htg merged commit fe53eb8 into main Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants