Skip to content

HelpListCrew/HelpListBE

Repository files navigation

Welcome to HelpList

Helping Humans Help Humans

DV Banner

HelpList Mission:

Our mission at Helplist is to harness the power of crowdsourcing to alleviate the burden for survivors as they rebuild their lives. We aim to make providing resources easy and accessible to anyone utilizing our partner orginazations, empowering everyday people to make a meaningful impact.

About:

  • HelpList allows victims of domestic violence in collaboration with an organization to create personalized wishlist's of needed items to post anonymously.
  • Users can select a facility, select a wishlist, and purchase items from wishlists to be sent directly to the organization and survivors.


Built with:

Ruby 3.1.1

PostgreSQL

CircleCI

Heroku

How to run the test suite

  1. Navigate to desired directory
  2. Run [email protected]:HelpListCrew/HelpListBE.git
  3. Run cd HelpListBE
  4. Run bundle
  5. Run rails db:{create,migrate}
  6. Run bundle exec rspec

Database Schema

DB Schema

  • The database utilizes a self-referential table for Users to be identified as a either Recipient or Donor.
  • Recipients are associated with an organization by way of OrganizationUsers table.
  • Recipients create WishlistItems records when adding Kroger API items on the frontend
  • Donors create DonorItems records when purchasing Recipients' WishlistItems on the frontend

Endpoints




Users

POST: Authenticate User
Request:
POST /api/v1/users

Params:

Name Requirement Type Description
email Required string User email
uid Optional string Google Oauth2.0 identification
password Optional string User password

Note: Either uid or password are REQUIRED


Response:

Result Status
Success 201
Failure 401
{
  "data": {
    "id": "1",
    "type": "user",
    "attributes": {
      "email": "[email protected]",
      "user_type": "donor",
      "username": "example_username"
    }
  }
}
GET: All Users
Request:
GET /api/v1/users

Response:

Result Status
Success 201
Failure 401
{
  "data": [
    {
      "id": "1",
      "type": "user",
      "attributes": {
        "email": "[email protected]",
        "user_type": "donor",
        "username": "example_username"
      }
    },

    {
      "id": "2",
      "type": "user",
      "attributes": {
        "email": "[email protected]",
        "user_type": "recipient",
        "username": "example_username"
      }
    },
  ]
}
GET: Single User
Request:
GET /api/v1/users/:id

Params:

Name Requirement Type Description
id Required string User id

Response:

Result Status
Success 201
Failure 404
{
 "data": {
   "id": "1",
   "type": "user",
   "attributes": {
     "email": "[email protected]",
     "user_type": "donor",
     "username": "example_username"
   }
 }
}
POST: Create User
Request:
POST /api/v1/users

Params:

Name Requirement Type Description
email Required string User email
password Required string User password
username Optional string Username

Response:

Result Status
Success 201
Failure 400
{
 "data": {
   "id": "1",
   "type": "user",
   "attributes": {
     "email": "[email protected]",
     "user_type": "donor",
     "username": "example_username"
   }
 }
}
DELETE: Destroy User
Request:
DELETE /api/v1/users

Params:

Name Requirement Type Description
id Required string User id

Response:

Result Status
Success 204
Failure 404
PATCH: Update User
Request:
PATCH /api/v1/users/:id

Params:

Name Requirement Type Description
id Required string User id
email Optional string User email
user_type Optional string User type
password Optional string User password

Response:

Result Status
Success 201
Failure 400
{
  "data": {
    "id": "1",
    "type": "user",
    "attributes": {
      "email": "[email protected]",
      "user_type": "recipient",
      "username": "example_username"
    }
  }
}



Wishlist Items

GET: All Wishlist Items
Request:
GET /api/v1/wishlist_items

Params:

Name Requirement Type Description
user_id Optional string User id
modifier Optional string unpurchased or donated

Note: Must include user_id when using modifier

Response:

Result Status
Success 201
Failure 401
{
  "data": [
    {
      "id": "1",
      "type": "wishlist_item",
      "attributes": {
        "api_item_id": "0004171623215",
        "purchased": false,
        "received": false,
        "size": "12 ct / 1 oz",
        "name": "Frigo® Cheese Heads® Original Mozzarella String Cheese",
        "price": 5.99,
        "image_path": "https://www.kroger.com/product/images/medium/front/0004171623215"
      }
    },

    {
      "id": "2",
      "type": "wishlist_item",
      "attributes": {
        "api_item_id": "0000019400413",
        "purchased": true,
        "received": false,
        "size": "1 ct",
        "name": "Liberty Mountain 371118 Compact Tooth Brush",
        "price": 1.99,
        "image_path": "https://www.kroger.com/product/images/medium/front/0000019400413"
      }
    },
  ]
}
GET: Single Wishlist Item
Request:
GET /api/v1/wishlist_items/:id

Params:

Name Requirement Type Description
id Required string Wishlist Item id

Response:

Result Status
Success 201
Failure 404
{
  "data": 
  {
    "id": "1",
    "type": "wishlist_item",
    "attributes": {
      "api_item_id": "0004171623215",
      "purchased": false,
      "received": false,
      "size": "12 ct / 1 oz",
      "name": "Frigo® Cheese Heads® Original Mozzarella String Cheese",
      "price": 5.99,
      "image_path": "https://www.kroger.com/product/images/medium/front/0004171623215"
    }
  },
}
POST: Create Wishlist Item
Request:
POST /api/v1/wishlist_items

Params:

Name Requirement Type Description
api_item_id Required string Wishlist Item Kroger API Id
size Required string Wishlist Item Size
name Required string Wishlist Item Name
price Required string Wishlist Item Price
image_path Required string Wishlist Item Image URL
purchased Optional string Wishlist Item has been purchased
received Optional string Wishlist Item has been received

Response:

Result Status
Success 201
Failure 400
{
  "data": 
  {
    "id": "1",
    "type": "wishlist_item",
    "attributes": {
      "api_item_id": "0004171623215",
      "purchased": false,
      "received": false,
      "size": "12 ct / 1 oz",
      "name": "Frigo® Cheese Heads® Original Mozzarella String Cheese",
      "price": 5.99,
      "image_path": "https://www.kroger.com/product/images/medium/front/0004171623215"
    }
  },
}
PATCH: Update Wishlist Item
Request:
PATCH /api/v1/wishlist_items/:id

Params:

Name Requirement Type Description
api_item_id Optional string Wishlist Item Kroger API Id
size Optional string Wishlist Item Size
name Optional string Wishlist Item Name
price Optional string Wishlist Item Price
image_path Optional string Wishlist Item Image URL
purchased Optional string Wishlist Item has been purchased
received Optional string Wishlist Item has been received

Response:

Result Status
Success 201
Failure 400
{
  "data": 
  {
    "id": "1",
    "type": "wishlist_item",
    "attributes": {
      "api_item_id": "0004171623215",
      "purchased": false,
      "received": false,
      "size": "12 ct / 1 oz",
      "name": "Frigo® Cheese Heads® Original Mozzarella String Cheese",
      "price": 5.99,
      "image_path": "https://www.kroger.com/product/images/medium/front/0004171623215"
    }
  },
}
DELETE: Destroy Wishlist Item
Request:
DELETE /api/v1/wishlist_items/:id

Params:

Name Requirement Type Description
id Required string Wishlist Item id

Response:

Result Status
Success 204
Failure 404



Organizations

GET: All Organizations
Request:
GET /api/v1/organizations

Response:

Result Status
Success 201
Failure 401
{
  "data": [
    {
      "id": "1",
      "type": "organization",
      "attributes": {
        "name": "Welch LLC",
        "street_address": "1101 W. 7th Ave.",
        "city": "Denver",
        "state": "CO",
        "zip_code": "80204",
        "email": "[email protected]",
        "phone_number": "1-855-077-9529 x349",
        "website": "http://example.com/jake"
      }
    },

    {
      "id": "2",
      "type": "organization",
      "attributes": {
         "name": "Robel, Dibbert and Windler",
        "street_address": "3805 Marshall St.",
        "city": "Wheat Ridge",
        "state": "CO",
        "zip_code": "80033",
        "email": "[email protected]",
        "phone_number": "(712) 040-6128 x4872",
        "website": "http://example.com/nelson.gerhold"
      }
    },
  ]
}
GET: Single Organization
Request:
GET /api/v1/organizations/:id

Params:

Name Requirement Type Description
id Required string Organization id

Response:

Result Status
Success 201
Failure 404
{
  "data": 
  {
    "id": "1",
    "type": "organization",
    "attributes": {
      "name": "Welch LLC",
      "street_address": "1101 W. 7th Ave.",
      "city": "Denver",
      "state": "CO",
      "zip_code": "80204",
      "email": "[email protected]",
      "phone_number": "1-855-077-9529 x349",
      "website": "http://example.com/jake"
    }
  },
}
POST: Create Organization
Request:
POST /api/v1/organizations

Params:

Name Requirement Type Description
name Required string Organization name
street_address Required string Organization street address
city Required string Organization city
state Required string Organization state
zip_code Required string Organization zip code
email Required string Organization email address
phone_number Required string Organization phone number
website Required string Organization website

Response:

Result Status
Success 201
Failure 400
{
  "data": 
  {
    "id": "1",
    "type": "organization",
    "attributes": {
      "name": "Welch LLC",
      "street_address": "1101 W. 7th Ave.",
      "city": "Denver",
      "state": "CO",
      "zip_code": "80204",
      "email": "[email protected]",
      "phone_number": "1-855-077-9529 x349",
      "website": "http://example.com/jake"
    }
  },
}
PATCH: Update Organization
Request:
PATCH /api/v1/organizations/:id

Params:

Name Requirement Type Description
name Optional string Organization name
street_address Optional string Organization street address
city Optional string Organization city
state Optional string Organization state
zip_code Optional string Organization zip code
email Optional string Organization email address
phone_number Optional string Organization phone number
website Optional string Organization website

Response:

Result Status
Success 201
Failure 400
{
  "data": 
  {
    "id": "1",
    "type": "organization",
    "attributes": {
      "name": "Welch LLC",
      "street_address": "1101 W. 7th Ave.",
      "city": "Denver",
      "state": "CO",
      "zip_code": "80204",
      "email": "[email protected]",
      "phone_number": "1-855-077-9529 x349",
      "website": "http://example.com/jake"
    }
  },
}
DELETE: Destroy Organization
Request:
DELETE /api/v1/organizations/:id

Params:

Name Requirement Type Description
id Required string Organization id

Response:

Result Status
Success 204
Failure 404



Organization Users

GET: All Users for Organization
Request:
GET /api/v1/organization/:id/users

Response:

Result Status
Success 201
Failure 401

Params:

Name Requirement Type Description
id Required string Organization id
{
  "data": [
    {
      "id": "1",
      "type": "user",
      "attributes": {
        "email": "[email protected]",
        "user_type": "donor",
        "username": "example_username"
      }
    },

    {
      "id": "2",
      "type": "user",
      "attributes": {
        "email": "[email protected]",
        "user_type": "recipient",
        "username": "example_username"
      }
    },
  ]
}



Organizations Search

GET: Search Organizations
Request:
GET /api/v1/organizations

Params:

Name Requirement Type Description
address Required string User location address
miles Required string Radius in miles from user location

Response:

Result Status
Success 201
Failure 400
{
  "data": [
    {
      "id": "1",
      "type": "organization",
      "attributes": {
        "name": "Welch LLC",
        "street_address": "1101 W. 7th Ave.",
        "city": "Denver",
        "state": "CO",
        "zip_code": "80204",
        "email": "[email protected]",
        "phone_number": "1-855-077-9529 x349",
        "website": "http://example.com/jake"
      }
    },

    {
      "id": "2",
      "type": "organization",
      "attributes": {
         "name": "Robel, Dibbert and Windler",
        "street_address": "3805 Marshall St.",
        "city": "Wheat Ridge",
        "state": "CO",
        "zip_code": "80033",
        "email": "[email protected]",
        "phone_number": "(712) 040-6128 x4872",
        "website": "http://example.com/nelson.gerhold"
      }
    },
  ]
}



Users Search

GET: Search User
Request:
GET /api/v1/users

Params:

Name Requirement Type Description
username Required string Username

Response:

Result Status
Success 201
Failure 404
{
 "data": {
   "id": "1",
   "type": "user",
   "attributes": {
     "email": "[email protected]",
     "user_type": "donor"
   }
 }
}



Contributors

| Adam Baily Github | Andra Helton GitHub| Axel De La Guardia GitHub | Elle Majors GitHub | Jade Stewart GitHub |

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages