- About
- Requirements
- Configuration
- Firebase Backend Architecture
- Maintaining
Cloud Firestore provides us with a scalable, non-relational (NoSQL) database, which contains collections of documents to serve as a blueprint for each of the items in our database. Our database is structured with 3 collections (appointments, businesses, users), each of which has 1 document (appointment, business, user), which outlines the fields of each entry.
Collection -> Document -> Field
- appointments -> appointment -> startDate, endDate, company, service, cost, booked, location, uniqueId
- users -> user -> name, phone, email, bookedAppointments, pastAppointments, uniqueId
- businesses -> business -> name, phone, email, bookedAppointments, openAppointments, pastAppointments, service, street#, streetAddress, city, state, zip, ratings, uniqueId
firebase.database().ref("appointments").orderByChild("booked").equalTo("no");
appointmentsFilter.on('value', snapshot => {
let appointmentsArr = snapshot.val();
let newState = [];
for (let appointment in appointmentsArr) {
newState.push({
id: appointment,
name: appointmentArr[appointment].name,
startDate: appointmentArr[appointment].startDate,
zip: appointmentArr[appointment].zip,
});
}
this.setState({
appointments: newState
});
});
Firebase functions allow us to chain multiple filters together. For instance, we can search for all unbooked appointments for a specific service, such as haircuts:
firebase.database().ref("appointments").orderByChild("booked").equalTo("no").orderByChild("service").equalTo("haircuts");
appointmentsFilter.on('value', snapshot => {
let appointmentsArr = snapshot.val();
let newState = [];
for (let appointment in appointmentsArr) {
newState.push({
id: appointment,
name: appointmentArr[appointment].name,
startDate: appointmentArr[appointment].startDate,
zip: appointmentArr[appointment].zip,
});
}
this.setState({
appointments: newState
});
});
For more information, please consult the Firebase Documentation: https://firebase.google.com/docs/functions/
Our Application runs React on the front end, and handles the backend and hosting through Firebase.This full stack-application was developed and is currently maintained by Anthony, Harrison, Henry, Jeffrey, and Mark.