-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
86 lines (80 loc) · 2.4 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from flask import Flask, jsonify
from flask_swagger import swagger
from database_migration.update import get_version
from ekn.database import DatabaseManager
from ekn.routes import (
categories,
change_security,
gdpr_view,
get_score,
get_current_key,
get_vote_count,
misc,
register_connection,
register_service,
register_user,
registration,
users,
verify_credentials_route,
version,
vote,
)
# Update DB
VERSION = get_version(DatabaseManager())
app = Flask(__name__)
app.add_url_rule("/categories", view_func=categories, methods=["GET", "OPTIONS"])
app.add_url_rule(
"/change_security", view_func=change_security, methods=["POST", "OPTIONS"]
)
app.add_url_rule(
"/change_password", view_func=users.change_password, methods=["POST", "OPTIONS"]
)
app.add_url_rule("/gdpr_view", view_func=gdpr_view, methods=["POST", "OPTIONS"])
app.add_url_rule("/get_score", view_func=get_score, methods=["POST", "OPTIONS"])
app.add_url_rule(
"/get_current_key", view_func=get_current_key, methods=["POST", "OPTIONS"]
)
app.add_url_rule(
"/get_vote_count", view_func=get_vote_count, methods=["POST", "OPTIONS"]
)
app.add_url_rule(
"/get_total_users", view_func=misc.get_total_users, methods=["GET", "OPTIONS"]
)
app.add_url_rule(
"/get_total_real_users",
view_func=misc.get_total_real_users,
methods=["GET", "OPTIONS"],
)
app.add_url_rule(
"/get_total_temp_users",
view_func=misc.get_total_temp_users,
methods=["GET", "OPTIONS"],
)
app.add_url_rule(
"/get_total_votes", view_func=misc.get_total_votes, methods=["GET", "OPTIONS"]
)
app.add_url_rule(
"/register_connection", view_func=register_connection, methods=["POST", "OPTIONS"]
)
app.add_url_rule(
"/register_service", view_func=register_service, methods=["POST", "OPTIONS"]
)
app.add_url_rule(
"/register_temp_user",
view_func=registration.register_temp_user,
methods=["POST", "OPTIONS"],
)
app.add_url_rule("/register_user", view_func=register_user, methods=["POST", "OPTIONS"])
app.add_url_rule(
"/verify_credentials",
view_func=verify_credentials_route,
methods=["POST", "OPTIONS"],
)
app.add_url_rule("/version", view_func=version, methods=["GET"])
app.add_url_rule("/vote", view_func=vote, methods=["POST", "OPTIONS"])
@app.route("/")
def spec():
swag = swagger(app)
swag['info']['version'] = VERSION
swag['info']['title'] = "EKN"
return jsonify(swag)