Giter Club home page Giter Club logo

ey-mann-wo-ist-mein-autoverleih's People

Contributors

ddrexler avatar markuswet avatar mgcloud avatar web-weber avatar

Watchers

 avatar  avatar  avatar

ey-mann-wo-ist-mein-autoverleih's Issues

WS1 - Travis CI Tests

Tests für alle Webservices schreiben (auch für Frontend, @web-weber?) und in Travis CI durchlaufen lassen bei Build.

  • Korrekte Eingabe
  • Falsche Eingaben
    • Out Of Range, zB id=999999999999999999999999999999999999
    • Negative Daten, zB id=-1
    • Falscher Typ, zB id=nope
    • Ungültige Datum/ungültige Datumsbereiche
  • Keine Eingabe
  • Leere Eingabe, zB id=<nur Leerzeichen>

WS1

@MarkusWET
Flask Testing Guide
Flaskr @ GitHub

WS1 - API Tests

  • /api/car/<car_id>/rent
    • car_id
      • Korrekte Eingabe
      • Falsche Eingaben
        • Out Of Range, zB id=999999999999999999999999999999999999
        • Negative Daten, zB id=-1
        • Falscher Typ, zB id=nope
      • Keine Eingabe
      • Leere Eingabe, zB id=<nur Leerzeichen>
    • start
      • Korrekte Eingabe
      • Falsche Eingaben
        • Falsches Datumsformat
        • Ungültiges Datum, zB 34.13.201119
        • Falscher Typ, zB start=morgen
      • Keine Eingabe
      • Leere Eingabe, zB start=<nur Leerzeichen>
      • Start- nach Enddatum
    • end
      • Korrekte Eingabe
      • Falsche Eingaben
        • Falsches Datumsformat
        • Ungültiges Datum, zB 34.13.201119
        • Falscher Typ, zB end=gestern
      • Keine Eingabe
      • Leere Eingabe, zB end=<nur Leerzeichen>
      • End- vor Startdatum
  • /api/car/<car_id>/return
    • car_id
      • Korrekte Eingabe
      • Falsche Eingaben
        • Out Of Range, zB id=999999999999999999999999999999999999
        • Negative Daten, zB id=-1
        • Falscher Typ, zB id=nope
      • Logisch falsche Eingabe (Auto zurückgeben, das nicht gemietet war)
      • Keine Eingabe
      • Leere Eingabe, zB id=<nur Leerzeichen>
  • /api/car/<car_id>/gps
    • car_id
      • Korrekte Eingabe
      • Falsche Eingaben
        • Out Of Range, zB id=999999999999999999999999999999999999
        • Negative Daten, zB id=-1
        • Falscher Typ, zB id=nope
      • Logisch falsche Eingabe (Auto zurückgeben, das nicht gemietet war)
      • Keine Eingabe
      • Leere Eingabe, zB id=<nur Leerzeichen>
    • latitude und longitude
      • Korrekte Eingabe
      • Falsche Eingaben
        • Out Of Range, zB longitude=999999999999999999999999999999999999
        • Falscher Typ, zB latitude=nope
      • Logisch falsche Eingabe (ungültige GPS-Koordinaten)
      • Keine Eingabe
      • Leere Eingabe, zB latitude=<nur Leerzeichen>
  • /api/car/available
    • start
      • Korrekte Eingabe
      • Falsche Eingaben
        • Falsches Datumsformat
        • Ungültiges Datum, zB 34.13.201119
        • Falscher Typ, zB start=morgen
      • Keine Eingabe
      • Leere Eingabe, zB start=<nur Leerzeichen>
      • Start- nach Enddatum
    • end
      • Korrekte Eingabe
      • Falsche Eingaben
        • Falsches Datumsformat
        • Ungültiges Datum, zB 34.13.201119
        • Falscher Typ, zB end=gestern
      • Keine Eingabe
      • Leere Eingabe, zB end=<nur Leerzeichen>
      • End- vor Startdatum
  • /api/car/all
    • TBD...
  • /api/user/<user_id>/rented
    • user_id
      • Korrekte Eingabe (muss mit Token zusammenpassen)
      • Falsche Eingaben
        • Out Of Range, zB id=999999999999999999999999999999999999
        • Negative Daten, zB id=-1
        • Falscher Typ, zB id=nope
      • Logisch falsche Eingabe (user_id != token.user_id)
      • Keine Eingabe
      • Leere Eingabe, zB id=<nur Leerzeichen>
  • /api/car/<car_id>/img
    • car_id
      • Korrekte Eingabe
      • Falsche Eingaben
        • Out Of Range, zB id=999999999999999999999999999999999999
        • Negative Daten, zB id=-1
        • Falscher Typ, zB id=nope
      • Logisch falsche Eingabe (Auto zurückgeben, das nicht gemietet war)
      • Keine Eingabe
      • Leere Eingabe, zB id=<nur Leerzeichen>

WS1 - Anbindung an WS2

  • WS2 verfügbar (TBD: was tun, wenn WS2 wirklich nicht verfügbar?)
  • WS2 nicht verfügbar

WS1 - Endpoints

Frontend - REST:

Route Conventions: singular nomen and verbs.

  • GET /api/token - login mittels basic auth

  • GET /api/user/{id}/cars - liefert alle ausgeborgten autos zurück

  • PUT /api/car/available - liefert alle verfügbaren Autos zurück

  • GET /api/car/all - liefert alle Autos zurück

  • PUT /api/car/{id}/rent- Auto ausborgen/buchen

  • PUT /api/car/{id}/return - Auto retonieren

Verwendete HTTP Statuscodes:

200 - Everything OK
400 - Bad Request (e.g. string instead of int etc.)
401 - Not Authorized
404 - Requested resource not found
409 - Good request but could not be fulfilled (e.g. requested resource not available)
500 - Server Error
https://de.wikipedia.org/wiki/HTTP-Statuscode

Support Car Pictures

TBD:

It would be nice to also have corresponding pictures for each car (and with three cars, the effort is manageable right now).

Proposed solution (in WS1)

  • extend database.car with path_to_image image_file_name column
  • store images in static/img/<car_name_or_something>.jpg (see database.car.image_file_name path_to_image)
  • option 1) Frontend can GET /api/car/<car_id>/img and receives the image file
  • option 2) Frontend can directly access /static/img/<file_name> (for @web-weber )

Migration auf MarkusWET's AWS

Da wir bei dem AWS-Account von @ddrexler ziemlich sicher sind, dass es sich nicht um einen Student-Account mit Gratiskontingent handelt.

Maschinen

  • Elastic Beanstalk für WS1
  • Elastic Beanstalk für WS2
  • EC2 für Front-End (ja, wir sollten es schon hosten nachdem es sicher gemacht worden ist - Stichwort HTTPS usw)

WS2 - Travis CI Tests

Tests für alle Webservices schreiben (auch für Frontend, @web-weber?) und in Travis CI durchlaufen lassen bei Build.

  • Korrekte Eingabe
  • Falsche Eingaben
    • Out Of Range, zB id=999999999999999999999999999999999999
    • Negative Daten, zB id=-1
    • Falscher Typ, zB id=nope
    • Ungültige Datum/ungültige Datumsbereiche
  • Keine Eingabe
  • Leere Eingabe, zB id=<nur Leerzeichen>

WS2

@ddrexler

  • CrossConvert()
  • ConvertToEur()
  • Ausfall von ECB-Service simulieren

Google Maps API

  • Implementing basic GMaps functionality

  • Adding coordinates to GMaps, logic via javaScript (data delivered via array)

API Ausfall behandeln

Wie gehen wir mit dem Ausfall eines WS um? Fail Safely!

TODO:

  • WS2 fällt aus, WS1 muss damit umgehen (TODO: @MarkusWET )
  • WS1 fällt aus, Frontend muss damit umgehen (TODO: @web-weber )
  • ECB Service fällt aus, WS2 muss damit umgehen und WS1 mit Meldung von WS2

README.md überarbeiten

Wir sollten die Findings aus der Abgabe dann auch noch in die Repo-README reingeben.

  • Ziel
  • Aufbau
  • How To Run
  • diverses

Frontend

@web-weber

  • TODO: Define TODOs

  • TODO: login page html+css

  • TODO: app page html+css

  • TODO: generel requests/user-feedback JS logic

  • TODO: login JS logic

  • TODO: dashboard JS logic

  • TODO: rent car JS logic

  • TODO: return car JS logic

  • TODO: add rent counter in nav function

  • TODO: change Max Maier to Hi!

  • TODO: Adapt cars output - change to cards

  • TODO: add time period selection in view

  • TODO: add time period selection in rent process

  • TODO: add google maps functionality

  • TODO: testing

WS1 - /static/ not found @ AWS

static/styles.css für die WS1 Homepage/README.md wird nach einem Deploy auf AWS nicht gefunden. Lokal ist sie verfügbar, wird gefunden und angewandt.

Liegt daran, dass der gesamte /static/ Ordner in AWS nicht gefunden wurde!

Enable HTTPS for WS1, WS2 and Frontend (WS4)

We need HTTPS support on all our environments.

  • Task change: According to our lecturer no HTTP implementation is required, instead a theoretical explanation is recommended.

  • Optional: Register a domain to use the AWS certificate manager (recommended setup)

  • Get Certificate from e.g. Let's Encrypt

  • Enable HTTPS:

    • WS1 and WS2 are on Elastic Beanstalk. Here's a guide.
    • Frontend environment tbd

Projektziel neu definieren

Das Setting des Autoverleihs war FH-Vorgabe und ist - selbst als weiterzuführendes Übungsprojekt - eher wenig praktisch. Wir sollten also nach Projektabgabe mal über einen möglichen besseren Nutzen nachdenken und schauen, wie wir mit den Lessons Learned ein vernünftiges, verwendbares Projekt aufziehen, von dem wir auch langfristig lernen und es langfristig weiterverwenden können.

WS1 - Code Documentation

Die ganzen Methoden sollten noch schön dokumentiert werden. Siehe https://hairycode.org/2014/01/18/api-testing-with-flask-post/:

@app.route('/someendpoint/' methods=['POST'])
def some_endpoint():
    """API endpoint for submitting data to

    :return: status code 405 - invalid JSON or invalid request type
    :return: status code 400 - unsupported Content-Type or invalid publisher
    :return: status code 201 - successful submission
    """
    do_stuff(stuff=something)

Checklist

  • GET /
  • POST /api/users
  • GET /api/users/<user_id>
  • GET /api/token
  • PUT /api/car/<car_id>/rent
  • PUT /api/car/<car_id>/return
  • PUT /api/car/<car_id>/gps
  • PUT /api/car/available
  • GET /api/car/all
  • GET /api/user/<user_id>/rented
  • GET /api/car/<car_id>/img

WS1 - Autoverleih

Grobe Roadmap, wie der WS1 umgesetzt werden soll.

  • set up Flask
  • make Flask RESTful
  • implement rental and return see #7
  • add Currency Converter option
  • get AWS credentials from @ddrexler
  • deploy on AWS (Elastic Beanstalk)

Repo auf Public stellen

Vorher noch ein bisschen Code aufräumen und dann wird das Projekt mal gepublished 😄
Das hat auch den Vorteil, dass wir Code Insight Tools wie zB Codacy oder Coveralls nutzen können (die sind sonst meist für Private Repos kostenpflichtig)

WS1 - generelles Error Handling

Wie mit @web-weber besprochen, werden jetzt bei /available und /all leere JSON zurückgegeben, wenn keine Autos verfügbar sind:

HTTP/1.0 200 OK
Content-Type: application/json
Access-Control-Allow-Origin: *
Content-Length: 20
Server: Werkzeug/0.12.2 Python/3.6.4
Date: Sun, 15 Apr 2018 08:45:49 GMT
{
  "rentals": ""
}

Ziel ist es, ein Error Handling umzusetzen, bei dem zuzüglich zu den eigentlichen Rückgabe-Werten auch eine Message mitgegeben wird, die Fehler-/Validierungsmeldungen o.ä. enthält.

Weitere interessante Links:

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.