chore(server): core IoC 16 - getSpecificBranchCommitsFactory

This commit is contained in:
Kristaps Fabians Geikins
2024-09-27 14:32:13 +03:00
parent d85d5bdefd
commit f42dea7331
12 changed files with 61 additions and 58 deletions
@@ -6,7 +6,7 @@ import {
import {
getBranchCommitsTotalCount,
getPaginatedBranchCommits as getPaginatedBranchCommitsDb,
getSpecificBranchCommits,
getSpecificBranchCommitsFactory,
PaginatedBranchCommitsParams
} from '@/modules/core/repositories/commits'
import {
@@ -14,6 +14,7 @@ import {
getCommitsTotalCountByStreamId
} from '@/modules/core/services/commits'
import { BadRequestError } from '@/modules/shared/errors'
import { db } from '@/db/knex'
export async function getPaginatedStreamCommits(
streamId: string,
@@ -45,6 +46,8 @@ export async function getPaginatedBranchCommits(
'Cannot return more than 100 items, please use pagination.'
)
const getSpecificBranchCommits = getSpecificBranchCommitsFactory({ db })
// Load priority commits first
let priorityCommitPromise: Optional<ReturnType<typeof getSpecificBranchCommits>> =
undefined
@@ -10,6 +10,7 @@ import {
GetBranchLatestCommits,
GetStreamBranchesByName
} from '@/modules/core/domain/branches/operations'
import { GetSpecificBranchCommits } from '@/modules/core/domain/commits/operations'
import {
ResourceIdentifier,
ResourceIdentifierInput,
@@ -21,8 +22,7 @@ import {
import { CommitRecord } from '@/modules/core/helpers/types'
import {
getAllBranchCommits,
getCommitsAndTheirBranchIds,
getSpecificBranchCommits
getCommitsAndTheirBranchIds
} from '@/modules/core/repositories/commits'
import { getStreamObjects } from '@/modules/core/repositories/objects'
import { Optional, SpeckleViewer } from '@speckle/shared'
@@ -159,7 +159,7 @@ const getVersionResourceGroupsIncludingAllVersionsFactory =
type GetVersionResourceGroupsLoadedVersionsOnlyDeps = {
getStreamBranchesByName: GetStreamBranchesByName
getSpecificBranchCommits: typeof getSpecificBranchCommits
getSpecificBranchCommits: GetSpecificBranchCommits
getBranchLatestCommits: GetBranchLatestCommits
}