Skip to content

Commit

Permalink
add get all templates function
Browse files Browse the repository at this point in the history
  • Loading branch information
Alforoan committed Jul 3, 2024
1 parent a570710 commit 3ffec65
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,23 @@ def get_template_cards(board_id):

return jsonify(template_cards_list)

@app.route('/api/templates', methods=['GET'])
def get_templates():
templates = Template.query.all()
templates_list = []

for template in templates:
template_data = {
'uuid': template.uuid,
'name': template.name,
'author': template.author,
'downloads': template.downloads,
'uploaded_at': template.uploaded_at
}
templates_list.append(template_data)

return jsonify(templates_list)

if __name__ == '__main__':
with app.app_context():
db.create_all()
Expand Down

0 comments on commit 3ffec65

Please sign in to comment.