Skip to content

Commit cbbc0cb

Browse files
authored
Watchlist fix (#246)
* Update watchlist_repository.py * Update test_watchlist_service.py * Update watchlist_dto.py * Update watchlist_repository.py
1 parent af8b098 commit cbbc0cb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

todo/repositories/watchlist_repository.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ def get_watchlisted_tasks(cls, page, limit, user_id) -> Tuple[int, List[Watchlis
6868
}
6969
},
7070
{"$unwind": "$task"},
71+
{
72+
"$lookup": {
73+
"from": "users",
74+
"let": {"createdById": "$task.createdBy"},
75+
"pipeline": [
76+
{"$match": {"$expr": {"$eq": ["$_id", {"$toObjectId": "$$createdById"}]}}}
77+
],
78+
"as": "created_by_user",
79+
}
80+
},
7181
{
7282
"$lookup": {
7383
"from": "task_details",

todo/tests/unit/services/test_watchlist_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_get_watchlisted_tasks_with_assignee(self):
6363
labels=[],
6464
dueAt=None,
6565
createdAt=datetime.now(timezone.utc),
66-
createdBy=user_id,
66+
createdBy="Test User",
6767
watchlistId=str(ObjectId()),
6868
assignee=assignee_dto,
6969
)

0 commit comments

Comments
 (0)