feat: add journey creation functionality
Co-authored-by: aider (ollama/qwen2.5-coder:32b) <aider@aider.chat>
This commit is contained in:
4 files changed
+170
-4
No files matched your search
@@ -44,6 +44,28 @@ def save_journeys():
|
||||
# Load journeys when the app starts
|
||||
load_journeys()
|
||||
|
||||
@app.route('/api/journeys', methods=['POST'])
|
||||
def create_journey():
|
||||
"""Create a new journey."""
|
||||
data = request.get_json()
|
||||
|
||||
if not data or 'name' not in data:
|
||||
return jsonify({'error': 'Journey name is required'}), 400
|
||||
|
||||
# Create new journey
|
||||
new_journey = {
|
||||
'id': len(journeys) + 1,
|
||||
'name': data['name'],
|
||||
'description': data.get('description', ''),
|
||||
'markers': data.get('markers', []),
|
||||
'createdAt': datetime.now().isoformat()
|
||||
}
|
||||
|
||||
journeys.append(new_journey)
|
||||
save_journeys()
|
||||
|
||||
return jsonify(new_journey), 201
|
||||
|
||||
@app.route('/api/journeys', methods=['GET'])
|
||||
def get_journeys():
|
||||
"""Get all journeys."""
|
||||
|
||||
Reference in new issue
Block a user