Closed vignesh-gupta closed 2 hours ago
The project count is 4 even when there is no project in the workspace so seems like it's fetching all the project and members
Log:
{ projects: 4, projectIds: 0, tasks: 0, assigneeIds: 0 }
Code:
const projects = await databases.listDocuments<Project>(
DATABASE_ID,
PROJECTS_ID,
projectIds.length > 0 ? [Query.contains("$id", projectIds)] : []
);
Issue: the projectIds
length is 0 so there is no query at all and fetch all the project and same goes for members
Solution
let projects: Models.DocumentList<Project> = {
documents: [],
total: 0,
};
if (projectIds.length > 0)
projects = await databases.listDocuments<Project>(
DATABASE_ID,
PROJECTS_ID,
[Query.contains("$id", projectIds)]
);
Scenario: When a new user logged in, and create a workspace we are seeing below error in terminal.
Route:
GET /api/tasks?workspaceId=671b3a70002f53bcfc45 500 in 2324ms
Error: