Skip to content

Commit df834a8

Browse files
committed
Set team_id in Plan using user's current team
The Plan object now assigns team_id based on the user's current team retrieved from the memory store, instead of defaulting to None. This ensures plans are correctly associated with the user's active team.
1 parent 5a0213d commit df834a8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/backend/v3/api/router.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
import uuid
66
from typing import Optional
77

8+
from common.utils.utils_date import format_dates_in_messages
9+
from common.config.app_config import config
810
import v3.models.messages as messages
911
from auth.auth_utils import get_authenticated_user_details
1012
from common.database.database_factory import DatabaseFactory
1113
from common.models.messages_kernel import (
1214
InputTask,
1315
Plan,
1416
PlanStatus,
17+
PlanWithSteps,
1518
TeamSelectionRequest,
1619
)
1720
from common.utils.event_utils import track_event_if_configured
@@ -273,12 +276,16 @@ async def process_request(
273276
plan_id = str(uuid.uuid4())
274277
# Initialize memory store and service
275278
memory_store = await DatabaseFactory.get_database(user_id=user_id)
279+
user_current_team = await memory_store.get_current_team(user_id=user_id)
280+
team_id = None
281+
if user_current_team:
282+
team_id = user_current_team.team_id
276283
plan = Plan(
277284
id=plan_id,
278285
plan_id=plan_id,
279286
user_id=user_id,
280287
session_id=input_task.session_id,
281-
team_id=None, # TODO add current_team_id
288+
team_id=team_id,
282289
initial_goal=input_task.description,
283290
overall_status=PlanStatus.in_progress,
284291
)

0 commit comments

Comments
 (0)