Before running the Resevify application, make sure you have fulfilled the following prerequisites:
- Go (Golang) is installed on your system.
- PostgreSQL is installed, and you have created the tables as specified in the
ddl.sql
file. Then, insert the table contents from thedml.sql
file as dummy data. - An active internet connection is required to download Go dependencies.
Once the application is running, you can access it through a web browser or use it through an API client such as Postman or cURL. Then, you can log in using an account created by the admin. This application provides APIs for managing Rooms, Facilities, Employees, and Transactions.
Below are instructions on how to use the API based on the features provided by the Resevify application:
Request :
- Method :
POST
- Endpoint :
/employees
- Header :
- Content-Type : application/json
- Accept : application/json
- Body :
{
"username": "string",
"password": "string"
}
Request :
- Method : POST
- Endpoint :
/employees
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
- Body :
{
"name": "string",
"username": "string",
"password": "string",
"role": "string",
"division": "string",
"position": "string",
"contact": "string"
}
Response :
- Status : 201 Created
- Body :
{
"status": {
"code": 201,
"message": "Created"
},
"data": {
"id": "string",
"name": "string",
"username": "string",
"password": "string",
"role": "string",
"division": "string",
"position": "string",
"contact": "string",
"createdAt": "2000-01-01T12:00:00Z", (curent time)
"updatedAt": "2000-01-01T12:00:00Z" (curent time)
}
}
Request :
- Method : GET
- Endpoint :
/employees
- Header :
- Content-Type : application/json
- Accept : application/json
- Query Param :
- page : int
optional
- size : int
optional
- page : int
- Authorization : Bearer Token
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data": [
{
"id": "string",
"name": "string",
"username": "string",
"password": "string",
"role": "string",
"division": "string",
"position": "string",
"contact": "string",
"createdAt": "2000-01-01T12:00:00Z",
"updatedAt": "2000-01-01T12:00:00Z"
}
],
"paging": {
"page": 1, (default value)
"rowsPerPage": 5, (default value)
"totalRows": int,
"totalPages": int
}
}
Request :
- Method : GET
- Endpoint :
/employees/:id
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data": {
"id": "string",
"name": "string",
"username": "string",
"password": "string",
"role": "string",
"division": "string",
"position": "string",
"contact": "string",
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z"
}
}
Request :
- Method : GET
- Endpoint :
/employees/username/:username
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data": {
"id": "string",
"name": "string",
"username": "string",
"password": "string",
"role": "string",
"division": "string",
"position": "string",
"contact": "string",
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z"
}
}
Request :
- Method : PUT
- Endpoint :
/employees
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
{
"id": "string",
"name": "string",
"username": "string",
"password": "string",
"role": "string",
"division": "string",
"position": "string",
"contact": "string"
}
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "Updated Successfully"
},
"data": {
"id": "string",
"name": "string",
"username": "string",
"password": "string",
"role": "string",
"division": "string",
"position": "string",
"contact": "string",
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z" (current time)
}
}
Request :
- Method : POST
- Endpoint :
/facilities
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
- Body :
{
"name": "string",
"quantity": int
}
Response :
- Status : 201 Created
- Body :
{
"status": {
"code": 201,
"message": "Created"
},
"data": {
"id": "string",
"name": "string",
"quantity": int,
"createdAt": "2000-01-01T00:00:00Z", (current time)
"updatedAt": "2000-01-01T00:00:00Z" (current time)
}
}
Request :
- Method : GET
- Endpoint :
/facilities
- Header :
- Content-Type : application/json
- Accept : application/json
- Query Param :
- page : int
optional
- size : int
optional
- page : int
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "ok"
},
"data": [
{
"id": "string",
"name": "string",
"quantity": int,
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z"
}
],
"paging": {
"page": 1, (default value)
"rowsPerPage": 5, (default value)
"totalRows": int,
"totalPages": int
}
}
Request :
- Method : GET
- Endpoint :
/facilities/:id
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "ok"
},
"data": {
"id": "string",
"name": "string",
"quantity": int,
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z"
}
}
Request :
- Method : GET
- Endpoint :
/facilities/:id
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
{
"id": "string",
"name": "string",
"quantity": int
}
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "Updated"
},
"data": {
"id": "string",
"name": "string",
"quantity": int,
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z" (curent time)
}
}
Request :
- Method : POST
- Endpoint :
/rooms
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
- Body :
{
"name": "string",
"room_type": "string",
"capacity": int,
"status": "string"
}
Response :
- Status : 201 Created
- Body :
{
"status": {
"code": 201,
"message": "Created"
},
"data": {
"id": "string",
"name": "string",
"room_type": "string",
"capacity": int,
"status": "string",
"createdAt": "2000-01-01T12:00:00Z", (curent time)
"updatedAt": "2000-01-01T12:00:00Z" (curent time)
}
}
Request :
- Method : GET
- Endpoint :
/rooms
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
- Query Param :
- page : int
optional
- size : int
optional
- page : int
Response :
- Status : 201 Ok
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data": [
{
"id": "string",
"name": "string",
"room_type": "string",
"capacity": int,
"status": "string",
"created_at": "2000-01-01T00:00:00Z",
"updated_at": "2000-01-01T00:00:00Z"
}
],
"paging": {
"page": 1, (default value)
"rowsPerPage": 5, (default value)
"totalRows": int,
"totalPages": int
}
}
Request :
- Method : GET
- Endpoint :
/rooms/:id
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
- Query Param :
- page : int
optional
- size : int
optional
- page : int
Response :
- Status : 201 Ok
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data":{
"id": "string",
"name": "string",
"room_type": "string",
"capacity": int,
"status": "string",
"created_at": "2000-01-01T00:00:00Z",
"updated_at": "2000-01-01T00:00:00Z"
}
}
Request :
- Method : GET
- Endpoint :
/rooms
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
- Query Param :
- page : int
optional
- size : int
optional
- page : int
Response :
- Status : 201 Ok
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data":{
"id": "string",
"name": "string",
"room_type": "string",
"capacity": int,
"status": "string",
"created_at": "2000-01-01T00:00:00Z",
"updated_at": "2000-01-01T00:00:00Z"
}
}
Request :
- Method : GET
- Endpoint :
/rooms
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
{
"id": "string",
"name": "string",
"room_type": "string",
"capacity": int, (optional)
"status": "string" (optional)
}
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 201,
"message": "Updated"
},
"data": {
"id": "string",
"name": "string",
"room_type": "string",
"capacity": int,
"status": "string",
"created_at": "2000-01-01T00:00:00Z",
"updated_at": "2000-01-01T00:00:00Z" (current time)
}
}
Request :
- Method : GET
- Endpoint :
/rooms
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
{
"id": "string",
"status": "string"
}
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 201,
"message": "Updated"
},
"data": {
"id": "string",
"name": "string",
"room_type": "string",
"capacity": int,
"status": "string",
"created_at": "2000-01-01T00:00:00Z",
"updated_at": "2000-01-01T00:00:00Z" (current time)
}
}
Request :
- Method : POST
- Endpoint :
/roomfacilities
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
- Body :
{
"roomId": "string",
"facilityId": "string",
"quantity": int,
"description": "string"
}
Response :
- Status : 201 Created
- Body :
{
"status": {
"code": 201,
"message": "Created"
},
"data": {
"id": "string",
"roomId": "string",
"facilityId": "string",
"quantity": int,
"description": "string",
"createdAt": "2000-01-01T12:00:00Z", (curent time)
"updatedAt": "2000-01-01T12:00:00Z" (curent time)
}
}
Request :
- Method : GET
- Endpoint :
/roomfacilities
- Header :
- Content-Type : application/json
- Accept : application/json
- Query Param :
- page : int
optional
- size : int
optional
- page : int
- Authorization : Bearer Token
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data": [
{
"id": "string",
"roomId": "string",
"facilityId": "string",
"quantity": 5,
"description": "string",
"createdAt": "2000-01-01T12:00:00Z",
"updatedAt": "2000-01-01T12:00:00Z"
}
],
"paging": {
"page": 1, (default value)
"rowsPerPage": 5, (default value)
"totalRows": int,
"totalPages": int
}
}
Request :
- Method : GET
- Endpoint :
/roomfacilities/:id
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data": {
"id": "string",
"roomId": "string",
"facilityId": "string",
"quantity": int,
"description": "string",
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z"
}
}
Request :
- Method : PUT
- Endpoint :
/roomfacilities
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
{
"id": "string",
"quantity": int,
"description": "string"
}
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 201,
"message": "Updated"
},
"data": {
"id": "string",
"roomId": "string",
"facilityId": "string",
"quantity": int,
"description": "string",
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z" (current time)
}
}
Request :
- Method : POST
- Endpoint :
/transactions
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
- Body :
{
"employeeId": "string",
"roomId": "string",
"roomFacilities": [ (optional)
{
"facilityId": "string",
"quantity": int,
"description": "string"
}
],
"description": "string",
"startTime": "2000-01-01T00:00:00Z",
"endTime": "2000-01-01T01:00:00Z"
}
Response :
- Status : 201 Created
- Body :
{
"status": {
"code": 201,
"message": "Created"
},
"data": {
"id": "string",
"employeeId": "string",
"roomId": "string",
"roomFacilities": [
{
"id": "string",
"facilityId": "string",
"quantity": int,
"description": "string",
"createdAt": "2000-01-01T00:00:00Z", (current time)
"updatedAt": "2000-01-01T00:00:00Z" (current time)
}
],
"description": "string",
"status": "string",
"startTime": "2000-01-01T00:00:00Z",
"endTime": "2000-01-01T01:00:00Z",
"createdAt": "2000-01-01T00:00:00Z", (current time)
"updatedAt": "2000-01-01T00:00:00Z" (current time)
}
}
Request :
- Method : GET
- Endpoint :
/transactions
- Header :
- Content-Type : application/json
- Accept : application/json
- Query Param :
- page : int
optional
- size : int
optional
- startDate : date(yyyy-mm-dd)
optional
- endDate : date(yyyy-mm-dd)
optional
- page : int
- Authorization : Bearer Token
{
"status": {
"code": 200,
"message": "Ok"
},
"data": [
{
"id": "string",
"employeeId": "string",
"roomId": "string",
"roomFacilities": [
{
"id": "string",
"facilityId": "string",
"quantity": int,
"description": "string",
"createdAt": "2000-01-01T12:00:00Z",
"updatedAt": "2000-01-01T12:00:00Z"
}
],
"description": "string",
"status": "string",
"startTime": "2000-01-01T12:00:00Z",
"endTime": "2000-01-01T12:00:00Z",
"createdAt": "2000-01-01T12:00:00Z",
"updatedAt": "2000-01-01T12:00:00Z"
}
],
"paging": {
"page": 1, (default value)
"rowsPerPage": 5, (default value)
"totalRows": int,
"totalPages": int
}
}
Request :
- Method : GET
- Endpoint :
/transactions/:id
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data": {
"id": "string",
"employeeId": "string",
"roomId": "string",
"roomFacilities": [
{
"id": "string",
"facilityId": "string",
"quantity": int,
"description": "string",
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z"
}
],
"description": "string",
"status": "string",
"startTime": "2000-01-01T00:00:00Z",
"endTime": "2000-01-01T00:00:00Z",
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z"
}
}
Request :
- Method : GET
- Endpoint :
/transactions/employee/:id
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
Response :
- Status : 200 OK
- Body :
{
"status": {
"code": 200,
"message": "Ok"
},
"data": {
"id": "string",
"employeeId": "string",
"roomId": "string",
"roomFacilities": [
{
"id": "string",
"facilityId": "string",
"quantity": int,
"description": "string",
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z"
}
],
"description": "string",
"status": "string",
"startTime": "2000-01-01T00:00:00Z",
"endTime": "2000-01-01T00:00:00Z",
"createdAt": "2000-01-01T00:00:00Z",
"updatedAt": "2000-01-01T00:00:00Z"
}
}
Request :
- Method : PUT
- Endpoint :
/transactions
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
{
"status": {
"code": 201,
"message": "Updated"
},
"data": {
"id": "string",
"employeeId": "string",
"roomId": "string",
"description": "string",
"status": "string",
"startTime": "2000-01-01T00:00:00Z",
"endTime": "2000-01-01T01:00:00Z",
"createdAt": "2000-01-01T00:00:00Z", (current time)
"updatedAt": "2000-01-01T00:00:00Z" (current time)
}
}
Request :
- Method : GET
- Endpoint :
/reports/download
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer Token
- Query Param :
- range : string