Table of Contents
Garden Party is a social application that allows home gardeners to share their surplus harvest with their communities. A user is able to create a post with images and edit their profile. It is composed of a backend application built using Ruby on Rails and GraphQL and a frontend React application.
The bulk of this project was designed and built by a team of five engineers in under two weeks while attending Turing School of Software and Design. This backend API uses CircleCI for continuous integration and is hosted on Heroku. The frontend repository can be found here.
This project features:
- Exposing a GraphQL endpoint
- Exposing RESTful endpoints for uploading images
- Active Storage
- Amazon Web Services S3 Buckets
- Testing API exposure with RSpec and Postman
- Composing advanced ActiveRecord queries to analyze information stored in PostgreSQL database
- Write SQL statements without the assistance of an ORM
- Implement json:api standards
- Add custom error responses for invalid API requests
-
Clone this repo
-
Install gem packages:
bundle -
Setup the database. A pgdump is included in
./dbto seed the databaserails db:{create,migrate,seed} -
Run the RSpec test suite:
bundle exec rspec -
Start your local server:
rails s
- Ruby 2.5.3
- Rails 5.2.4
POST http://localhost:3000/graphql
The following is documentation for the exposed GraphQL schema.
User Type Fields: id, username, passwordDigest, city, zipCode, state, posts, createdAt, updatedAt
getAllUsers: returns all users
getOneUser: returns one user from an id
Arguments:
id (required)
updateUser: updates a user’s info specified by id
Arguments:
id (required),
username, city, state, zipCode (optional)
createUser: creates a user with specified information
Arguments:
Username, city, state, zipCode, password, passwordConfirmation (required)
deleteUser: deletes the specified user
Arguments:
id (required)
Post Type Fields: id, userId, tags, title, description, createdAt, updatedAt
getAllPosts: returns all posts
getOnePost: returns one post from an id
Arguments:
id (required)
updatePost: updates a post’s info specified by id
Arguments:
id (required),
title, description (optional)
createPost: creates a post with specified information
Arguments:
userId, tags, title, description (required)
deletePost: deletes the specified post
Arguments:
id (required)
All image upload functionality is handled through RESTful endpoints.
Required parameters: user id and an image file.
PUT http://localhost:3000/api/v1/users/:id
Below is an example of the response body format for a successful upload:
{
"success": {
"message": "Avatar updated"
}
}
Unsuccessful response:
{
"error": {
"message": "Avatar not updated"
}
}
Required parameters: post id and an image file.
PUT http://localhost:3000/api/v1/posts/:id
Below is an example of the response body format for a successful upload:
{
"success": {
"message": "Image updated"
}
}
Unsuccessful response:
{
"error": {
"message": "Avatar not updated"
}
}
Grayson Myers - LinkedIn
Aiden Mendez — LinkedIn