# Firebase Function in Code

{% hint style="warning" %}
This section is for the Ionic 4 version of this platform, where Firebase Functions were used to make the apps talk to each other. Ionic 5 version does not use Firebase Functions.
{% endhint %}

## Firebase Functions in Code

In the source code, Firebase functions are located in the User app in the `functions` folder

![](/files/-LqLCax-O-ATpyNd2sgo)

There are five Firebase functions in-built currently

* **getDriver** - This function is called when User books a ride. This function finds a suitable driver and responds to User app, writes appropriate Data to `customer` and `driver` tables. Note, for demo purpose, the functions currently only looks for the driver who is logged in with the demo login (i.e. <admin@enappd.com>). You can change the logic here. <br>
* **acceptRide** - This function is called when Driver accepts an incoming ride request. This function writes appropriate info to `customers` table and gives back response to Driver app. User app receives a signal that driver has accepted.\
  \
  After this functions completion, driver can not accept new ride, and customer can not book new ride until ride is completed.<br>
* **rejectRide** - This function is called when Driver rejects an incoming ride request. This function writes appropriate info to `customers` table and gives back response to Driver app. User app receives a signal that driver has rejected.\
  \
  After this functions completion, driver can accept new ride, and customer can book new ride.<br>
* **driverNoRespond** - This function is called when Driver does not respond to an incoming ride request for a limited amount of time. This function writes appropriate info to `customers` and `drivers` table and gives back response to Driver app. User app receives a signal that driver is not responding.\
  \
  After this functions completion, driver can accept new ride, and customer can book new ride.<br>
* **completeRide** - This function is called when the Driver completes ride at destination. This function writes appropriate information to `customers` and `drivers` table. After this functions completion, driver can accept new ride, and customer can book new ride.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://enappd.gitbook.io/ionic-taxi-booking-app-starter/extra/firebase-functions/firebase-function-in-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
