For steps on how to work with this repository please see here
You can find the deployed project at Heroku.
Christian Berumen | David White |
---|---|
- Authenticates with Okta using the @okta/jwt-verifier library
- Relational database using the Postgres RDBMS
- REST architecture
Back end deployed to Heroku
Front end built using:
- React
- Redux
- Mapbox
- Ant Design
- express
- @okta/jwt-verifier
- axios
- knex
- pg
- cookie-parser
- cors
- cross-env
- debug
- dotenv
- eslint
- faker
- helmet
- http-errors
- husky
- jest
- lint-staged
- morgan
- nodemon
- prettier
- supertest
- swagger-jsdoc
- swagger-ui-express
Okta authentication uses the profileRouter
and profileModel
files. Data persists in the profile
table.
Groomer business locations are stored in the locations
table. The locationRouter
and locationModel
access and store the location data.
Pet data is stored in the pets
table. The petRouter
and petModel
access and store the location data.
PORT
- API port (optional, but helpful with FE running as well)- The following ports are whitelisted for use with okta
- 3000
- 8000
- 8080
- The following ports are whitelisted for use with okta
DATABASE_URL
- connection string for postgres databaseOKTA_URL_ISSUER
- The complete issuer URL for verifying okta access tokens.https://example.okta.com/oauth2/default
OKTA_CLIENT_ID
- the okta client ID.
See .env
file for example values
There are 3 options to get postgresql installed locally [Choose one]:
- Use docker. Install for your platform
- run:
docker-compose up -d
to start up the postgresql database and pgadmin. - Open a browser to pgadmin and you should see the Dev server already defined.
- If you need to start over you will need to delete the folder
$ rm -rf ./data/pg
as this is where all of the server data is stored.- if the database
api-dev
was not created then start over.
- if the database
- run:
- Download and install postgresql directly from the main site
- make note of the port, username and password you use to setup the database.
- Connect your client to the server manually using the values previously mentioned
- You will need to create a database manually using a client.
- Make sure to update the DATABASE_URL connection string with the values for username/password, databasename and server port (if not 5432).
- Setup a free account at ElephantSQL
- Sign up for a free
Tiney Turtle
plan - copy the URL to the DATABASE_URL .env variable
- make sure to add
?ssl=true
to the end of this url
- Sign up for a free
- create your project repo by forking or using this as a template.
- run:
npm install
to download all dependencies. - confirm correct env variables in your
.env
file. - run:
npm run knex migrate:latest
to create the starting schema. - run:
npm run knex seed:run
to populate your db with some data. - run:
npm run tests
to confirm all is setup and tests pass. - run:
npm run watch:dev
to start nodemon in local dev enviornment.
Make sure to update the details of the app name, description and version in the
package.json
andconfig/jsdoc.js
files.
Release #: 2
Release status: In progress
Trello Board: https://trello.com/b/ZfhxRCcq/labs-pt12-express-groomer-team-f
Whimsical (Architecture): https://whimsical.com/architecture-diagram-ADh8unt91rRsvfsWk3YLfA
Whimsical (User Flow): https://whimsical.com/express-groomer-UAEP3cKj4Nm9ZH5vxoaw7M
The backend supports the following app features:
-
The API is a fully functional Node/Express web application interfacing with a Postgres db
-
Knex is the query builder used to create database model functions
-
Authentication middleware enables the front end to use Okta authentication
-
Authorization middleware in the
pets
route handlers restricts changes made to pet records. Only the pet’s owner is permitted to modify a pet record, including updating or deleting it -
There are three database tables:
profiles
: The profile data populated from both Okta and user entrieslocations
: The groomer’s business location data, including business name and addresspets
: The client’s pet data, including pet name, type, and a flag for whether the pet has all shots up to date
-
Each table has an accompanying node router:
profileRouter
, for controlling the data to/from theprofiles
tablelocationRouter
, for controlling data to/from thelocations
tablepetRouter
, for controlling data to/from thepets
table
Using the profiles
table and the profileRouter
:
- Users can create an account and register as either a client or a groomer
- Users of either type can login using Okta authentication
- Users can persist user profile data in the
profiles
table using theprofileRouter
Using the locations
table and locationRouter
:
- Groomers can add profile data in their profile page with information about their business
- The Mapbox component can reference the latitude and longitude of a groomer's location (support for this)
- The Mapbox component can include the groomer's business name in the popup (support for this)
Using the pets
table and petRouter
, users can:
- Clients can enter pet details in their profile or pet pages and save the data to the
pets
table
There are basic unit tests of all route handlers and their HTTP methods.
- Finish release 2
- Add a pet health issues table and pet health issues router
- Add a join table for a many-to-many relationship between pet health issues and pets,
pets_healthissues
- Add an
appointments
table as per the architecture document: Whimsical Architecture Diagram - Add backend middleware, utils or controllers necessary to render data in an easy to use format for the frontend, especially for the
appointments
related features. For instance, one user story reads "As a groomer, I want to be able to see the requests that I get from users and manage them". It would be ideal to structure that data and output it in the desired manner for the front end devs to facilitate development. - Add a
favorites
table with saved favorite groomers that the users can access and manage (full CRUD is probably needed)
- All release 3 features, including those for the following user stories:
- As a client, I want to be able to pay in a convenient and fast way (Stripe)
- As a groomer, I want to be able to process payments from the customers and receive them in my bank account (Stripe)
- As a client, I want to be able to rate groomers based on my experience and provide comments
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct. Please follow it in all your interactions with the project.
If you are having an issue with the existing project code, please submit a bug report under the following guidelines:
- Check first to see if your issue has already been reported.
- Check to see if the issue has recently been fixed by attempting to reproduce the issue using the latest master branch in the repository.
- Create a live example of the problem.
- Submit a detailed bug report including your environment & browser, steps to reproduce the issue, actual and expected outcomes, where you believe the issue is originating from, and any potential solutions you have considered.
We would love to hear from you about new features which would improve this app and further the aims of our project. Please provide as much detail and information as possible to show us why you think your new feature should be implemented.
If you have developed a patch, bug fix, or new feature that would improve this app, please submit a pull request. It is best to communicate your ideas with the developers first before investing a great deal of time into a pull request to ensure that it will mesh smoothly with the project.
Remember that this project is licensed under the MIT license, and by submitting a pull request, you agree that your work will be, too.
- Update the README.md with details of changes to the interface, including new plist variables, exposed ports, useful file locations and container parameters.
- Ensure that your code conforms to our existing code conventions and test coverage.
- Include the relevant issue number, if applicable.
- You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
See Backend Documentation for details on the backend of our project.