Skip to content

MiguelLamas/final-project-back-end-care-full-app

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation




List of Contents

  1. Introduction
  2. Environment Variables
  3. Run Locally
  4. Running Tests
  5. Tech Stack
  6. API References
  7. The Team
  8. Appendix



Care-Full App 🏥🐈🐶🐇

Welcome to Care-Full!

This app was created as part of the School of Code bootcamp, a team of 6 animal lovers came together and began brainstorming what real world problem we wanted to solve. Soon we realised a common issue experienced amongst pet owners - remembering when specific symptoms began and tracking how many times a symptom has been experienced. This then led us onto talking about the difficulty of remembering when you need to administer medication and attend appointments. After lots of ideation and grand ideas, we pulled ourselves back to reality and came up with a viable product that we could plan and produce in only 4 weeks, this is the result.

Problem statement: Having a sick pet is a stressful situation, on top of our already busy lives, this additional stress can make it difficult to remember the specific details of your pet's illness and their needs.

Solution: This app aims to alleviate some of the stress that comes with having a sick pet by providing the user with an easy way to track symptoms and medications and facilitate better and more accurate in person communication when visiting the vets.

This repository holds the code to make our API, it runs on an Express Server, making queries to a POSTGRESQL Database. The credentials for the database will be stored in your environment variables.

The server handles requests to a database with 3 tables that allows for users to add and update pet details as well as adding symptoms and appointments.

The Care-Full website makes fetch requests to this server when running locally.

This README is for the Back-end of the Care-Full app. If you would like to explore the Front-end of the app please go to the Front-end repository




Environment Variables

To run this project locally, you will need to add the following environment variables to your .env file

DATABASE_URL



Run Locally 💻

Clone the project

  git clone https://github.com/SchoolOfCode/final-project_back-end-team-con-cat-enate-room-7.git

Go to the project directory

  cd final-project_back-end-team-con-cat-enate-room-7.git

Install dependencies

  npm install

Start the server

  npm run start

Copy your database (e.g. Heroku) URL into the .env file, following the format:

 DATABASE_URL = <Database URL goes here>

Create all tables in your database by running the following scripts in the terminal:

npm run createSymptomsTable
npm run createRemindersTable
npm run createPetsTable

To populate the tables you can achieve this by interacting with the front end UI here https://care-full.netlify.app. If you would like to run the front end locally, please follow the instructions in the next section.




Frontend

The front end is deployed using netlify, however you will need to follow the steps below if you would like to run it locally.

  1. Git clone the frontend repository.
  git clone https://github.com/SchoolOfCode/final-project_front-end-team-con-cat-enate-room-7
  1. Remember to navigate to the correct folder: final-project_front-end-team-con-cat-enate-room-7

  2. Install all necessary dependencies by running the following command in the terminal.

  npm i
  1. Start the app.
  npm run dev



Running Tests

To run tests, run the following command

  npm run test



Tech Stack⚙️

Client: Next.js, CSS, Chakra Component Library, Auth0
Server: Node, Express, PostreSQL, Nanoid
Client-side Testing: React Testing Library, Cypress
Server-side Testing: Supertest, Jest




API Reference


Pets Table


Get all pets belonging to a user

  GET /pets/${user_id}
Parameter Type Description
user_id string Required. User ID associated with account

Get the info of a single pet belonging to a user

  GET /pets/${user_id}?pet_id=${pet_id}
Parameter Type Description
user_id string Required. User ID associated with account
pet_id string Required. Pet ID

Get the info of a single pet

  GET /pets?pet_id=${pet_id}
Parameter Type Description
pet_id string Required. Pet ID

Post the data for a new pet

  POST /pets
Parameter Type Description
body JSON Required. JSON object containing pet details
user_id string Required. ID associated with user account (Front End obtains this from Auth0)
pet_id string Required. ID associated with the pet (Front End generates this with nanoid)
name string Required. Name of Pet
species boolean Required. Species of pet true is Cat, false is Dog
breed string Breed of Pet
age Integer Age of Pet
weight Float Weight of Pet

Update the data of a Pet

  PUT /pets/${pet_id}
Parameter Type Description
body JSON Required. JSON object containing pet details
user_id string ID associated with user account (Front End obtains this from Auth0)
pet_id string Required. ID associated with the pet (Front End generates this with nanoid)
name string Name of Pet
species boolean Species of pet true is Cat, false is Dog
breed string Breed of Pet
age Integer Age of Pet
weight Float Weight of Pet

Symptoms Table


Get all symptoms associated with a pet

  GET /symptoms/${pet_id}
Parameter Type Description
pet_id string Required. ID associated with pet

Get all incidents of a particular symptom associated with a pet

  GET /symptoms/${pet_id}?symptoms_id=${symptoms_id}
Parameter Type Description
pet_id string Required. ID associated with pet
symptoms_id string Required. ID associated with a symptom entry

Post the data for a new symptom

  POST /symptoms
Parameter Type Description
body JSON Required. JSON object containing symptom details
user_id string Required. ID associated with user account (Front End obtains this from Auth0)
pet_id string Required. ID associated with the pet (Front End generates this with nanoid)
symptoms_id string Required. ID associated with the symptom (Front End generates this with nanoid)
incident_id string Required. ID associated with the incident (Front End generates this with nanoid)
symptoms string Required. Title/Name of the symptom
date string Required. Date that the incident occured
time string Required. Time that the incident occured
description string Required. More detailed explanation of the symptom

Delete a symptom and all its incidents

  Delete /symptoms/${symptoms_id}
Parameter Type Description
symptoms_id string Required. ID associated with a symptom entry

Reminders Table


Get all reminders belonging to a pet

  GET /reminders/pet_id=${pet_id}
Parameter Type Description
pet_id string Required. ID associated with a pet

Post the data for a new reminder

  POST /reminders
Parameter Type Description
body JSON Required. JSON object containing symptom details
user_id string Required. ID associated with user account (Front End obtains this from Auth0)
pet_id string Required. ID associated with the pet (Front End generates this with nanoid)
reminder_id string Required. ID associated with the reminder (Front End generates this with nanoid)
task string Required. Title/Name of the task
date string Required. Date that the task needs to be completed by
completed boolean Required. Whether the task has been completed (default value is false)
repeated boolean Required. Whether the task is done needs to be done multiple times
frequency string How often the task needs to be completed Suitable entries: (null, 1, 7, 30, 365)

Update the completed parameter of a reminder

  Patch /reminders/${reminder_id}
Parameter Type Description
reminder_id string Required. ID associated with a reminder entry
body JSON Required. JSON object containing symptom details
completed boolean Required. Whether the task has been completed

Delete a reminder

  Delete /reminders/${reminder_id}
Parameter Type Description
reminder_id string Required. ID associated with a reminder entry

---

The Team

We are Con-Cat-enate!




Appendix📝


About

Final Project - Back End - Care-full App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.9%
  • Procfile 0.1%