Giter Club home page Giter Club logo

birds-api's Introduction

๐Ÿฆฉ Birds of a Feather API ๐Ÿฆฉ

Table of Contents
  1. Project Overview
  2. Built With
  3. Schema
  4. API Endpoints
  5. Local Setup
  6. Contributors

๐Ÿฆฉ Project Overview

๐Ÿณ๏ธโ€๐ŸŒˆ 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

๐Ÿฆฉ Built With

Version 2.7.4
Version 7.0.3.1





๐Ÿฆฉ Schema

Screen Shot 2022-10-11 at 11 29 02 AM

๐Ÿฆฉ API Endpoints

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.

User

๐Ÿฆš Create User

createUser(input: {
          userName:
          email:
          image:
          description:
          zipCode:
         })

Example response:

{
    "data": {
        "user": {
            "id": "1",
            "userName": "Garnet",
            "email": "[email protected]",
            "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
        }
...

Event

๐Ÿฆš 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
            }
...

User Event (RSVP)

๐Ÿฆš 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"
            }
...

Other Endpoints

๐Ÿฆš 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"
            }
...

๐Ÿฆฉ Local Setup

  1. 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 then rails -v
  2. Fork and clone the repo to your local machine with SSH: git clone [email protected]:Feather-Flock/birds-api.git
  3. Register for external API keys:
  1. Install gems and dependencies: bundle install
  2. Configure API keys by running bundle exec figaro install and then adding keys to application.yml file:
mapquest_api_key: your_key_here
zipcode_api_key: your_key_here
  1. Set up database: rails db:{drop,create,migrate,seed}
  2. Run test suite: bundle exec rspec
  3. Start up your local server: rails s
  4. Visit the endpoint url http://localhost:3000/graphql to consume the API locally.

๐Ÿฆฉ Contributors

Back-End Team

Front-End Team

birds-api's People

Contributors

clayash avatar deannahburke avatar enalihai avatar ross-ian28 avatar tfoxcollis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.