forked from CodecoolBase/proman-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
77 lines (53 loc) · 1.6 KB
/
main.py
File metadata and controls
77 lines (53 loc) · 1.6 KB
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
from flask import Flask, render_template, url_for, request
from util import json_response
import persistence
import data_handler
import json
app = Flask(__name__)
@app.route("/")
def index():
"""
This is a one-pager which shows all the boards and cards
"""
return render_template('index.html')
@app.route("/get-boards")
@json_response
def get_boards():
"""
All the boards
"""
return persistence.get_sql_boards()
@app.route("/get-statuses")
@json_response
def get_statuses():
return persistence.get_statuses()
@app.route("/get-cards/<int:board_id>")
@json_response
def get_cards_for_board(board_id: int):
"""
All cards that belongs to a board
:param board_id: id of the parent board
"""
return data_handler.get_cards_for_board(board_id)
@app.route('/add-new-board', methods=["GET", "POST"])
@json_response
def add_new_board():
title = request.get_json()['title']
return data_handler.add_new_board(title)
@app.route('/update-board-title', methods=["GET", "POST"])
@json_response
def update_board_title():
data_handler.update_board_title(request.get_json()["newtitle"], request.get_json()["boardid"])
pass
@app.route('/update-card-title', methods=["GET", "POST"])
@json_response
def update_card_title():
data_handler.update_card_title(request.get_json()["newtitle"], request.get_json()["cardid"])
pass
def main():
app.run(debug=True)
# Serving the favicon
with app.app_context():
app.add_url_rule('/favicon.ico', redirect_to=url_for('static', filename='favicon/favicon.ico'))
if __name__ == '__main__':
main()