# API Documentation
## /accounts/ -- Account related API
* **create/employee -- POST**
```
Params : string name (required)
return : EmployeeModel {
name : string,
stars : number,
currentOrder : enum {'free', 'busy'}
}
```
Function : Create an employee account and save it on the database. Return the formed account.
* **create/customer -- POST**
```
Params : string name(required)
return : CustomerModel {
name : string,
status : enum {'accepted', 'active', 'inactive'}
}
```
Function : Create a customer account and return the formed account.
* **create/store -- POST**
```
Params: string name (required),
Number latitude (required),
Number longitude (required)
return : StoreModel {
name : string,
stars : Number,
latitude : Number,
longitude : Number
}
```
Function : Create a store and saved it on the database. Return the formed account.
## /customer/ Customer API
* **create -- POST**
```
Params: string customerId (required),
string district (required),
customerList: [Schema({}, strict: false)] customerList (required)
return: {
success : true,
data : CustomerOrder{
customerId : string,
district : string,
employeeTargetPrice : number (not required),
customerPrice: Number,
customerList: [Schema({}, strict: false)],
status : Enum {'created', 'batched', 'accepted', 'solved'}
}
}
```
Function : Create an order and save it on the database and return a success result with the order formed. (Internal function) If the current number of orders exceed the threshold, it will complile and createOrder for the employee to accept.
## /employee/ Employee API
* **order -- GET**
```
Params : string employeeID (required)
Return : EmployeeOrder{
employeeId : string (not required),
district : string,
batchOrderIds : string[],
employeeTargetPrice : Number(not required),
employeeList : [Schema({}, {strict: false})],
status : enum {'created', 'accepted', 'solved'}
}
```
Function : Return an accepted order when called, and updating the status of both Employee, Customer and CustomerOrder according to the accepted EmployeeOrder
* **add -- POST**
```
Params: [new Schema({}, {strict: false})] employeeList,
Number orderID
return: CustomerOrder {
customerId : string,
district: string,
employeeTargetPrice : Number (not required),
customerPrice : optionsNumber,
customerList : [Schema({}, {strict: false})],
status : {'created', 'batched', 'accepted', 'solved'}
}
```
Function : Update the price in the current employeeOrder and returns the pre-updated customerOrder
* **solve -- POST**
```
Params : string orderId,
return : CustomerOrder{
customerId : string,
district : string,
employeeTargetPrice : number (not required),
customerPrice: Number,
customerList: [Schema({}, strict: false)],
status : Enum {'created', 'batched', 'accepted', 'solved'}
}
```
Function : Update the specific customerOrder with orderID to be completed, and return the updated customerOrder.
## /feedback/ Feedback API
* **create -- POST**
```
Params: string customerId,
string target,
Number stars,
string type {'employee', 'item'}
return: FeedbackModel {
customerId : string,
target: string,
stars: Number
}
```
Function : Create and save a Feedback provided on the employee/ item depending on the params type. Returns the FeedbackModel
important Links
--
https://authentication-backend-e6621-default-rtdb.firebaseio.com/ (user authentication)
https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=AIzaSyDUC1KqseroLQTj2Iz0p-k2l9UmHNEJFPg (generate token)