kenzjoy / DirtR_2208_BE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DirtR

DirtR
Table of Contents

Project Overview

Dirtr is an application which simulates users, allows you to take control of a user account, and utilize an app to find/favorite offroading trails in Colorado.

DB Schema

Screen Shot 2023-02-06 at 11 36 27 AM

Built With

  • Rails 5.2.8
  • Ruby 2.7.4
  • Docker 20.10.22
  • CircleCI 2.1
  • Heroku 7.68.0

Setup

  1. Clone the repository
  2. cd into the root directory
  3. Install gem packages: bundle install
  4. Setup the database: rails db:{drop,create,migrate,seed}
  5. Perform rake task to seed data: rails csv_load:all
  6. Launch server: rails s or docker-compose up --build

API Endpoints

Get Users

Request:

GET /api/v1/user?id=3

JSON Response Example:

{
    "data": {
        "id": "3",
        "type": "user",
        "attributes": {
            "name": "Shawn Lee",
            "trails": []
        }
    }
}
Post User Trails

Request:

POST /api/v1/user-trails

JSON Payload Example:

{
    "trail_id": 4,
    "user_id": 3,
    "name": "Tomichi Pass",
    "latitude": "38.61367",
    "longitude": "-106.39009",
    "difficulty": "blue",
    "distance": "2",
    "description": "Tomichi Pass is a 2 mile less popular blue doubletrack trail located near Buena Vista Colorado. This atv/orv/ohv primary trail can be used both directions and has a hard overall physical rating with a 838 ft blue climb. On average it takes 51 minutes to complete this trail.",
    "created_at": "2023-02-02T16:37:32.000Z",
    "updated_at": "2023-02-02T16:37:32.000Z",
    "start_elevation": "11,128 ft",
    "avg_duration": "0:51:12",
    "map_image": "https://ep1.pinkbike.org/trailstaticmap/249000/249749_0_500x200.png",
    "thumbnail_image": "https://www.4x4explore.com/rds/t_rds/tomichi_ps_c.jpg",
    "county_id": 2
}

JSON Response Example:

{
    "success": "Trail Added Successfully"
}

{
    "data": {
        "id": "3",
        "type": "user",
        "attributes": {
            "name": "Shawn Lee",
            "trails": [
                {
                    "id": 4,
                    "name": "Tomichi Pass",
                    "latitude": "38.61367",
                    "longitude": "-106.39009",
                    "difficulty": "blue",
                    "distance": "2",
                    "description": "Tomichi Pass is a 2 mile less popular blue doubletrack trail located near Buena Vista Colorado. This atv/orv/ohv primary trail can be used both directions and has a hard overall physical rating with a 838 ft blue climb. On average it takes 51 minutes to complete this trail.",
                    "created_at": "2023-02-02T16:37:32.000Z",
                    "updated_at": "2023-02-02T16:37:32.000Z",
                    "start_elevation": "11,128 ft",
                    "avg_duration": "0:51:12",
                    "map_image": "https://ep1.pinkbike.org/trailstaticmap/249000/249749_0_500x200.png",
                    "thumbnail_image": "https://www.4x4explore.com/rds/t_rds/tomichi_ps_c.jpg",
                    "county_id": 2
                }
            ]
        }
    }
}
Get All Trails

Request:

GET /api/v1/trails

JSON Response Example:

{
    "data": [
        {
            "id": "1",
            "type": "trails",
            "attributes": {
                "id": 1,
                "name": "Cowboy Lake",
                "latitude": "38.22771",
                "longitude": "-107.54796",
                "difficulty": "green",
                "distance": "1.5",
                "description": "Cowboy Lake is a 1 mile less popular green doubletrack trail located near Ridgway Colorado. This atv/orv/ohv primary trail can be used both directions.",
                "created_at": "2023-02-02T16:34:05.000Z",
                "updated_at": "2023-02-02T16:34:05.000Z",
                "start_elevation": "9,184 ft",
                "avg_duration": null,
                "map_image": "https://ep1.pinkbike.org/trailstaticmap/421000/421278_0_500x200.png",
                "thumbnail_image": "https://4.bp.blogspot.com/-Duyiyyb7WWU/U_JKdTEN5yI/AAAAAAAAZ64/dipM0wxc3L8/s1600/Cowboy%2BLake%2B132.JPG",
                "county_id": 1
            }
        },
        {
            "id": "2",
            "type": "trails",
            "attributes": {
                "id": 2,
                "name": "Lou Creek",
                "latitude": "38.22771",
                "longitude": "-107.54796",
                "difficulty": "blue",
                "distance": "2.7",
                "description": "Lou Creek is a 3 mile less popular blue doubletrack trail located near Ridgway Colorado. This atv/orv/ohv primary trail can be used both directions. On average it takes 57 minutes to complete this trail.",
                "created_at": "2023-02-02T16:35:14.000Z",
                "updated_at": "2023-02-02T16:35:14.000Z",
                "start_elevation": "9,214 ft",
                "avg_duration": "0:57:30",
                "map_image": "https://ep1.pinkbike.org/trailstaticmap/421000/421237_0_500x200.png",
                "thumbnail_image": "https://1.bp.blogspot.com/-20tDnLc9Fwg/U_N2uPV9w6I/AAAAAAAAZ9s/nW4wVtOB_Tc/s1600/West%2BFork%2B004.JPG",
                "county_id": 1
            }
        },
        {
            "id": "3",
            "type": "trails",
            "attributes": {
                "id": 3,
                "name": "Stealey Mountain North",
                "latitude": "38.14721",
                "longitude": "-107.59245",
                "difficulty": "blue",
                "distance": "3.6",
                "description": "Stealey Mountain North is a 2 mile less popular blue singletrack trail located near Ridgway Colorado. This hike primary trail can be used both directions",
                "created_at": "2023-02-02T16:36:23.000Z",
                "updated_at": "2023-02-02T16:36:23.000Z",
                "start_elevation": "9,742 ft",
                "avg_duration": null,
                "map_image": "https://ep1.pinkbike.org/trailstaticmap/421000/421103_0_500x200.png",
                "thumbnail_image": "https://i.ytimg.com/vi/IgvX5v4YzpE/maxresdefault.jpg",
                "county_id": 1
            }
        }
    ]
}
Get Trail

Request:

GET /api/v1/trail?id=2

JSON Response Example:

{
    "data": {
        "id": "2",
        "type": "trail",
        "attributes": {
            "id": 2,
            "name": "Lou Creek",
            "latitude": "38.22771",
            "longitude": "-107.54796",
            "difficulty": "blue",
            "distance": "2.7",
            "description": "Lou Creek is a 3 mile less popular blue doubletrack trail located near Ridgway Colorado. This atv/orv/ohv primary trail can be used both directions. On average it takes 57 minutes to complete this trail.",
            "created_at": "2023-02-02T16:35:14.000Z",
            "updated_at": "2023-02-02T16:35:14.000Z",
            "start_elevation": "9,214 ft",
            "avg_duration": "0:57:30",
            "map_image": "https://ep1.pinkbike.org/trailstaticmap/421000/421237_0_500x200.png",
            "thumbnail_image": "https://1.bp.blogspot.com/-20tDnLc9Fwg/U_N2uPV9w6I/AAAAAAAAZ9s/nW4wVtOB_Tc/s1600/West%2BFork%2B004.JPG",
            "county_id": 1
        }
    }
}
Get All Counties

Request:

GET /api/v1/counties

JSON Response Example:

{
    "data": [
        {
            "id": "1",
            "type": "counties",
            "attributes": {
                "name": "Ouray County"
            }
        },
        {
            "id": "2",
            "type": "counties",
            "attributes": {
                "name": "Chaffee County"
            }
        },
        {
            "id": "3",
            "type": "counties",
            "attributes": {
                "name": "Teller County"
            }
        }
    ]
}
Get County

Request:

GET /api/v1/county?name="#{county}"

JSON Response Example:

{
    "data": {
        "id": "27",
        "type": "county",
        "attributes": {
            "name": "Boulder County",
            "trails": [
                {
                    "id": 163,
                    "name": "Jenny Creek Trail ",
                    "latitude": "39.929561",
                    "longitude": "-105.624647",
                    "difficulty": "black",
                    "distance": "2.2",
                    "description": "Jenny Creek Trail is a lesser-used trail that goes from Yankee Doodle Lake Eldora Ski area. In it motorized 2 track and in summer is an out-and-back from Rollins pass road or Jenny Creek Road with no summer access through Eldora.",
                    "created_at": "2023-02-02T19:40:23.000Z",
                    "updated_at": "2023-02-02T19:40:23.000Z",
                    "start_elevation": "10,732 ft",
                    "avg_duration": "0:25:11",
                    "map_image": "https://ep1.pinkbike.org/trailstaticmap/563000/563447_3_500x200.png",
                    "thumbnail_image": "https://adventr.co/wp-content/uploads/2015/01/DSC03243.jpg",
                    "county_id": 27
                },
                {
                    "id": 164,
                    "name": "Jenny Creek Road ",
                    "latitude": "39.928003",
                    "longitude": "-105.592149",
                    "difficulty": "black",
                    "distance": "2.6",
                    "description": "Motorized road connecting Eldora to Moffat Road.",
                    "created_at": "2023-02-02T19:41:32.000Z",
                    "updated_at": "2023-02-02T19:41:32.000Z",
                    "start_elevation": "9,353 ft",
                    "avg_duration": "0:18:13",
                    "map_image": "https://ep1.pinkbike.org/trailstaticmap/563000/563444_2_500x200.png",
                    "thumbnail_image": "https://adventr.co/wp-content/uploads/2015/01/DSC03243.jpg",
                    "county_id": 27
                }
            ]
        }
    }
}
Delete User Trail

Request:

DELETE /api/v1/user-trails

JSON Payload Example:

{
    "user_id": 3,
    "trail_id": 4
}

JSON Response Example:

{
    "success": "Trail Removed From Favorites"
}

Contact

Alex Mora Eli Fuchsman Kenz Leng Shawn Lee
GitHub
LinkedIn
GitHub
LinkedIn
GitHub
LinkedIn
GitHub
LinkedIn

(back to top)

Acknowledgments

Turing School of Software Design: https://turing.edu/
Trailforks: https://www.trailforks.com/

(back to top)

About


Languages

Language:Ruby 98.7%Language:Dockerfile 0.9%Language:HTML 0.4%