ba3d9ade22
* feat: moved project roles to activity * fix: added previous project role filed on activity * fix: remvoke does not get logged as an actvity for every project in a workspace when removed from workspace * fix: on delete user account, emit also seat and project event Co-authored-by: Charles Driesler <chuck@speckle.systems>
23 lines
842 B
TypeScript
23 lines
842 B
TypeScript
import { GetPaginatedProjectModelsTotalCount } from '@/modules/core/domain/branches/operations'
|
|
import { QueryAllProjects } from '@/modules/core/domain/projects/operations'
|
|
import { GetWorkspaceModelCount } from '@/modules/workspaces/domain/operations'
|
|
|
|
// TODO: Optimize with single model count query per regional db
|
|
export const getWorkspaceModelCountFactory =
|
|
(deps: {
|
|
queryAllProjects: QueryAllProjects
|
|
getPaginatedProjectModelsTotalCount: GetPaginatedProjectModelsTotalCount
|
|
}): GetWorkspaceModelCount =>
|
|
async ({ workspaceId }) => {
|
|
let modelCount = 0
|
|
|
|
for await (const projects of deps.queryAllProjects({ workspaceId })) {
|
|
for (const project of projects) {
|
|
modelCount =
|
|
modelCount + (await deps.getPaginatedProjectModelsTotalCount(project.id, {}))
|
|
}
|
|
}
|
|
|
|
return modelCount
|
|
}
|