Giter VIP home page Giter VIP logo

wwu-wash-and-dry-backend's Introduction

WWU-Wash-And-Dry-Backend

A Python Flask Application based on simple REST principles, the WWU Wash and Dry API endpoints return JSON metadata about WWU washing and drying machines.

This Web API also provides access to user related data, like user name, email, and floor and dorm preferences.

The API provides a set of endpoints, each with its own unique path. To access private data through the Web API, such as user information and washing/drying machine data.

Endpoints

Refer to the endpoints documentation in the docs folder for more information on specific endpoint parameters and returns.

Setup and Installation

In order to setup the WWU Wash and Dry API you must have Python 3.11.0 installed as well as GIT.

Clone in the WWU Wash and Dry Web API into your repository using:

git clone https://github.com/garrettkmoody/WWU-Wash-And-Dry-Backend.git

In your local repository, open a terminal and install the needed requirements using:

pip install -r requirements.txt

Hosting the API Locally

To run the API from your local machine, open the repository in a terminal and use the command:

python init.py

Testing the Web API

To test the API, open the repository in a terminal and use the command:

pytest

To ensure that any changes in a file meets the required style guides, use the command:

pylint "/path/to/file"

Developer Notes


  • SSO through Azure AD will expire 4/20/2023 and need to be renewed through by the WWU IT Department
  • There is an .env file which contains SSO and App configuration that should NOT be pushed to version control
  • The SSO Authorization URL (TESTING/DEVELOPMENT) - https://login.microsoftonline.com/d958f048-e431-4277-9c8d-ebfb75e7aa64/oauth2/v2.0/authorize?client_id=b011ad62-bda8-449f-99d3-519a3d973218&response_type=code&response_mode=query&scope=https://graph.microsoft.com/User.Read&redirect_uri=http://localhost:5000/login/callback
  • The SSO Authorization URL (PRODUCTION) - https://login.microsoftonline.com/d958f048-e431-4277-9c8d-ebfb75e7aa64/oauth2/v2.0/authorize?client_id=b011ad62-bda8-449f-99d3-519a3d973218&response_type=code&response_mode=query&scope=https://graph.microsoft.com/User.Read&redirect_uri=https://wwuwashanddryapi.cs.wallawalla.edu/login/callback

wwu-wash-and-dry-backend's People

Contributors

taylorsmith28 avatar haydentinker avatar garrettkmoody avatar wingnuts5198 avatar fairka avatar

Watchers

 avatar  avatar

wwu-wash-and-dry-backend's Issues

Unimplemented tests and TODO code

There are currently two unimplemented tests in test_api.py that should be implemented on line 525 as well as line 605.

Remove line 17 from routes/machine.py

Replace line 189 with the implementation from line 119

send_email

send_email is not properly passing a successful send_email test. This should be fixed to have the notification feature working.

More Tests

Many endpoint routes are lacking sufficient testing (both successful and failure cases as well as edge cases). These should be implemented.

Get requests returns

I noticed that what we are returning for get requests aren't consistent across the endpoints. To make it easier for the front end we should try to be consistent with what we are returning. Currently we are returning either a list of objects or a dict. I think that it would be best to return dicts because we can control the information being sent. In the case where we want to send information on multiple objects like machines, we could return a list of dicts.

Db init function

Since we added the token function decorator to all the endpoints, populate_db.py will not work for the current version. We need to figure out a way to allow the file to make post requests.

Add Functional Tests

Professor Carman said that we should have test for a full run of our api. We should have multiple but an example would be getting the machines then updating the machine information.

Add Abort Messages

Where abort is used, include an error message that denotes what that error is.

Example:
abort( 400, "[error message]")

Add Favorites for User

The frontend has requested a feature where the users can have a favorite dorm and floor and will remember it for their next sessions.

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.