Table of Contents
🏳️🌈 Birds of a Feather 🏳️🌈 is an app that connects LGBTQIA2S+ families to events in their community. Users can search the app for gatherings in their immediate vicinity or specify a radius and RSVP to events that interest them. Users can also create and host their own events and allow other users to RSVP. The back-end of this application utilizes a PostgreSQL relational database and Graphql to accomodate requests from the front-end and communicate via internal API.
🏳️🌈 Visit the live app here
🏳️🌈 Check out the front-end repo here
The following endpoints are exposed, and all endpoints begin with this base URL: https://birds-api.herokuapp.com/
, and all Graphql endpoints respond to POST /graphql
requests only. Query information will need to be sent in the body of the request.
🦚 Create User
createUser(input: {
userName:
email:
image:
description:
zipCode:
})
Example response:
{
"data": {
"user": {
"id": "1",
"userName": "Garnet",
"email": "garnet@universe.com",
"description": "We are a married lesbian couple with kids. We love to play sports and go on adventures!",
"image": "https://user-images.githubusercontent.com/99059063/187045147-667959c8-70f2-4fb3-b089-ca81f23a0310.png",
"zipCode": 80220
}
...
🦚 Create Event
createEvent(input: {
title:
description:
time: # "00:00:00"
date: # "YYYY-MM-DD"
address:
city:
state:
zip:
host: #id of user creating event
})
Example response:
{
"data": {
"createEvent": {
"event": {
"title": "Park hangout",
"description": "Single dad hanging with 7 year old son and friends at park",
"time": "12:00:00",
"date": "2022-09-23",
"address": "2455 Bryant Street",
"city": "Denver",
"state": "CO",
"zip": 80211,
"lat": 39.753163,
"lng": -105.019169,
"host": 1
}
...
🦚 Update Event
You will need to include in your request the event and ID and ONLY the attributes of the event you wish to update. The response will include all of the event information including the updated attributes, as well as the number of rsvps the event currenly has.
updateEvent(input: {
id:
#attributes to be updated
})
Example response
{
"data": {
"createEvent": {
"event": {
"title": "Park hangout",
"description": "Single dad hanging with 7 year old son and friends at park",
"time": "16:30:00",
"date": "2022-09-23",
"address": "2455 Bryant Street",
"city": "Denver",
"state": "CO",
"zip": 80211,
"lat": 39.753163,
"lng": -105.019169,
"host": 1,
"rsvps": 3
}
...
🦚 Delete Event
destroyEvent(input: {
id: 2
})
Example Response
This endpoint will return all of the destroyed event's information, but if you try to run the same request for an event that has already been destroyed you will get an error as that event's id will not be found.
{
"data": {
"destroyEvent": {
"event": {
"title": "Park hangout",
"description": "Single dad hanging with 7 year old son and friends at park",
"time": "12:00:00",
"date": "2022-09-23",
"address": "2455 Bryant Street",
"city": "Denver",
"state": "CO",
"zip": 80211,
"lat": 39.753163,
"lng": -105.019169,
"host": 1,
"rsvps": 3
}
...
🦚 Create User Event
createUserEvent(input: {
userId:
eventId:
})
Example Response
{
"data": {
"createUserEvent": {
"userEvent": {
"userId": 1,
"eventId": 1,
"id": "5",
"createdAt": "2022-09-01T02:26:29Z"
}
...
🦚 Delete User Event
This endpoint takes the user id and the event id, but does NOT take the userEvent id.
deleteUserEvent(input: {
userId: 1,
eventId: 1
})
Example Response
{
"data": {
"deleteUserEvent": {
"userId": 1,
"eventId": 1,
"id": "5",
"createdAt": "2022-09-01T02:26:29Z"
}
...
🦚 User Events
This endpoint returns an array of all of the events created by a user.
user(id: "1") {
userEvents(id: "1") {
id
title
description
zip
lat
lng
date
time
host
}
Example Response
{
"data": {
"user": {
"userEvents": [
{
"id": "1",
"title": "Lunch at Denison Park",
"description": "We are getting together for a meet-and-greet at Denison Park.",
"zip": 80220,
"lat": 39.733,
"lng": -104.904,
"date": "2022-10-09",
"time": "18:00:00",
"host": 1
}
]
...
🦚 User Rsvp'd Events
This endpoint will return an array of all the events a user has rsvp'd to (i.e. the user is not the host of any of these events).
user(id: "1") {
rsvpdEvents(id: "1") {
id
title
description
zip
lat
lng
date
time
host
}
Example Response
{
"data": {
"user": {
"rsvpdEvents": [
{
"id": "1",
"title": "Lunch at Denison Park",
"description": "We are getting together for a meet-and-greet at Denison Park.",
"zip": 80220,
"lat": 39.733,
"lng": -104.904,
"date": "2022-10-09",
"time": "18:00:00",
"host": 2
}
]
...
🦚 User Near Events
This endpoint returns an array of events happening in the same zipcode as the user's location.
user(id: "1") {
nearEvents(id: "1") {
id
title
description
zip
lat
lng
date
time
host
}
Example Response
{
"data": {
"user": {
"nearEvents": [
{
"id": "1",
"title": "Lunch at Denison Park",
"description": "We are getting together for a meet-and-greet at Denison Park.",
"zip": 80220,
"lat": 39.733,
"lng": -104.904,
"date": "2022-10-09",
"time": "18:00:00",
"host": 1
},
{
"id": "2",
"title": "Games at Verbena",
"description": "Games at Verbena Park",
"zip": 80220,
"lat": 39.65,
"lng": -104.893,
"date": "2022-09-15",
"time": "18:00:00",
"host": 2
},
{
"id": "3",
"title": "Birthday Party at Montclair",
"description": "We will be celebrating Steven's 11th birthday!",
"zip": 80220,
"lat": 39.735,
"lng": -104.908,
"date": "2022-10-20",
"time": "18:00:00",
"host": 3
}
]
...
🦚 Create Tag
This endpoint creates a tag available for users to add to their profile to self identify gender, orientation, number of kids, event type, etc.
createTag(input: {
title: "Sports"
})
Example Response
{
"data": {
"createTag": {
"tag": {
"id": "1",
"title": "Sports"
}
...
- Check your versions of both Ruby(2.7.4 or later) and Rails(7.0.3.1 or later) by running the following in your command line:
ruby -v
thenrails -v
- Fork and clone the repo to your local machine with SSH:
git clone git@github.com:Feather-Flock/birds-api.git
- Register for external API keys:
- Install gems and dependencies:
bundle install
- Configure API keys by running
bundle exec figaro install
and then adding keys toapplication.yml
file:
mapquest_api_key: your_key_here
zipcode_api_key: your_key_here
- Set up database:
rails db:{drop,create,migrate,seed}
- Run test suite:
bundle exec rspec
- Start up your local server:
rails s
- Visit the endpoint url
http://localhost:3000/graphql
to consume the API locally.