feat: add missing FE1 fields to the FE2 GQL schema (#2471)

* WIP version create

* commitCreate migrated

* minor cleanup

* commitReceived migrated

* added Project.object

* Project.comment introduced

* moving away old API usages in FE1

* ProjectMutations.batchDelete

* project pending access requests

* WIP project access req tests

* project access req tests done

* ModelByName test

* version mutation tests

* project.object tests

* batch delete tests

* minor improvements to redirect logging
This commit is contained in:
Kristaps Fabians Geikins
2024-07-10 12:33:53 +03:00
committed by GitHub
parent e703bb7415
commit 0b2ca9a515
52 changed files with 2359 additions and 285 deletions
@@ -1,16 +1,20 @@
import {
addCommitCreatedActivity,
addCommitDeletedActivity,
addCommitReceivedActivity,
addCommitUpdatedActivity
} from '@/modules/activitystream/services/commitActivity'
import {
CommitCreateError,
CommitDeleteError,
CommitReceiveError,
CommitUpdateError
} from '@/modules/core/errors/commit'
import { VersionEvents, VersionsEmitter } from '@/modules/core/events/versionsEmitter'
import {
CommitReceivedInput,
CommitUpdateInput,
MarkReceivedVersionInput,
UpdateVersionInput
} from '@/modules/core/graph/generated/graphql'
import { CommitRecord } from '@/modules/core/helpers/types'
@@ -38,9 +42,35 @@ import {
import { ensureError, MaybeNullOrUndefined, Nullable, Roles } from '@speckle/shared'
import { has } from 'lodash'
/**
* Note: Doesn't notify subscriptions or save activityStream due to missing branchName
*/
export async function markCommitReceivedAndNotify(params: {
input: MarkReceivedVersionInput | CommitReceivedInput
userId: string
}) {
const { input, userId } = params
const oldInput: CommitReceivedInput =
'projectId' in input
? {
...input,
streamId: input.projectId,
commitId: input.versionId
}
: input
const commit = await getCommit(oldInput.commitId, { streamId: oldInput.streamId })
if (!commit) {
throw new CommitReceiveError(
`Failed to find commit with id ${oldInput.commitId} in stream ${oldInput.streamId}.`,
{ info: params }
)
}
await addCommitReceivedActivity({
input: oldInput,
userId
})
}
export async function createCommitByBranchId(
params: {
streamId: string