From f24779ff14fc2fae03fb59c51a33af05d852ba18 Mon Sep 17 00:00:00 2001 From: Mamadou DICKO <63923024+mamadoudicko@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:16:38 +0100 Subject: [PATCH] fix: add user id while creating default brain (#1616) --- .../repository/brain/get_default_user_brain_or_create_new.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/repository/brain/get_default_user_brain_or_create_new.py b/backend/repository/brain/get_default_user_brain_or_create_new.py index b160d96a8..2983686ec 100644 --- a/backend/repository/brain/get_default_user_brain_or_create_new.py +++ b/backend/repository/brain/get_default_user_brain_or_create_new.py @@ -1,17 +1,18 @@ from models import BrainEntity, UserIdentity from models.databases.supabase.brains import CreateBrainProperties +from routes.authorizations.types import RoleEnum + from repository.brain import create_brain, create_brain_user, get_user_default_brain from repository.brain.create_brain import create_brain from repository.brain.create_brain_user import create_brain_user from repository.brain.get_default_user_brain import get_user_default_brain -from routes.authorizations.types import RoleEnum def get_default_user_brain_or_create_new(user: UserIdentity) -> BrainEntity: default_brain = get_user_default_brain(user.id) if not default_brain: - default_brain = create_brain(CreateBrainProperties()) + default_brain = create_brain(brain=CreateBrainProperties(), user_id=user.id) create_brain_user(user.id, default_brain.brain_id, RoleEnum.Owner, True) return default_brain