Coder Social home page Coder Social logo

openbeta / openbeta-graphql Goto Github PK

View Code? Open in Web Editor NEW
36.0 36.0 30.0 1.79 MB

The open source rock climbing API

Home Page: https://openbeta.io

License: GNU Affero General Public License v3.0

Shell 1.02% Dockerfile 0.06% TypeScript 98.48% JavaScript 0.44%
climbing climbing-api climbing-data graphql rock-climbing

openbeta-graphql's People

Contributors

admanny avatar allcontributors[bot] avatar andrew-jp avatar billykeyss avatar bradleydean avatar cocoisbuggy avatar enapupe avatar l4u532 avatar melissapthai avatar musoke avatar silthus avatar siman4457 avatar vnugent avatar zichongkao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openbeta-graphql's Issues

Support search by bbox

use case

I want to pan, zoom the map and be able to ask the api to return crags/climbs within the map bounding box.

Update Alglio task

Climbs are now children of Area.

  • Call Mongo $unwind Area.children to get all climbs and insert to algolia
  • Use Area.id instead of metadta.uuid

Create a near [lat,lng] query

Story: Crag Finder OpenBeta/open-tacos#178

As a user I want to find areas and climbs near a latitude, longitude.

Input:

  • latitude, longitude
  • Optional filters:
    • radius (default to x km)
    • discipline: sport, trad, bouldering (default to all)

Todo:

  • Update metadata.lat and metada.lng to Geojson type https://mongoosejs.com/docs/geojson.html
  • GraphQL type: is there any benefits of switching raw lat,lng to geojson type?
  • Create new query or new a new input filter

Climb should be nullable

Use case

As a user I want to get all climbs in Colorado.

The following query failed:

query AllClimbsInColorado {
  areas(filter: {path_tokens: {tokens: "Colorado"}, leaf_status: {isLeaf: true}}) {
    areaName
    climbs {
      name
      yds
      id
    }
  }
}

Error:

{
  "errors": [
    {
      "message": "Cannot return null for non-nullable field Climb.name.",
      "locations": [
        {
          "line": 5,
          "column": 7
        }
      ],
      "path": [
        "areas",
        0,
        "climbs",
        0,
        "name"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    },

Create Standardized Grade System

Right now there is a lot of grades with different formats
ex. V2/3, V2-3, V2+

  • We should find one way to represent these grades, and update them in the data base. Then only allow grades that fit the new format.
  • We should also think about how we can allow switching between grade systems.

Include area uuid in Typesense result

Use case:

I want to search for an area by name, for example, Black Velvet Canyon and be able to click on the result to jump to the page.

Todo: Include area.uuid in Typesense index so that search widget can generate URL to the area.

Support French and other grading systems

The current schema is hard-coded to YDS.

  • Update the Climb schema to support other systems (we can prioritize the French system for now)
  • Update GQL queries
  • Migrate frontend to new fields (PR TBD)
  • Update USA import script #140
  • Update statistics script #141
  • Delete old yds fields from schema and GQL

Create global edit history query

Create a GQL query to show recent edit history

  • Add prevHistoryID field to link to previous changeset
  • Store stream event.updateFields (describing updated fields) in db
  • Expose updatedFields in GQL query

Improve README

The readme is lacking set up instructions for seeding the database with test data.

Areas collection: retire MongoID and use UUID for consistency

  • 1. Use MUUID instead of Mongo ObjectID for _id (see ClimbSchema.tsx for example)
  • 2. Refactor code to use Area._id instead of Area.metadata.area_id
  • 3. Retire metadata.area_id in both mongo schema and GQL typedef
  • 4. Make sure frontend code uses either Area.uuid or Area.id`

This task impacts multiple layers (DB schemas, DB queries, GQL/frontend). I'd highly recommend tackling this in multiple PRs and gradually deprecate out-dated fields.

Add Filter for climbs

We'll want to be able to search climbs by

  • name
  • grade
  • discipline

Leave room in the future to filter by

  • stars
  • description - technical, overhung

Whitelist/relax api rate limiting

The graphql api has rate limiting enabled to mitigate DDoS.

yarn build fails because rate limiting is too restricted

nginx-ingress log:

2022/01/03 18:26:19 [error] 4682#4682: *58324847 limiting requests, excess: 150.950 by zone "openbeta_graphql-api_0f0e359b-87be-4802-a75e-be0d7456f75b_rpm", client: 70.123.62.81, server: api.openbeta.io, request: "POST / HTTP/1.1", host: "api.openbeta.io"

Precalculate ancestor uuids to help frontend build breadcrumb

Assuming area page has the following slug: areas/<uuid>/optional-area-name

The breadcrumb component will need all ancestor uuids + display names

      {
        "area_name": "Smith Rock",
        "children": [
          {
            "area_name": "Aggro Gully",
            "metadata": {
              "lat": 44.36724,
              "lng": -121.14238
            }
          },
          _path: {
              [ <uuid of great grandparent>, "Oregon"],
              [<grandparent uuid>, "Central Oregon"],
              [<parent uuid>,"Smith Rock"],
           }
       ...
        ]
      }

Screen Shot 2021-12-30 at 11 53 16 AM

Return area and route content

Sample climb md file

At the moment we only process data in the frontmatter section (data loader code), ignoring content below --- marker.

TO DO:

  • Return the markdown body.
  • Optionally, do additional parsing and return the data in 3 pieces: 'Description', 'Protection', 'Location'

Track Area edit history

  • Create a change log collection to record app-level changes
  • Create newArea/Country mutation
  • #158
  • Add description field to New Area mutation #123
  • Show changes by area id
  • Update children pathTokens and ancestors???
  • Test rollback

Create an "update parent" mutation

Use case

I want to move an area to be under a different parent.

To do:

  • Update parent id
  • Update path tokens (look at area renaming code for ways to recursively update children's paths)
  • Update ancestors
  • Unit test

Import more data to DB

East coast

  • ny
  • wv
  • ky

Mountain

  • Utah
  • Colorado
  • Montana
  • Idaho
  • Arizona
  • New Mexico
  • Nevada
  • Wyoming

West coast

  • Oregon
  • Washington
  • California
  • ak

Add getPhotos query

Add a new query to help getting photo URLs by bounding box or area id/climb id.

Switch to managed MongoDB

Make db connection str more flexible to support "mini" database setup (using docker) and managed cluster in production

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.