mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-08 02:37:44 +02:00
UBERF-7922: Split Server Storage to middlewares (#6464)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -434,7 +434,7 @@ export class CommentSyncManager implements DocSyncManager {
|
||||
project: GithubProject
|
||||
): Promise<void> {
|
||||
// No need to perform external sync for comments, so let's update marks
|
||||
const tx = derivedClient.apply('comments_github' + project._id)
|
||||
const tx = derivedClient.apply()
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { externalVersion: githubExternalSyncVersion })
|
||||
}
|
||||
|
||||
@@ -22,16 +22,8 @@ import core, {
|
||||
Ref,
|
||||
Space,
|
||||
Status,
|
||||
TxOperations,
|
||||
generateId
|
||||
TxOperations
|
||||
} from '@hcengineering/core'
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
import { LiveQuery } from '@hcengineering/query'
|
||||
import task, { TaskType } from '@hcengineering/task'
|
||||
import { MarkupNode, MarkupNodeType, areEqualMarkups, markupToJSON, traverseNode } from '@hcengineering/text'
|
||||
import tracker, { Issue, IssuePriority } from '@hcengineering/tracker'
|
||||
import time, { type ToDo } from '@hcengineering/time'
|
||||
import { ProjectsV2ItemEvent } from '@octokit/webhooks-types'
|
||||
import github, {
|
||||
DocSyncInfo,
|
||||
GithubFieldMapping,
|
||||
@@ -41,6 +33,13 @@ import github, {
|
||||
GithubMilestone,
|
||||
GithubProject
|
||||
} from '@hcengineering/github'
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
import { LiveQuery } from '@hcengineering/query'
|
||||
import task, { TaskType } from '@hcengineering/task'
|
||||
import { MarkupNode, MarkupNodeType, areEqualMarkups, markupToJSON, traverseNode } from '@hcengineering/text'
|
||||
import time, { type ToDo } from '@hcengineering/time'
|
||||
import tracker, { Issue, IssuePriority } from '@hcengineering/tracker'
|
||||
import { ProjectsV2ItemEvent } from '@octokit/webhooks-types'
|
||||
import { deepEqual } from 'fast-equals'
|
||||
import { Octokit } from 'octokit'
|
||||
import {
|
||||
@@ -393,7 +392,7 @@ export abstract class IssueSyncManagerBase {
|
||||
return true
|
||||
})
|
||||
|
||||
const updateTodos = this.client.apply('todos' + account)
|
||||
const updateTodos = this.client.apply()
|
||||
for (const [k, v] of Object.entries(todos)) {
|
||||
await updateTodos.updateDoc(time.class.ToDo, time.space.ToDos, k as Ref<ToDo>, {
|
||||
doneOn: v ? Date.now() : null
|
||||
@@ -1071,7 +1070,7 @@ export abstract class IssueSyncManagerBase {
|
||||
url: { $in: issues.map((it) => (it.url ?? '').toLowerCase()) }
|
||||
})
|
||||
|
||||
const ops = derivedClient.apply('sync-issyes' + generateId())
|
||||
const ops = derivedClient.apply()
|
||||
|
||||
for (const issue of issues) {
|
||||
try {
|
||||
|
||||
@@ -18,11 +18,6 @@ import core, {
|
||||
generateId,
|
||||
makeCollaborativeDoc
|
||||
} from '@hcengineering/core'
|
||||
import task, { TaskType, calcRank, makeRank } from '@hcengineering/task'
|
||||
import time, { ToDo, ToDoPriority } from '@hcengineering/time'
|
||||
import tracker, { Issue, IssuePriority, IssueStatus, Project } from '@hcengineering/tracker'
|
||||
import { OctokitResponse } from '@octokit/types'
|
||||
import { ProjectsV2ItemEvent, PullRequestEvent } from '@octokit/webhooks-types'
|
||||
import github, {
|
||||
DocSyncInfo,
|
||||
GithubIntegrationRepository,
|
||||
@@ -34,6 +29,11 @@ import github, {
|
||||
GithubTodo,
|
||||
LastReviewState
|
||||
} from '@hcengineering/github'
|
||||
import task, { TaskType, calcRank, makeRank } from '@hcengineering/task'
|
||||
import time, { ToDo, ToDoPriority } from '@hcengineering/time'
|
||||
import tracker, { Issue, IssuePriority, IssueStatus, Project } from '@hcengineering/tracker'
|
||||
import { OctokitResponse } from '@octokit/types'
|
||||
import { ProjectsV2ItemEvent, PullRequestEvent } from '@octokit/webhooks-types'
|
||||
import { Octokit } from 'octokit'
|
||||
import config from '../config'
|
||||
import {
|
||||
@@ -507,7 +507,7 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
|
||||
pullRequestExternal.body
|
||||
)
|
||||
|
||||
const op = this.client.apply(generateId())
|
||||
const op = this.client.apply()
|
||||
let createdPullRequest: GithubPullRequest | undefined
|
||||
|
||||
await this.ctx.withLog(
|
||||
@@ -1302,7 +1302,7 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
|
||||
)
|
||||
}
|
||||
|
||||
const tx = derivedClient.apply('pullrequests_github' + prj._id)
|
||||
const tx = derivedClient.apply()
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { derivedVersion: githubDerivedSyncVersion })
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ export class RepositorySyncMapper implements DocSyncManager {
|
||||
{ _class: github.class.DocSyncInfo, repository: repo._id, processingId: { $ne: processingId } },
|
||||
{ limit: 1000 }
|
||||
)
|
||||
const ops = derivedClient.apply(repo._id)
|
||||
const ops = derivedClient.apply()
|
||||
if (docs.length === 0) {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ export class ReviewCommentSyncManager implements DocSyncManager {
|
||||
project: GithubProject
|
||||
): Promise<void> {
|
||||
// No need to perform external sync for reviews, so let's update marks
|
||||
const tx = derivedClient.apply('reviews_github' + project._id)
|
||||
const tx = derivedClient.apply()
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { externalVersion: githubExternalSyncVersion })
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ export class ReviewThreadSyncManager implements DocSyncManager {
|
||||
): Promise<void> {
|
||||
if (kind === 'externalVersion') {
|
||||
// No need to perform external sync for review threads, so let's update marks
|
||||
const tx = derivedClient.apply('review_threads_github' + prj._id)
|
||||
const tx = derivedClient.apply()
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { externalVersion: githubExternalSyncVersion })
|
||||
}
|
||||
@@ -545,7 +545,7 @@ export class ReviewThreadSyncManager implements DocSyncManager {
|
||||
{ reviewThreadId: ext.id }
|
||||
)
|
||||
}
|
||||
const tx = derivedClient.apply('reviewThread_github' + prj._id)
|
||||
const tx = derivedClient.apply()
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { derivedVersion: githubDerivedSyncVersion })
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ export class ReviewSyncManager implements DocSyncManager {
|
||||
project: GithubProject
|
||||
): Promise<void> {
|
||||
// No need to perform external sync for reviews, so let's update marks
|
||||
const tx = derivedClient.apply('reviews_github' + project._id)
|
||||
const tx = derivedClient.apply()
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { externalVersion: githubExternalSyncVersion })
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ export async function deleteObjects (
|
||||
objects: Doc[],
|
||||
account: Ref<Account>
|
||||
): Promise<void> {
|
||||
const ops = client.apply('delete' + account)
|
||||
const ops = client.apply()
|
||||
for (const object of objects) {
|
||||
if (client.getHierarchy().isDerived(object._class, core.class.AttachedDoc)) {
|
||||
const adoc = object as AttachedDoc
|
||||
|
||||
Reference in New Issue
Block a user