Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
483 B
2
Indexable
Never
class UserSpaces(Resource):
    def get(self, user_id):
        # Query to get all spaces associated with the tenant (user_id)
        spaces = Space.query.filter_by(tenant_id=user_id).all()
        
        if spaces:
            # Convert each space to a dictionary format
            spaces_list = [space.to_dict() for space in spaces]
            return jsonify({"spaces": spaces_list})
        else:
            return jsonify({"message": "No spaces found for this user"}), 404
Leave a Comment