diff --git a/doc/acl-layer.png b/doc/acl-layer.png
deleted file mode 100644
index f0f9b9c..0000000
Binary files a/doc/acl-layer.png and /dev/null differ
diff --git a/doc/auth.md b/doc/auth.md
index 03d5d20..8a49384 100644
--- a/doc/auth.md
+++ b/doc/auth.md
@@ -77,6 +77,9 @@ HTTP Code | Status | Description
*if any special logic, please write down the logic here. thanks*
+
+
+
### Scenario Test
#### Case : Negative Case 1
@@ -230,12 +233,665 @@ Response Payload :
### Endpoint
POST /forgot-password
+
+
+
+For recycle your password, you need to input your email for sending password recovery to your email.
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+email | string | jacky@gmail.com
+```
+{
+ "email": "jacky@gmail.com"
+}
+```
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+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 | Password recovery was sended to your email. please checked your email. | Password recovery was sended to your email. please checked your email.
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "Bad Request",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "Password recovery was sended to your email. please checked your email. ",
+ "data": null
+}
+```
+
+### Logic
+
+1. Validate email input.
+2. Store the link forgot password to forgot_password_temps table.
+3. Send email reset password link to user.
+
+
+#### Validation
+- email: required, using email pattern, and not empty
+
+
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Request Payload : empty
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "email is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Request Payload :
+```
+{}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "email is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 3
+
+Request payload :
+```
+{
+ "email": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "email is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 4
+
+Request Payload :
+```
+{
+ "email": "asal"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "email format is invalid",
+ "data": null
+}
+```
+
+
+#### Case : Negative Case 5
+
+Request Payload
+```
+{
+ "email": "asal@gmail.com"
+}
+```
+
+Response HTTP Status Code : 404
+
+Response Payload
+```
+{
+ "status_code": "cdc-404",
+ "status_message": "email not found",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+Request Payload :
+```
+{
+ "email": "jacky@gmail.com"
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "Password recovery was sended to your email. please checked your email. ",
+ "data": null
+}
+```
+
## Change Password
### Endpoint
POST /change-password
-## Reset Password
+
-### Endpoint
-POST /reset-password
+For change your password you need to input your old password and your new password
+
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | example@gmail.com
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+old_password | string | jakaRTa!2020
+new_password | string | jakaRTa!2021
+re_new_password | string | jakaRTa!2021
+```
+{
+ "old_password": "jakaRTa!2020",
+ "new_password": "jakaRTa!2021",
+ "re_new_password": "jakaRTa!2021"
+}
+```
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+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 | Success change password | Success change password
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "Bad Request",
+ "data": null
+
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "Success change password.",
+ "data": {
+ "user": {
+ "id":1,
+ "name": "Jacky Chan",
+ "username": "jacky",
+ "email": "jacky@gmail.com"
+ }
+ }
+}
+```
+
+### Logic
+
+1. Validate old password, new password input.
+2. matching new password with re new password.
+3. check if email exist in database and get password from database based on email
+4. compare old password with password on database
+5. change password on database with new password
+
+
+#### Validation
+- old password: required and not empty
+- new password: required and not empty
+- re new password: required and not empty
+- new password = re new password
+- old password = current password from db
+
+
+
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Request Payload : empty
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "old password is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Request Payload :
+```
+{}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "old password is required",
+ "data": null
+}
+```
+
+
+#### Case : Negative Case 3
+
+Request Payload :
+```
+{
+ "old_password": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "old password is empty",
+ "data": null
+}
+```
+
+
+#### Case : Negative Case 4
+
+Request Payload :
+```
+{
+ "old_password": "asal"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "new password is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 5
+
+Request Payload :
+```
+{
+ "old_password": "jakaRTa!2020",
+ "new_password": "asal"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "new password is weak",
+ "data": null
+}
+```
+
+#### Case : Negative Case 6
+
+Request Payload :
+```
+{
+ "old_password": "jakaRTa!2020",
+ "new_password": "jakaRTa!2021",
+ "re_new_password": "asal"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "new password did not match",
+ "data": null
+}
+```
+
+#### Case : Negative Case 7
+
+Request Payload
+```
+{
+ "old_password": "asal",
+ "new_password": "jakaRTa!2020",
+ "re_new_password": "jakaRTa!2020"
+}
+```
+
+Response HTTP Status Code : 404
+
+Response Payload
+```
+{
+ "status_code": "cdc-404",
+ "status_message": "wrong password",
+ "data": null
+}
+```
+
+
+#### Case : Positive Case
+
+Request Payload :
+```
+{
+ "old_password": "jakaRTa!2020",
+ "new_password": "jakaRTa!2021",
+ "re_new_password": "jakaRTa!2021"
+}
+```
+
+Response HTTP Status Code : 200
+
+### Endpoint
+POST /change-password
+
+## Reset Password
+
+### Endpoint
+POST /reset-password
+
+
+
+for resetting your password with a new password
+
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+token | string | c4ca4238a0b923820dcc509a6f75849b
+new_password | string | jakaRTa!2021
+re_new_password | string | jakaRTa!2021
+```
+{
+ "token": "c4ca4238a0b923820dcc509a6f75849b",
+ "new_password": "jakaRTa!2021",
+ "re_new_password": "jakaRTa!2021"
+}
+```
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+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 | Success change password | Success change password
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "Bad Request",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "Success change password.",
+ "data": {
+ "user": {
+ "id":1,
+ "name": "Jacky Chan",
+ "username": "jacky",
+ "email": "jacky@gmail.com"
+ },
+ "forgot_password_temps": {
+ "id":1,
+ "user_id":1,
+ "key":"c4ca4238a0b923820dcc509a6f75849b",
+ "exp_date": "2020-12-12"
+ }
+ }
+}
+```
+
+### Logic
+
+1. check token is valid ? is token is exist? is token expired? is token used?
+2. Validate new password input.
+3. matching new password with re new password.
+4. if match, change password on database with new password
+
+
+#### Validation
+- token: token validation
+- new password: check strong password,required and not empty
+- re new password: check match with new password, required and not empty
+
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Request Payload : empty
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "cdc-404",
+ "status_message": "token not found",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Request Payload :
+```
+{}
+```
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "cdc-404",
+ "status_message": "token not found",
+ "data": null
+}
+```
+
+#### Case : Negative Case 3
+
+Request Payload :
+```
+{
+ "token": ""
+}
+```
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "cdc-404",
+ "status_message": "token not found",
+ "data": null
+}
+```
+
+#### Case : Negative Case 4
+
+Request Payload :
+```
+{
+ "token": "c4ca4238a0b923820dcc509a6f75849b"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "new password is required",
+ "data": null
+}
+```
+#### Case : Negative Case 5
+
+Request payload :
+```
+{
+ "token": "c4ca4238a0b923820dcc509a6f75849b",
+ "new_password": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "new password is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 6
+
+Request Payload :
+```
+{
+ "token": "c4ca4238a0b923820dcc509a6f75849b",
+ "new_password": "asal"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "new password is weak",
+ "data": null
+}
+```
+
+#### Case : Negative Case 7
+
+Request Payload :
+```
+{
+ "token": "c4ca4238a0b923820dcc509a6f75849b",
+ "new_password": "jakaRTa!2020",
+ "re_new_password": "asal"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "new password did not match",
+ "data": null
+}
+```
+
+
+#### Case : Positive Case
+
+Request Payload :
+```
+{
+ "token": "c4ca4238a0b923820dcc509a6f75849b",
+ "new_password": "jakaRTa!2021",
+ "re_new_password": "jakaRTa!2021"
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "success change password",
+ "data": {
+ "user": {
+ "id":1,
+ "name": "Jacky Chan",
+ "username": "jacky",
+ "email": "jacky@gmail.com"
+ },
+ "forgot_password_temps": {
+ "id":1,
+ "user_id":1,
+ "key":"c4ca4238a0b923820dcc509a6f75849b",
+ "exp_date": "2020-12-12"
+ }
+ }
+}
+```
diff --git a/doc/branches-layer.png b/doc/branches-layer.png
new file mode 100644
index 0000000..aa90da4
Binary files /dev/null and b/doc/branches-layer.png differ
diff --git a/doc/branches.md b/doc/branches.md
index 64613a2..f08e974 100644
--- a/doc/branches.md
+++ b/doc/branches.md
@@ -1 +1,1275 @@
# Branches Module
+Module | HTTP Method | URL | Description
+--- | --- | --- | ---
+[Create Branches](#create-branches) | POST | /branches | Create Branches API
+[Edit Branches](#edit-branches) | PUT | /branches/{id} | Edit Branches API
+[Delete Branches](#delete-branches) | DELETE | /branches/{id} | Delete Branches API
+[Get All Branches](#get-all-branches) | GET | /branches | Get All Branches API
+[Get Branches By ID](#get-branches-byid) | GET | /branches/{id} | Get Branches By ID API
+[Get Branches By Branch Code](#get-branches-bybranchcode) | GET | /branches/code/{kode} | Get Branches By Branch Code API
+
+## Create
+
+### Endpoint
+POST /branches
+
+### Database
+
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+branch_code | string | 12345
+branch_name | string | Testing Jaya Motor
+address | string | Jl. Kebahagiaan 7
+pic | string | Budi
+kabeng | string | Ridwan
+kelurahan | string | Palmerah
+kecamatan | string | Palmerah
+kab_kota | string | Jakarta Barat
+phone_number | string | 5367896
+fax_number | string | 5113470
+email | string | testingmotor@gmail.com
+```
+{
+ "branch_code": "12345",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+400 | Bad Request | Bad request payload
+500 | Internal Server Error | some un-handle error in server
+201 | Created | Success create to database
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "Bad Request",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-201",
+ "status_message": "Data Created",
+ "data": {
+ "id": "359ed520-346f-11eb-adc1-0242ac120002",
+ "branch_code": "12345",
+ "company_code": "TES",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+ }
+ }
+}
+```
+
+### Logic
+
+#### Headers Validation
+No Header Validation
+
+#### Request Payloads Validation
+- branch_code : required and not empty
+- branch_code : must be 5 digit
+- branch_code : unique and not exist in database
+- branch_name : required and not empty
+- address : required and not empty
+- pic : required and not empty
+- kabeng : required and not empty
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Request Payload : empty
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "branch code is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Request Payload :
+```
+{}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "branch code is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 3
+
+Request payload :
+```
+{
+ "branch_code": "",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "branch code is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 4
+
+Request Payload :
+```
+{
+ "branch_code": "1234",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "branch code must be 5 digit",
+ "data": null
+}
+```
+
+#### Case : Negative Case 5
+
+Request Payload :
+```
+{
+ "branch_code": "12344",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload:
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "branch code is exist in database",
+ "data": null
+}
+```
+
+#### Case : Negative Case 6
+
+Request Payload
+```
+{
+ "branch_code": "12345",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "branch name is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 7
+
+Request Payload
+```
+{
+ "branch_code": "12345",
+ "branch_name": "",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "branch name is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 8
+
+Request Payload
+```
+{
+ "branch_code": "12345",
+ "branch_name": "Testing Jaya Motor",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "address is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 9
+
+Request Payload
+```
+{
+ "branch_code": "12345",
+ "branch_name": "Testing Jaya Motor",
+ "address": "",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "address is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 10
+
+Request Payload
+```
+{
+ "branch_code": "12345",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "pic is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 11
+
+Request Payload
+```
+{
+ "branch_code": "12345",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "pic is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 12
+
+Request Payload
+```
+{
+ "branch_code": "12345",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "kabeng is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 13
+
+Request Payload
+```
+{
+ "branch_code": "12345",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "kabeng is empty",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+Headers :
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+Request Payload :
+```
+{
+ "branch_code": "12345",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7"
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 201
+
+Response Payload :
+```
+{
+ "status_code": "CDC-201",
+ "status_message": "Data Created",
+ "data": {
+ "id": "359ed520-346f-11eb-adc1-0242ac120002",
+ "branch_code": "12345",
+ "company_code": "TES",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7"
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+ }
+}
+```
+
+## Edit
+
+### Endpoint
+PUT /branches/{id}
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+branch_name | string | Testing Jaya Motor
+address | string | Jl. Kebahagiaan No.7
+pic | string | Budi
+kabeng | string | Rojak
+kelurahan | string | Palmerah
+kecamatan | string | Palmerah
+kab_kota | string | Jakarta Barat
+phone_number | string | 5367896
+fax_number | string | 5113470
+email | string | testingmotor@gmail.com
+```
+{
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan No.7",
+ "pic": "Rendi",
+ "kabeng": "Rojak",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+403 | Forbidden | Branch is not owned by user login
+404 | Not Found | Branch not found in database
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+```
+{
+ "status_code": "CDC-403",
+ "status_message": "Branch is not owned by user login",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "Data Changed",
+ "data": {
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan No.7",
+ "pic": "Rendi",
+ "kabeng": "Rojak",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+ }
+ }
+}
+```
+
+### Logic
+
+#### Endpoint Validation
+- must be add parameter id
+- id must exist in database
+- must owned by user login
+
+#### Headers Validation
+No Headers Validation
+
+#### Request Payloads Validation
+No Request Payloads Validation
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Branch is not owned by user login
+
+Response HTTP Status Code : 403
+
+Response Payload :
+```
+{
+ "status_code": "CDC-403",
+ "status_message": "Branch is not owned by user login",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+- param id is not exist in database
+
+Endpoint : /branches/359ed520-346f-11eb-adc1-0242ac110001
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "CDC-404",
+ "status_message": "data not found",
+ "data": null
+}
+```
+
+#### Case : Positive Case 1
+
+- param id is exist in database
+
+Endpoint : /branches/359ed520-346f-11eb-adc1-0242ac120002
+
+Headers :
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+Request Payload :
+```
+{
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan No.7",
+ "pic": "Rendi",
+ "kabeng": "Rojak",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "Data Changed",
+ "data": {
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan No.7",
+ "pic": "Rendi",
+ "kabeng": "Rojak",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+ }
+}
+```
+
+#### Case : Positive Case 2
+
+Request Payload : empty
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "No data was changed",
+ "data": {
+ "id": "359ed520-346f-11eb-adc1-0242ac120002",
+ "branch_code": "12345",
+ "company_code": "TES",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+ }
+}
+```
+
+#### Case : Positive Case 3
+
+Request Payload :
+```
+{}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "No data was changed",
+ "data": {
+ "id": "359ed520-346f-11eb-adc1-0242ac120002",
+ "branch_code": "12345",
+ "company_code": "TES",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+ }
+}
+```
+
+## Delete
+
+### Endpoint
+DELETE /branches/{id}
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | *
+Accept | application/json
+Email | administrator@gmail.com
+
+### Request Payloads
+No Request Payloads
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+403 | Forbidden | Branch is not owned by user login
+404 | Not Found | Branch not found in database
+500 | Internal Server Error | some un-handle error in server
+204 | No Content | Server request has succeeded but response is no content
+```
+{
+ "status_code": "CDC-403",
+ "status_message": "Branch is not owned by user login",
+ "data": null
+}
+```
+
+Status Code 204 : No Response
+
+### Logic
+
+#### Endpoint validation
+- must be add parameter id
+- id must exist in database
+- must owned by user login
+
+#### Headers Validation
+No Headers Validation
+
+#### Request Payloads Validation
+No Request Payloads Validation
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Branch is not owned by user login
+
+Response HTTP Status Code : 403
+
+Response Payload :
+```
+{
+ "status_code": "CDC-403",
+ "status_message": "Branch is not owned by user login",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+- param id is not exist in database
+
+Endpoint : /branches/359ed520-346f-11eb-adc1-0242ac120112
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "CDC-404",
+ "status_message": "data not found",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+- param id is exist in database
+
+Endpoint : /branches/632c725e-35e6-11eb-adc1-0242ac120002
+
+Headers :
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+Response HTTP Status Code : 204
+
+Response Payload : No Response
+
+## Get All
+
+### Endpoint
+GET /branches
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+### Request Param
+GET /branches?keyword=testing&page=1&limit=20&order=branches.id&sort=desc&company_id=1
+
+Name | Example Value | Description
+--- | --- | ---
+keyword | testing | the keyword for searching branches
+page | 1 | current page in pagination. default value is 1. if there is no param page, page will be set with 1.
+limit | 20 | the amount of data displayed on current page in pagination. if there is no param limit, it will be set with no limit.
+order | branches.id | grouping data displayed by id of branches.
+sort | desc | sorting data displayed by desc
+company_id | 1 | conditions of data displayed by id of company
+
+### Request Payloads
+No Request Payloads
+
+### 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": "data not found",
+ "data": []
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": [
+ {
+ "id": "359ed520-346f-11eb-adc1-0242ac120002",
+ "branch_code": "12345",
+ "company_code": "TES",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+ },
+ {
+ "id": "359ede58-346f-11eb-adc1-0242ac120002",
+ "branch_code": "17721",
+ "company_code": "TST",
+ "branch_name": "Tahta Sahabat Testing",
+ "address": "Jl. Bukit utara",
+ "pic": "Rini",
+ "kabeng": "Surya",
+ "kelurahan": "Manggarai",
+ "kecamatan": "Tebet",
+ "kab_kota": "Jakarta Selatan",
+ "phone_number": "5721136",
+ "fax_number": "5805543",
+ "email": "tst@yahoo.com"
+ }
+ ]
+}
+```
+
+### Logic
+
+#### Headers Validation
+No Headers Validation
+
+#### Request Payloads Validation
+No Validation
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Data in database is empty
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "data not found",
+ "data": []
+}
+```
+
+#### Case : Positive Case
+
+Headers :
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": [
+ {
+ "id": "359ed520-346f-11eb-adc1-0242ac120002",
+ "branch_code": "12345",
+ "company_code": "TES",
+ "branch_name": "Testing Jaya Motor",
+ "address": "Jl. Kebahagiaan 7",
+ "pic": "Budi",
+ "kabeng": "Ridwan",
+ "kelurahan": "Palmerah",
+ "kecamatan": "Palmerah",
+ "kab_kota": "Jakarta Barat",
+ "phone_number": "5367896",
+ "fax_number": "5113470",
+ "email": "testingmotor@gmail.com"
+ },
+ {
+ "id": "359ede58-346f-11eb-adc1-0242ac120002",
+ "branch_code": "17721",
+ "company_code": "TST",
+ "branch_name": "Tahta Sahabat Testing",
+ "address": "Jl. Bukit utara",
+ "pic": "Rini",
+ "kabeng": "Surya",
+ "kelurahan": "Manggarai",
+ "kecamatan": "Tebet",
+ "kab_kota": "Jakarta Selatan",
+ "phone_number": "5721136",
+ "fax_number": "5805543",
+ "email": "tst@yahoo.com"
+ }
+ ]
+}
+```
+
+## Get By ID
+
+### Endpoint
+GET /branches/{id}
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+### Request Payloads
+No Request Payloads
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+403 | Forbidden | Branch is not owned by user login
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+```
+{
+ "status_code": "CDC-403",
+ "status_message": "Branch is not owned by user login",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id": "359ede58-346f-11eb-adc1-0242ac120002",
+ "branch_code": "17721",
+ "company_code": "TST",
+ "branch_name": "Tahta Sahabat Testing",
+ "address": "Jl. Bukit utara",
+ "pic": "Rini",
+ "kabeng": "Surya",
+ "kelurahan": "Manggarai",
+ "kecamatan": "Tebet",
+ "kab_kota": "Jakarta Selatan",
+ "phone_number": "5721136",
+ "fax_number": "5805543",
+ "email": "tst@yahoo.com"
+ }
+}
+```
+
+### Logic
+
+#### Endpoint Validation
+- must be add parameter id
+- id must exist in database
+- must owned by user login
+
+#### Headers Validation
+No Headers Validation
+
+#### Request Payloads Validation
+No Request Payloads Validation
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Branch is not owned by user login
+
+Response HTTP Status Code : 403
+
+Response Payload :
+```
+{
+ "status_code": "CDC-403",
+ "status_message": "Branch is not owned by user login",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+- id not exist in database
+
+Endpoint : /branches/359ed520-346f-11eb-adc1-0242ac120112
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "data not found",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+- id is exist in database
+
+Endpoint : /branches/359ede58-346f-11eb-adc1-0242ac120002
+
+Headers :
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id": "359ede58-346f-11eb-adc1-0242ac120002",
+ "branch_code": "17721",
+ "company_code": "TST",
+ "branch_name": "Tahta Sahabat Testing",
+ "address": "Jl. Bukit utara",
+ "pic": "Rini",
+ "kabeng": "Surya",
+ "kelurahan": "Manggarai",
+ "kecamatan": "Tebet",
+ "kab_kota": "Jakarta Selatan",
+ "phone_number": "5721136",
+ "fax_number": "5805543",
+ "email": "tst@yahoo.com"
+ }
+}
+```
+
+## Get By Branch Code
+
+### Endpoint
+GET /branches/code/{kode}
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+### Request Payloads
+No Request Payloads
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+403 | Forbidden | Branch is not owned by user login
+404 | Not Found | Branch not found in database
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+```
+{
+ "status_code": "CDC-500",
+ "status_message": "internal server error",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id": "359ede58-346f-11eb-adc1-0242ac120002",
+ "branch_code": "17721",
+ "company_code": "TST",
+ "branch_name": "Tahta Sahabat Testing",
+ "address": "Jl. Bukit utara",
+ "pic": "Rini",
+ "kabeng": "Surya",
+ "kelurahan": "Manggarai",
+ "kecamatan": "Tebet",
+ "kab_kota": "Jakarta Selatan",
+ "phone_number": "5721136",
+ "fax_number": "5805543",
+ "email": "tst@yahoo.com"
+ }
+}
+```
+
+### Logic
+
+#### Endpoint Validation
+- must be add parameter branch code
+- branch code must exist in database
+- must owned by user login
+
+#### Headers Validation
+No Headers Validation
+
+#### Request Payloads Validation
+No Request Payloads Validation
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Data in database is empty
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "CDC-404",
+ "status_message": "data not found",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+- branch code not exist in database
+
+Endpoint : /branches/code/32450
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "CDC-404",
+ "status_message": "data not found",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+- branch code is exist in database
+
+Endpoint : /branches/code/17721
+
+Headers :
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | administrator@gmail.com
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id": "359ede58-346f-11eb-adc1-0242ac120002",
+ "branch_code": "17721",
+ "company_code": "TST",
+ "branch_name": "Tahta Sahabat Testing",
+ "address": "Jl. Bukit utara",
+ "pic": "Rini",
+ "kabeng": "Surya",
+ "kelurahan": "Manggarai",
+ "kecamatan": "Tebet",
+ "kab_kota": "Jakarta Selatan",
+ "phone_number": "5721136",
+ "fax_number": "5805543",
+ "email": "tst@yahoo.com"
+ }
+}
+```
\ No newline at end of file
diff --git a/doc/employees.md b/doc/employees.md
index 4fe590a..e5be7d1 100644
--- a/doc/employees.md
+++ b/doc/employees.md
@@ -1 +1,816 @@
# Employees Module
+Module | HTTP Method | URL | Description
+--- | --- | --- | ---
+[Add](#add) | POST | /employees | Add New Data Employee
+[View](#view) | GET | /employees/:id | View Data Employee
+[Edit](#edit) | PUT | /employees/:id | Edit Data Employee
+[Delete](#delete) | DELETE | /employees/:id | Delete Data Employee
+
+## Add
+
+### Endpoint
+POST /employees
+
+### Database
+
+
+for add, you need login with company_id from companies tables and branch_code from branches tables
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | alamat@emailcdc.com
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+employee_kode | string | 20201201
+employee_nama | string | ferry
+stall_code | string | Heavy Repair
+jabatan_kode | string | 1
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1"
+}
+```
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+400 | Bad Request | Bad request payload
+404 | Not Found | branch_code not found in database
+500 | Internal Server Error | some un-handle error in server
+201 | Created | Created
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "Bad Request",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-201",
+ "status_message": "Created",
+ "data": {
+ "id":"5fbf4995-b4ac-4a2e-9cad-4021cf944ef7",
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1",
+ "branch_id": "5d2c04c9-fffc-4175-ac06-148dcf944ef7",
+ "branch_code": "cdc-011",
+ "company_id": "5e1befd2-ab04-49c2-addd-5b25c0a8141e",
+ "company_code": "cdc-01",
+ "created" : "2020-12-03 09:44:02",
+ "modified" : "2020-12-03 09:44:02"
+ }
+}
+```
+
+### Logic
+
+#### Validation
+- employee_kode : required and not empty
+- employee_nama : required and not empty
+- stall_code : required and not empty
+- jabatan_kode : required, not empty and exist in jabatans table
+- branch_code : required, not empty and owned by user login as main dealer
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Request Payload : empty
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "employee_kode is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Request Payload :
+```
+{}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "employee_kode is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 3
+
+Request Payload :
+```
+{
+ "employee_kode": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "employee_kode is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 4
+
+Request Payload :
+```
+{
+ "employee_kode": "20200301"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "employee_nama is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 5
+
+Request Payload :
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload:
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "employee_nama is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 6
+
+Request Payload
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": "ferry"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "stall_code is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 7
+
+Request Payload :
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload:
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "stall_code is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 8
+
+Request Payload
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "jabatan_kode is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 9
+
+Request Payload :
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload:
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "jabatan_kode is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 10
+
+Request Payload :
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload:
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "branch_code is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 11
+
+Request Payload :
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1",
+ "branch_code" : ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload:
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "branch_code is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 12
+
+Request Payload :
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1",
+ "branch_code" : "cdc-011"
+}
+```
+
+Response HTTP Status Code : 403
+
+Response Payload:
+```
+{
+ "status_code": "cdc-403",
+ "status_message": "branch_code not owned by user login",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+Request Payload :
+```
+{
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1"
+}
+```
+
+Response HTTP Status Code : 201
+
+Response Payload :
+```
+{
+ "status_code": "CDC-201",
+ "status_message": "Created",
+ "data": {
+ "id":"5fbf4995-b4ac-4a2e-9cad-4021cf944ef7",
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1",
+ "branch_id": "5d2c04c9-fffc-4175-ac06-148dcf944ef7",
+ "company_id": "5e1befd2-ab04-49c2-addd-5b25c0a8141e",
+ "company_code": "cdc-01",
+ "created" : "2020-12-03 09:44:02",
+ "modified" : "2020-12-03 09:44:02"
+ }
+}
+```
+
+## View Data Employee
+
+### Endpoint
+GET /employees/:id
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | alamat@emailcdc.com
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+403 | Forbidden | id is not owned by user login
+404 | Not Found | Employee not found in database
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5fbf4995-b4ac-4a2e-9cad-4021cf944ef7",
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1",
+ "branch_id": "5d2c04c9-fffc-4175-ac06-148dcf944ef7",
+ "branch_code": "cdc-011",
+ "company_id": "5e1befd2-ab04-49c2-addd-5b25c0a8141e",
+ "company_code": "cdc-01",
+ "created" : "2020-12-03 09:44:02",
+ "modified" : "2020-12-03 09:44:02"
+ }
+}
+```
+
+### Logic
+
+#### Validation
+- id : not found
+- id : is owned by user login
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "cdc-404",
+ "status_message": "id not found",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Response HTTP Status Code : 403
+
+Response Payload :
+```
+{
+ "status_code": "cdc-403",
+ "status_message": "id not owned by user login",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5fbf4995-b4ac-4a2e-9cad-4021cf944ef7",
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1",
+ "branch_id": "5d2c04c9-fffc-4175-ac06-148dcf944ef7",
+ "branch_code": "cdc-011",
+ "company_id": "5e1befd2-ab04-49c2-addd-5b25c0a8141e",
+ "company_code": "cdc-01",
+ "created" : "2020-12-03 09:44:02",
+ "modified" : "2020-12-03 09:44:02"
+ }
+}
+```
+
+# Edit Data Employee
+
+### Endpoint
+PUT /employees/:id
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | alamat@emailcdc.com
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+employee_kode | string | 200301
+employee_nama | string | ferry setiawan
+stall_code | string | Reguler
+jabatan_kode | string | 1
+```
+{
+ "employee_kode": "200301",
+ "employee_nama": "ferry setiawan",
+ "stall_code": "Reguler",
+ "jabatan_kode": "1"
+}
+```
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+400 | Bad Request | Bad request payload
+403 | Forbidden | id is not owned by user login
+404 | Not Found | Employee not found in database
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "Bad Request",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5fbf4995-b4ac-4a2e-9cad-4021cf944ef7",
+ "employee_kode": "200301",
+ "employee_nama": "ferry setiawan",
+ "stall_code": "Reguler",
+ "jabatan_kode": "2",
+ "branch_id": "5d2c04c9-fffc-4175-ac06-148dcf944ef7",
+ "branch_code": "cdc-011",
+ "company_id": "5e1befd2-ab04-49c2-addd-5b25c0a8141e",
+ "company_code": "cdc-01",
+ "created" : "2020-12-03 09:44:02",
+ "modified" : "2020-12-03 09:44:02"
+ }
+}
+```
+
+### Logic
+
+#### Validation
+- employee_kode : not empty and must be unique
+- employee_nama : not empty
+- stall_code : not empty
+- jabatan_kode : not empty
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Request Payload : empty
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "employee_kode is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Request payload :
+```
+{
+ "employee_kode": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "employee_kode is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 3
+
+Request Payload
+```
+{
+ "employee_nama": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "employee_nama is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 4
+
+Request Payload
+```
+{
+ "stall_code": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "stall_code is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 5
+
+Request Payload
+```
+{
+ "jabatan_kode": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "jabatan_kode is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 6
+
+Request Payload
+```
+{
+ "employee_kode": "20001"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "employee_kode already in use",
+ "data": null
+}
+```
+
+#### Case : Positive Case 1
+
+Request Payload :
+```
+{
+ "employee_kode": "200301"
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5fbf4995-b4ac-4a2e-9cad-4021cf944ef7",
+ "employee_kode": "200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1",
+ "branch_id": "5d2c04c9-fffc-4175-ac06-148dcf944ef7",
+ "branch_code": "cdc-011",
+ "company_id": "5e1befd2-ab04-49c2-addd-5b25c0a8141e",
+ "company_code": "cdc-01",
+ "created" : "2020-12-03 09:44:02",
+ "modified" : "2020-12-04 10:40:02"
+ }
+}
+```
+
+#### Case : Positive Case 2
+
+Request Payload :
+```
+{
+ "employee_nama": "ferry setiawan"
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5fbf4995-b4ac-4a2e-9cad-4021cf944ef7",
+ "employee_kode": "200301",
+ "employee_nama": "ferry setiawan",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "1",
+ "branch_id": "5d2c04c9-fffc-4175-ac06-148dcf944ef7",
+ "branch_code": "cdc-011",
+ "company_id": "5e1befd2-ab04-49c2-addd-5b25c0a8141e",
+ "company_code": "cdc-01",
+ "created" : "2020-12-03 09:44:02",
+ "modified" : "2020-12-04 10:40:02"
+ }
+}
+```
+
+#### Case : Positive Case 3
+
+Request Payload :
+```
+{
+ "stall_code": "Regular"
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5fbf4995-b4ac-4a2e-9cad-4021cf944ef7",
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Regular",
+ "jabatan_kode": "1",
+ "branch_id": "5d2c04c9-fffc-4175-ac06-148dcf944ef7",
+ "branch_code": "cdc-011",
+ "company_id": "5e1befd2-ab04-49c2-addd-5b25c0a8141e",
+ "company_code": "cdc-01",
+ "created" : "2020-12-03 09:44:02",
+ "modified" : "2020-12-04 10:40:02"
+ }
+}
+```
+
+#### Case : Positive Case 4
+
+Request Payload :
+```
+{
+ "stall_code": "Regular"
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5fbf4995-b4ac-4a2e-9cad-4021cf944ef7",
+ "employee_kode": "20200301",
+ "employee_nama": "ferry",
+ "stall_code": "Heavy Repair",
+ "jabatan_kode": "2",
+ "branch_id": "5d2c04c9-fffc-4175-ac06-148dcf944ef7",
+ "branch_code": "cdc-011",
+ "company_id": "5e1befd2-ab04-49c2-addd-5b25c0a8141e",
+ "company_code": "cdc-01",
+ "created" : "2020-12-03 09:44:02",
+ "modified" : "2020-12-04 10:40:02"
+ }
+}
+```
+
+## Delete Data Employee
+
+### Endpoint
+DELETE /employees/:id
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | *
+Accept | application/json
+Email | alamat@emailcdc.com
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+403 | Forbidden | id is not owned by user login
+404 | Not Found | id not found in database
+500 | Internal Server Error | some un-handle error in server
+204 | No content | No content
+
+### Scenario Test
+
+#### Case : Positive Case
+
+Response HTTP Status Code : 204
diff --git a/doc/employees.png b/doc/employees.png
new file mode 100644
index 0000000..3c654bc
Binary files /dev/null and b/doc/employees.png differ
diff --git a/doc/forgot_password_layer.png b/doc/forgot_password_layer.png
new file mode 100644
index 0000000..5baa737
Binary files /dev/null and b/doc/forgot_password_layer.png differ
diff --git a/doc/groups-layer.png b/doc/groups-layer.png
new file mode 100644
index 0000000..0cbebfc
Binary files /dev/null and b/doc/groups-layer.png differ
diff --git a/doc/groups.md b/doc/groups.md
index e535442..a87f768 100644
--- a/doc/groups.md
+++ b/doc/groups.md
@@ -1 +1,585 @@
# Groups Module
+Module | HTTP Method | URL | Description
+--- | --- | --- | ---
+[Add Groups](#add) | POST | /groups | Add Groups API
+[Edit Groups](#edit) | PUT | /groups/{id} | Edit Groups API
+[View All Groups](#view) | GET | /groups | View Groups API
+[View Groups Detail](#view-detail) | GET | /groups/{id} | View Detail Group API
+[Delete Groups](#delete) | DELETE | /groups/{id} | Delete Groups API
+
+
+### Database
+
+
+
+## Add Groups
+
+### Endpoint
+POST /groups
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+title | string | Admin
+description | string | Administrator
+```
+{
+ "title": "Admin",
+ "description": "Administrator"
+}
+
+```
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+400 | Bad Request | Bad request payload
+500 | Internal Server Error | some un-handle error in server
+201 | Created | Created
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "Bad Request",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-201",
+ "status_message": "Created",
+ "data": {
+ "id": 1,
+ "title": "Admin",
+ "description": "Administrator",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-01 00:00:00"
+ }
+}
+```
+
+### Logic
+
+#### Validation
+- title : required and not empty
+- description : required and not empty
+
+#### Special Logic
+*After save data in groups table, also save the data on aros table too*
+- id --> auto increment
+- parent_id --> null
+- model --> Groups
+- foreign_key --> id of group
+- alias --> name of group
+- lft --> grab using cakephp tree behavior
+- rght --> grab using cakephp tree behavior
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Request Payload : empty
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "title is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Request Payload :
+```
+{}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "title is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 3
+
+Request payload :
+```
+{
+ "title": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "title is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 4
+
+Request Payload :
+```
+{
+ "title": "Coba"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "description is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 5
+
+Request Payload :
+```
+{
+ "title": "Coba",
+ "description": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload:
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "description is empty",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+Request Payload :
+```
+{
+ "title": "Sales",
+ "description": "Sales Position"
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id": 2,
+ "title": "Sales",
+ "description": "Sales Position",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-01 00:00:00"
+ }
+}
+```
+
+## Edit Groups
+
+### Endpoint
+PUT /groups/{id}
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+
+```
+{
+ "title": "Admin",
+ "description": "Administrator"
+}
+
+```
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+404 | Not Found | Groups not found in database
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "Data Changed",
+ "data": {
+ "id": 1,
+ "title": "Admin",
+ "description": "Administrator",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-01 00:00:00"
+ }
+}
+```
+### Logic
+#### Endpoint Validation
+- must be add parameter id
+- id must exist in database
+
+#### Validation
+No Validation
+
+### Scenario Test
+
+#### Case : Negative Case 1
+- param id is not exist in database
+
+Endpoint : /groups/100
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "CDC-404",
+ "status_message": "data not found",
+ "data": null
+}
+```
+
+#### Case : Positive Case 1
+
+- param id is exist in database
+
+Endpoint : /groups/1
+
+Headers :
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+
+Request Payload :
+```
+{
+ "title": "myAdmin",
+ "description": "My Administrator"
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "Data Changed",
+ "data": {
+ "id": 1,
+ "title": "myAdmin",
+ "description": "Administrator",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-11 12:00:00"
+ }
+}
+```
+
+#### Case : Positive Case 2
+
+Request Payload : empty
+
+Endpoint : /groups/1
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "No data was changed",
+ "data": {
+ "id": 1,
+ "title": "myAdmin",
+ "description": "Administrator",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-11 12:00:00"
+ }
+}
+```
+
+#### Case : Positive Case 3
+
+Request Payload :
+```
+{}
+```
+Endpoint : /groups/1
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "No data was changed",
+ "data": {
+ "id": 1,
+ "title": "myAdmin",
+ "description": "Administrator",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-11 12:00:00"
+ }
+}
+```
+
+## View All Groups
+
+### Endpoint
+GET /groups
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+
+### Request Param
+Name | Example Value | Description
+--- | --- | ---
+search | admin | keyword for search groups. default is empty.
+page | 1 | current page. default 1.
+limit | 20 | limit data in 1 pages. default 20.
+order | groups.title | order of list. default groups.id
+sort | asc | sort of list. option value is asc
+
+EXAMPLE URL : GET /groups?search=admin&order=groups.title
+
+### Request Payload
+
+No Request Payload
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+404 | Not Found | Groups not found in database
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+```
+{
+ "status_code": "CDC-500",
+ "status_message": "Internal Server Error",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": [
+ {
+ "id": 1,
+ "title": "Admin",
+ "description": "Administrator",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-01 00:00:00"
+ },
+ {
+ "id": 2,
+ "title": "Sales",
+ "description": "Sales Admin",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-01 00:00:00"
+ }
+}
+```
+## View Detail Groups by id
+
+### Endpoint
+GET /groups/{id}
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+
+### Request Payload
+
+No Request Payload
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+404 | Not Found | Groups not found in database
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+
+```
+{
+ "status_code": "CDC-404",
+ "status_message": "Data not found",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data":
+ {
+ "id": 2,
+ "title": "Sales",
+ "description": "Sales Admin",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-01 00:00:00",
+ "aros_id": 2
+ }
+}
+```
+
+### Logic
+
+#### Endpoint Validation
+- must be add parameter id
+- id must exist in database
+
+#### Headers Validation
+No Headers Validation
+
+#### Request Payloads Validation
+No Request Payloads Validation
+
+### Scenario Test
+
+#### Case : Negative Case 1
+- id not exist in database
+
+Endpoint : /groups/100
+
+Response HTTP Status Code : 404
+
+Response Payload :
+```
+{
+ "status_code": "CDC-404",
+ "status_message": "data not found",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+- id is exist in database
+
+Endpoint : /groups/2
+
+Headers :
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data":
+ {
+ "id": 2,
+ "title": "Sales",
+ "description": "Sales Admin",
+ "created": "2020-12-01 00:00:00",
+ "modified": "2020-12-01 00:00:00",
+ "aros_id": 2
+ }
+}
+```
+
+## Delete Groups
+
+### Endpoint
+DELETE /groups/{id}
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | *
+Accept | application/json
+
+### Request Payloads
+No request payloads
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+404 | Not Found | Groups not found in database
+500 | Internal Server Error | some un-handle error in server
+204 | No Content | Server request has succeeded but response is no content
+
+Status 204 : No Response
+
+### Logic
+#### Endpoint Validation
+- must be add parameter id
+- id must exist in database
+
+#### Validation
+No Validation
+
+#### Special Logic
+*After delete group also delete aros where model = Groups and foreign_key = id of group*
+
+### Scenario Test
+#### Case : Negative Case 1
+- param id is not exist in database
+
+Endpoint : /groups/100
+
+Response HTTP Status Code : 404
+
+Response Payload:
+```
+{
+ "status_code": "cdc-404",
+ "status_message": "data not found",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+- param id is exist in database
+
+Endpoint : /groups/1
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+
+Response HTTP Status Code : 204
+
+Response Payload : No Response
diff --git a/doc/region-layer.png b/doc/region-layer.png
new file mode 100644
index 0000000..23d203b
Binary files /dev/null and b/doc/region-layer.png differ
diff --git a/doc/regions.md b/doc/regions.md
index 7563cd5..523304f 100644
--- a/doc/regions.md
+++ b/doc/regions.md
@@ -1 +1,470 @@
# Regions Module
+Module | HTTP Method | URL | Description
+--- | --- | --- | ---
+[Add](#add) | POST | /regions | Add Data Region
+[View](#view) | GET | /regions/:id | View Data Region
+[Edit](#edit) | PUT | /regions/:id | Edit Data Region
+[Delete](#delete) | DELETE | /regions/:id | Delete Data Region
+
+## Add Data Region
+
+### Endpoint
+POST /regions
+
+### Database
+
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | alamat.emailku@email.com
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+region_code | string | AMD
+name | string | Auto Moro Dewe
+```
+{
+ "region_code": "AMD",
+ "name": "Auto Moro Dewe"
+}
+```
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+400 | Bad Request | Bad request payload
+500 | Internal Server Error | some un-handle error in server
+201 | Created | Created
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "Bad Request",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-201",
+ "status_message": "Created",
+ "data": {
+ "id":"5e6c4216-360c-11eb-8f39-5600024efe02",
+ "region_code" : "AMD",
+ "name" : "Auto Moro Dewe",
+ "company_id" : "d58edc03-360c-11eb-8f39-5600024efe02",
+ "created" : "2020-12-02 09:03:44",
+ "modified" : "2020-12-02 09:03:44"
+ }
+}
+```
+
+### Logic
+
+#### Validation
+- region_code : required, not empty, and must be unique
+- name: required and not empty
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Request Payload : empty
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "region_code is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Request Payload :
+```
+{}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "region_code is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 3
+
+Request payload :
+```
+{
+ "region_code": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "region_code is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 4
+
+Request Payload :
+```
+{
+ "region_code": "AMD"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload :
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "name is required",
+ "data": null
+}
+```
+
+#### Case : Negative Case 5
+
+Request Payload :
+```
+{
+ "region_code": "AMD",
+ "name": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload:
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "name is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 6
+
+Request Payload
+```
+{
+ "region_code": "INTL"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "region_code already in use",
+ "data": null
+}
+```
+
+#### Case : Positive Case
+
+Request Payload :
+```
+{
+ "region_code": "AMD",
+ "name": "Auto Moro Dewe"
+}
+```
+
+Response HTTP Status Code : 201
+
+Response Payload :
+```
+{
+ "status_code": "CDC-201",
+ "status_message": "Created",
+ "data": {
+ "id":"5e6c4216-360c-11eb-8f39-5600024efe02",
+ "region_code" : "AMD",
+ "name" : "Auto Moro Dewe",
+ "company_id" : "d58edc03-360c-11eb-8f39-5600024efe02",
+ "created" : "2020-12-02 09:03:44",
+ "modified" : "2020-12-02 09:03:44"
+ }
+}
+```
+
+## View Data Region
+
+### Endpoint
+GET /regions/:id
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | alamat.emailku@email.com
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+404 | Not Found | Region not found in database
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5e6c4216-360c-11eb-8f39-5600024efe02",
+ "region_code" : "AMD",
+ "name" : "Auto Moro Dewe",
+ "company_id" : "d58edc03-360c-11eb-8f39-5600024efe02",
+ "created" : "2020-12-02 09:03:44",
+ "modified" : "2020-12-02 09:03:44"
+ }
+}
+```
+
+### Scenario Test
+
+#### Case : Positive Case
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5e6c4216-360c-11eb-8f39-5600024efe02",
+ "region_code" : "AMD",
+ "name" : "Auto Moro Dewe",
+ "company_id" : "d58edc03-360c-11eb-8f39-5600024efe02",
+ "created" : "2020-12-02 09:03:44",
+ "modified" : "2020-12-02 09:03:44"
+ }
+}
+```
+
+## Edit Data Region
+
+### Endpoint
+PUT /regions/:id
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | application/json
+Accept | application/json
+Email | alamat.emailku@email.com
+
+### Request Payloads
+Name | Type | Example Value
+--- | --- | ---
+region_code | string | MMT
+name | string | Monggo Moro Tumbas
+```
+{
+ "region_code": "MMT",
+ "name": "Monggo Moro Tumbas"
+}
+```
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+400 | Bad Request | Bad request payload
+404 | Not Found | Region not found in database
+500 | Internal Server Error | some un-handle error in server
+200 | OK | OK
+```
+{
+ "status_code": "CDC-400",
+ "status_message": "Bad Request",
+ "data": null
+}
+```
+
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5e6c4216-360c-11eb-8f39-5600024efe02",
+ "region_code" : "MMT",
+ "name" : "Monggo Moro Tumbas",
+ "company_id" : "d58edc03-360c-11eb-8f39-5600024efe02",
+ "created" : "2020-12-02 09:03:44",
+ "modified" : "2020-12-02 09:03:44"
+ }
+}
+```
+
+### Logic
+
+#### Validation
+- region_code : not empty and must be unique
+- name : not empty
+
+### Scenario Test
+
+#### Case : Negative Case 1
+
+Request Payload
+```
+{
+ "region_code": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "region_code is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 2
+
+Request Payload
+```
+{
+ "name": ""
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "name is empty",
+ "data": null
+}
+```
+
+#### Case : Negative Case 3
+
+Request Payload
+```
+{
+ "region_code": "INTL"
+}
+```
+
+Response HTTP Status Code : 400
+
+Response Payload
+```
+{
+ "status_code": "cdc-400",
+ "status_message": "region_code already in use",
+ "data": null
+}
+```
+
+#### Case : Positive Case 1
+
+Request Payload :
+```
+{
+ "region_code": "MMT",
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5e6c4216-360c-11eb-8f39-5600024efe02",
+ "region_code" : "MMT",
+ "name" : "Auto Moro Dewe",
+ "company_id" : "d58edc03-360c-11eb-8f39-5600024efe02",
+ "created" : "2020-12-02 09:03:44",
+ "modified" : "2020-12-02 10:03:44"
+ }
+}
+```
+
+#### Case : Positive Case 2
+
+Request Payload :
+```
+{
+ "name": "Monggo Moro Tumbas"
+}
+```
+
+Response HTTP Status Code : 200
+
+Response Payload :
+```
+{
+ "status_code": "CDC-200",
+ "status_message": "OK",
+ "data": {
+ "id":"5e6c4216-360c-11eb-8f39-5600024efe02",
+ "region_code" : "AMD",
+ "name" : "Monggo Moro Tumbas",
+ "company_id" : "d58edc03-360c-11eb-8f39-5600024efe02",
+ "created" : "2020-12-02 09:03:44",
+ "modified" : "2020-12-02 10:03:44"
+ }
+}
+```
+
+## Delete Data Region
+
+### Endpoint
+DELETE /regions/:id
+
+### Headers
+Key | Value
+--- | ---
+Content-Type | *
+Accept | application/json
+Email | alamat.emailku@email.com
+
+### Response Payloads
+HTTP Code | Status | Description
+--- | --- | ---
+404 | Not Found | Region not found in database
+500 | Internal Server Error | some un-handle error in server
+204 | No content | No content
+
+### Scenario Test
+
+#### Case : Positive Case
+
+Response HTTP Status Code : 204
\ No newline at end of file
diff --git a/doc/user_layer.png b/doc/user_layer.png
new file mode 100644
index 0000000..10a14a4
Binary files /dev/null and b/doc/user_layer.png differ