@mtldev514/retro-portfolio-maker 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/engine/admin/admin_api.py +24 -0
- package/package.json +1 -1
|
@@ -123,6 +123,30 @@ def upload_bulk():
|
|
|
123
123
|
"errorDetails": errors
|
|
124
124
|
})
|
|
125
125
|
|
|
126
|
+
@app.route('/api/content', methods=['GET'])
|
|
127
|
+
def get_all_content():
|
|
128
|
+
"""Get all content from all categories"""
|
|
129
|
+
try:
|
|
130
|
+
all_content = {}
|
|
131
|
+
# List all JSON files in data directory
|
|
132
|
+
if os.path.exists(USER_DATA_DIR):
|
|
133
|
+
for filename in os.listdir(USER_DATA_DIR):
|
|
134
|
+
if filename.endswith('.json'):
|
|
135
|
+
category = filename[:-5] # Remove .json extension
|
|
136
|
+
data_file = os.path.join(USER_DATA_DIR, filename)
|
|
137
|
+
with open(data_file, 'r', encoding='utf-8') as f:
|
|
138
|
+
data = json.load(f)
|
|
139
|
+
# Support both {"items": [...]} and [...] formats
|
|
140
|
+
if isinstance(data, dict) and 'items' in data:
|
|
141
|
+
all_content[category] = data['items']
|
|
142
|
+
elif isinstance(data, list):
|
|
143
|
+
all_content[category] = data
|
|
144
|
+
else:
|
|
145
|
+
all_content[category] = []
|
|
146
|
+
return jsonify(all_content)
|
|
147
|
+
except Exception as e:
|
|
148
|
+
return jsonify({"error": str(e)}), 500
|
|
149
|
+
|
|
126
150
|
@app.route('/api/content/<category>', methods=['GET'])
|
|
127
151
|
def get_content(category):
|
|
128
152
|
"""Get all content for a category"""
|
package/package.json
CHANGED