|
1 | 1 | from flask import Blueprint, Response, jsonify, request |
2 | 2 |
|
3 | 3 | from auth.auth import valid_api_auth |
| 4 | +from config import colours, icons |
4 | 5 | from events.utils import ( |
5 | 6 | create_event, |
6 | 7 | create_repeat_event, |
@@ -661,3 +662,43 @@ def get_week_by_date(date_str: str) -> tuple[Response, int]: |
661 | 662 | return jsonify({"error": "Week not found"}), 404 |
662 | 663 |
|
663 | 664 | return jsonify(week.to_dict()), 200 |
| 665 | + |
| 666 | + |
| 667 | +@events_api_bp.route("/colours", methods=["GET"]) |
| 668 | +def get_colours() -> tuple[Response, int]: |
| 669 | + """Get all available colours |
| 670 | + --- |
| 671 | + security: [] |
| 672 | + responses: |
| 673 | + 200: |
| 674 | + description: A JSON object containing all available colours. |
| 675 | + schema: |
| 676 | + type: object |
| 677 | + additionalProperties: |
| 678 | + type: string |
| 679 | + 404: |
| 680 | + description: No colours found. |
| 681 | + """ |
| 682 | + if not colours: |
| 683 | + return jsonify({"error": "No colours found"}), 404 |
| 684 | + return jsonify(colours), 200 |
| 685 | + |
| 686 | + |
| 687 | +@events_api_bp.route("/icons", methods=["GET"]) |
| 688 | +def get_icons() -> tuple[Response, int]: |
| 689 | + """Get all available icons |
| 690 | + --- |
| 691 | + security: [] |
| 692 | + responses: |
| 693 | + 200: |
| 694 | + description: A JSON object containing all available icons. |
| 695 | + schema: |
| 696 | + type: object |
| 697 | + additionalProperties: |
| 698 | + type: string |
| 699 | + 404: |
| 700 | + description: No icons found. |
| 701 | + """ |
| 702 | + if not icons: |
| 703 | + return jsonify({"error": "No icons found"}), 404 |
| 704 | + return jsonify(icons), 200 |
0 commit comments