- What it does
- How to Install
- Dependencies
- Learning Goals
- Project Diagram
- Schema
- API Contract
- Licenses
- Backend Team
- Contact
One part crowdsourced songwriting, one part rap battle, Cappua is a monthly hip hop music competition app in which users compete to get their verse included in the given month's featured track. Users upload their verse for a month's track and vote on their favorite uploaded verses as they vie for their place on Olympus, the Cappua Hall of Fame.
The Cappua BE repo creates both GraphQL queries and a ReSTful endpoint for the FE repo to access data. This repo handles audio file uploads to the Cappua AWS S3 bucket, and stores the S3 bucket file locations for easy FE access via the AWS Cloudfront CDN. Finally, the repo stores vote data and user data in its relational database. Please visit the Cappua FE Repo here.
For usage on your local machine follow the instructions listed below:
git clone [email protected]:Cappua/cappua-be.git
cd cappua-be
bundle install
rake db:{create,migrate,seed}
figaro install
rails server
visit localhost:3000 in your web browser
-
This app uses Rails version
5.2.4.4
-
We use the AWS SDK for Ruby Gem to upload audio files to our AWS S3 Bucket.
-
We use the Figaro Gem to keep confidential information like API keys secure.
-
We use the Fast JSON API Gem to serialize data for our ReSTful
POST /upload
endpoint. -
The SimpleCov gem was used to ensure that we covered 100% of our code with unit testing.
-
Explore and integrate AWS services
-
Gain familiarity and confidence in working with full FE & BE teams
-
Incorporate agile processes such as standups and kanban boards
-
Create versatile GraphQL queries
-
Refactor code for better code for improved organization/readability
-
Iterate upon collaborative workflow with small commits, descriptive pull requests, and code reviews
-
Write thorough and understandable documentation
Our BE API uses a combination of a ReSTful endpoint and GraphQL queries. Our single ReSTful endpoint, POST /upload
, handles audio file uploads into our nested AWS S3 bucket, and creates related entries in our database. Our GraphQL queries handle all the rest of our CRUD functionality.
POST /upload allows for the upload of audio files and the creation of both competition and verse rows in our BE database. The required parameter type
is used to define which of these two functions will be performed. Parameters must be passed in with a multipart/form-data
content type header.
Name | Type | Description |
---|---|---|
type | String | (required) 'verse' or 'competition' to specify what kind of file is being uploaded |
audio | mp3 | (required) Audio file to be uploaded |
user_id | Integer | (required for verse uploads) - the id of the user that is uploading a verse |
competition_id | Integer | (required for verse uploads) - the id of the competition that a verse is being uploaded for |
title | String | (required for verse uploads) - the name of the verse |
Month | Integer | (required for competition uploads) - Numeric Representation (1 - 12) of the month competition is held in |
Year | Integer | (required for competition uploads) - Numeric Representation of the year competition is held in |
Description | String | (required for competition uploads) - Description of the competition to be shown on the competitions page |
Genre | String | (required for competition uploads) - Genre of the competition to be shown on the competitions page |
Rules | String | (required for competition uploads) - Rules for the competition to be shown on the competitions page |
Title | String | (required for competition uploads) - Title of the competition to be shown in the media player |
Image | String | (optional for competition uploads) - Image of the competition to be shown on the competitions page |
{
"data": {
"id": "210",
"type": "verse",
"attributes": {
"id": "210",
"audio_path": "verses/es_zone_in.mp3",
"competition_id": "204",
"user_id": "283",
"title": "Just a Friend"
}
}
}
{
"data": {
"id": "207",
"type": "competition",
"attributes": {
"id": "207",
"track_path": "competitions/es_zone_in.mp3",
"month": "2",
"year": "2021",
"description": "Wu Tang Sword Style",
"genre": "East Coast Hip Hop",
"rules": "Submissions due by February 14th. Winners announced on March 1st",
"title": "Wu Tang Forever",
"image": "https://i.ytimg.com/vi/5CzsXvAZ6R4/mqdefault.jpg"
}
}
}
query {
competitions {
id
trackPath
month
year
description
genre
rules
title
image
verses { verseType }
}
}
{
"data": {
"competition": {
"id": "213",
"trackPath": "http://stiedemann.biz/thurman",
"month": "7",
"year": "2021",
"description": "Pidgeot",
"genre": "Struggle",
"rules": "Anistar City",
"title": "Wu Tang Forever",
"image: "https://i.ytimg.com/vi/5CzsXvAZ6R4/mqdefault.jpg"
"verses": [
{"id": "223"},
{"id": "224"}
]
}
}
}
query {
verses {
id
competitionId
userId
audioPath
user { userType }
votes { voteType }
track { trackType }
}
}
{
"data": {
"verses": [
{
"id": "231",
"audioPath": "http://zemlak.co/rickey",
"competitionId": "217",
"userId": "304",
"title": "Yog-Sothoth"
},
{
"id": "232",
"audioPath": "http://hauck.io/jocelyn",
"competitionId": "218",
"userId": "305",
"title": "Azathoth"
},
{
"id": "233",
"audioPath": "http://lowe.org/sherry.feeney",
"competitionId": "219",
"userId": "306",
"title": "Tsathoggua"
},
{
"id": "234",
"audioPath": "http://hackett-welch.co/gricelda_barton",
"competitionId": "220",
"userId": "307",
"title": "Dagon"
}
]
}
}
mutation {
createVote( input: { verseId: ID, userId: ID }) {
id
userId
verseId
}
}
}
{
"data": {
"createVote": {
"id": "<integer>"
"verseId": "<integer>",
"userId": "<integer>"
}
}
}
- Ruby 2.5.3
- Rails 5.2.4.4