diff --git a/game_collection/app.py b/game_collection/app.py index b713adf..e612d40 100644 --- a/game_collection/app.py +++ b/game_collection/app.py @@ -22,11 +22,12 @@ def add_game(): if not authenticate(): return jsonify({'message': 'Unauthorized access!'}), 401 data = request.json + buyer_username = g.user.username # Get the username from the authenticated user new_game = Game( image=data['image'], title=data['title'], date=datetime.now().strftime('%Y-%m-%d'), # Set current date - buyer=data['buyer'], + buyer=buyer_username, # Set buyer as the authenticated user's username owned=data['owned'] ) db.session.add(new_game)