Coder Social home page Coder Social logo

evilkanoa / webadvisor-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 484 KB

Lightweight and simple GraphQL API for UoG, UW, and WLU.

Home Page: https://webadvisor-api.herokuapp.com/graphql

License: GNU General Public License v3.0

JavaScript 99.98% Procfile 0.02%
graphql graphql-api university student-projects

webadvisor-api's Introduction

webadvisor-api Build status coverage License Vulnerabilities

Developing

Ensure you're running on a supported NodeJS version (10 or newer) and have yarn installed. Then, copy the .env.sample file to .env and configure for your system. Afterwards run yarn to install dependencies.

To run a development server simply run yarn dev and a nodemon based dev server will start. This server is ran in watch mode so any changes you make will cause it to refresh instantly.

To test your code run yarn test. This will launch jest in watch mode so any changes to your code or tests will cause the tests to be re-ran.

Deploying

A live version of this project is currently hosted on Heroku. If you would like to host your own version, feel free.

To run your own server, clone this repo and then runyarn install --production to build and install the required dependencies, after which a production ready server can be started using yarn prod

Contributing

Contributions are always very welcome. This is currently a single student's project and I encourage others to jump on if they want to add features or even fix up minor bugs. To contribute, just open a pull request with your changes. Opened PRs must confirm to prettier's style as well as pass the code coverage thresholds.

Documentation

Since this project provides a simple GraphQL based API, most documentation can be found by browsing GraphiQL's schema explorer. This is available on the live version or any version you deploy. Farther documentation may be added in the future or if a particular item is requested, but the project owner feels that the schema documentation is sufficient for the majority of use cases.

webadvisor-api's People

Contributors

dependabot[bot] avatar evilkanoa avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aleksabelic

webadvisor-api's Issues

Not returning distance education courses for UOG

Courses that are distance education format are not returned when searched for.

{
  search(query:"ECON",term:W20,institution:UOG)
  {
    results
    {
      code
    }
  }
}

For example, there is an ECON 1050 section that is distance education for the W20 semester and it does not show up from this search.

Add course descriptions for WLU academic calendar

Currently the calendar query is only supported for UOG institution. Add support for the following query:

{
    calendar(institution: WLU) {
        courses {
            ....
        }
    }
}

This will include creating new fetchers and parsers for WLU.

API unable to recover from resolve errors

Whenever an error is thrown during the resolve phase (e.g., ECONNRESET or even a Parse Error), the API will continue throwing that error on every subsequent request. It seems like a server restart will entirely resolve the error. Potentially consider rebooting instantly on errors or preventing the effects causing this bug.

Output after DOSing API to cause parse error:

2019-06-20T18:10:49.529953+00:00 heroku[router]: at=info method=POST path="/graphql" host=webadvisor-api.herokuapp.com request_id=2a260e21-964c-4dc9-8882-8d421408c14c fwd="206.174.182.226" dyno=web.1 connect=1ms service=1381ms status=200 bytes=485 protocol=http
2019-06-20T18:10:49.537814+00:00 app[web.1]: { RequestError: Error: Parse Error
2019-06-20T18:10:49.537829+00:00 app[web.1]:     at new RequestError (/app/node_modules/request-promise-core/lib/errors.js:14:15)
2019-06-20T18:10:49.537832+00:00 app[web.1]:     at Request.plumbing.callback (/app/node_modules/request-promise-core/lib/plumbing.js:87:29)
2019-06-20T18:10:49.537834+00:00 app[web.1]:     at Request.RP$callback [as _callback] (/app/node_modules/request-promise-core/lib/plumbing.js:46:31)
2019-06-20T18:10:49.537837+00:00 app[web.1]:     at self.callback (/app/node_modules/request/request.js:185:22)
2019-06-20T18:10:49.537840+00:00 app[web.1]:     at Request.emit (events.js:198:13)
2019-06-20T18:10:49.537842+00:00 app[web.1]:     at Request.onRequestError (/app/node_modules/request/request.js:881:8)
2019-06-20T18:10:49.537844+00:00 app[web.1]:     at ClientRequest.emit (events.js:198:13)
2019-06-20T18:10:49.537847+00:00 app[web.1]:     at TLSSocket.socketOnData (_http_client.js:448:9)
2019-06-20T18:10:49.537849+00:00 app[web.1]:     at TLSSocket.emit (events.js:198:13)
2019-06-20T18:10:49.537851+00:00 app[web.1]:     at addChunk (_stream_readable.js:288:12)
2019-06-20T18:10:49.537854+00:00 app[web.1]:   name: 'RequestError',
2019-06-20T18:10:49.537856+00:00 app[web.1]:   message: 'Error: Parse Error',
2019-06-20T18:10:49.537858+00:00 app[web.1]:   cause:
2019-06-20T18:10:49.537860+00:00 app[web.1]:    { Error: Parse Error
2019-06-20T18:10:49.537863+00:00 app[web.1]:        at TLSSocket.socketOnData (_http_client.js:442:20)
2019-06-20T18:10:49.537864+00:00 app[web.1]:        at TLSSocket.emit (events.js:198:13)
2019-06-20T18:10:49.537867+00:00 app[web.1]:        at addChunk (_stream_readable.js:288:12)
2019-06-20T18:10:49.537869+00:00 app[web.1]:        at readableAddChunk (_stream_readable.js:269:11)
2019-06-20T18:10:49.537871+00:00 app[web.1]:        at TLSSocket.Readable.push (_stream_readable.js:224:10)
2019-06-20T18:10:49.537874+00:00 app[web.1]:        at TLSWrap.onStreamRead (internal/stream_base_commons.js:94:17) bytesParsed: 8245, code: 'HPE_HEADER_OVERFLOW' },
2019-06-20T18:10:49.537876+00:00 app[web.1]:   error:
2019-06-20T18:10:49.537879+00:00 app[web.1]:    { Error: Parse Error
2019-06-20T18:10:49.537880+00:00 app[web.1]:        at TLSSocket.socketOnData (_http_client.js:442:20)
2019-06-20T18:10:49.537882+00:00 app[web.1]:        at TLSSocket.emit (events.js:198:13)
2019-06-20T18:10:49.537885+00:00 app[web.1]:        at addChunk (_stream_readable.js:288:12)
2019-06-20T18:10:49.537887+00:00 app[web.1]:        at readableAddChunk (_stream_readable.js:269:11)
2019-06-20T18:10:49.537889+00:00 app[web.1]:        at TLSSocket.Readable.push (_stream_readable.js:224:10)
2019-06-20T18:10:49.537891+00:00 app[web.1]:        at TLSWrap.onStreamRead (internal/stream_base_commons.js:94:17) bytesParsed: 8245, code: 'HPE_HEADER_OVERFLOW' },
2019-06-20T18:10:49.537894+00:00 app[web.1]:   options:
2019-06-20T18:10:49.537896+00:00 app[web.1]:    { jar: true,
2019-06-20T18:10:49.537898+00:00 app[web.1]:      followAllRedirects: true,
2019-06-20T18:10:49.537900+00:00 app[web.1]:      url:
2019-06-20T18:10:49.537902+00:00 app[web.1]:       'https://webadvisor.uoguelph.ca/WebAdvisor/WebAdvisor?CONSTITUENCY=WBST&type=P&pid=ST-WESTS12A&TOKENIDX=',
2019-06-20T18:10:49.537904+00:00 app[web.1]:      resolveWithFullResponse: true,
2019-06-20T18:10:49.537906+00:00 app[web.1]:      callback: [Function: RP$callback],
2019-06-20T18:10:49.537908+00:00 app[web.1]:      transform: undefined,
2019-06-20T18:10:49.537910+00:00 app[web.1]:      simple: true,
2019-06-20T18:10:49.537912+00:00 app[web.1]:      transform2xxOnly: false },
2019-06-20T18:10:49.537914+00:00 app[web.1]:   response: undefined }

Add a meta institution with specific courses that allow other services to test against before moving onto the real data

Is your feature request related to a problem? Please describe.
As a developer of other products, I want to be able to ensure that my system integrates correctly with webadvisor-api and test against multiple different scenarios that are rare to find in real-world data.

Describe the solution you'd like
Add a META institution with a documented listing of courses for different testing purposes. I will include a few suggested META courses to include for initial development. Ideally, these META courses will evolve to include many different cases and will allow developers to test different aspects of their products by targeting the META institution.

Currently, most scenario based integrations use the Course query, thus the META institution will only include courses under that query to start.

META Courses

  • META*1000: Generic course with all data present.
  • META*1100: Empty course.
  • META*1110: No sections.
  • META*1120: No meetings but 1 section.
  • META*1200: One section with available slots cycling between all and none every X minutes.
  • META*1210: One section that always has available slots.
  • META*1220: One section that never has available slots.
  • And more!

Include ability to register for courses through GraphQL mutations

Is your feature request related to a problem? Please describe.
This API is being built to allow access to as much student portal information as possible but I have to visit my portal to actually perform any actions or make changes. I would like to be able to perform actions through webadvisor-api.

Describe the solution you'd like
Include actions / changes via GraphQL mutations upon already present or future data. This will require authentication to be handled in a secure manner.

Additional context
In the discussion of this issue, I would like to determine if any such methods exist to provide secure and trustworthy methods of authentication. This is of utmost importance of determining whether any actions are viable.

Better IDs for WLU sections and meetings (Include CRNs)

Describe the bug
When using the course or search queries to get any course at WLU, the section IDs are not translatable to WLU registration systems.

To Reproduce
The following query will fetch one course from WLU as well as section IDs and meeting names.

query {
  course(code: "MA100", institution: WLU, term: W20) {
    sections {
      id
      meetings {
        name
      }
    }
  }
}

(See here)

Expected behavior
The section ID should be presented by a string like 1111 (2222) where the number outside of the brackets is the lecture CRN and the number(s) inside the brackets are lab and seminar CRNs. Additionally, each meeting should have an ID associated it that matches that meetings CRN on WLU registration services.

Add support for the "EXAM" meeting type

Describe the bug

Some courses (e.g. CIS*1500 / W20 / UOG) have meeting instances for their exam times. This should be supported by webadvisor-api.

To Reproduce

Steps to reproduce the behavior:

  1. Go to webadvisor-api
  2. Enter the following query:
query {
  course(code: "CIS*1500", institution: UOG, term: W20) {
    sections {
      meetings {
        type
      }
    }
  }
}
  1. Note that the response includes many errors like the following:
    {
      "message": "Expected a value of type \"Meeting_Type\" but received: \"EXAM\"",
      "locations": [
        {
          "line": 5,
          "column": 9
        }
      ],
      "path": [
        "course",
        "sections",
        0,
        "meetings",
        3,
        "type"
      ]
    }

Expected behavior
EXAM type meetings should be interpreted as any other meeting without throwing errors.

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.