Skip to content

Commit

Permalink
add back files
Browse files Browse the repository at this point in the history
  • Loading branch information
akrakman committed Oct 25, 2022
1 parent b222c0e commit 0f88b03
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/backend/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
""" This is a module docstring """
from flask import Flask, request
from flask_cors import CORS
from login import Login

# from logging import FileHandler, WARNING

app = Flask(__name__)

CORS(app)


@app.route("/login", methods=["POST", "GET"])
def login():
"""Handles login routing"""
user_login = Login()
user = request.json["user"]
password = request.json["password"]
if user_login.login(user, password):
return f"welcome {user}", 200
return "User not found, please try again", 404


@app.route("/register", methods=["POST", "GET"])
def register():
"""Handles register routing"""
user_login = Login()
username = request.json["username"]
email = request.json["email"]
password = request.json["password"]
phone = request.json["phone"]
result = user_login.register(username, email, password, phone)
if not result.status:
return result.message, 400
return result.message, 200

if __name__ == "__main__":
app.run(debug=True) # pragma: no cover
15 changes: 15 additions & 0 deletions src/backend/apt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Contains Apartment class"""
from dataclasses import dataclass
from marshmallow import Schema, fields


@dataclass
class Apt:
"""Apt class, stores detail about an apartment"""

apt_id: int
name: str
address: str
rating: int
price_min: int
price_max: int

3 comments on commit 0f88b03

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCover
TOTAL1620100%

Tests Skipped Failures Errors Time
36 0 💤 2 ❌ 0 🔥 0.622s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
app.py252020%13–37
login.py372532%26–58, 62–70
mainpage.py836818%17–34, 38–53, 60–76, 82–97, 103–118, 125–145, 149–158, 162–176
TOTAL16211330% 

Tests Skipped Failures Errors Time
1 0 💤 0 ❌ 1 🔥 0.731s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCover
TOTAL1620100%

Tests Skipped Failures Errors Time
36 0 💤 2 ❌ 0 🔥 0.747s ⏱️

Please sign in to comment.