mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-24 21:32:24 +02:00
Extract github domains (#7420)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -95,9 +95,11 @@ export { githubId } from '@hcengineering/github'
|
||||
export { githubOperation, githubOperationPreTime } from './migration'
|
||||
export { default } from './plugin'
|
||||
export const DOMAIN_GITHUB = 'github' as Domain
|
||||
export const DOMAIN_GITHUB_SYNC = 'github_sync' as Domain
|
||||
export const DOMAIN_GITHUB_USER = 'github_user' as Domain
|
||||
export const DOMAIN_GITHUB_COMMENTS = 'github_comments' as Domain
|
||||
|
||||
@Model(github.class.DocSyncInfo, core.class.Doc, DOMAIN_GITHUB)
|
||||
@Model(github.class.DocSyncInfo, core.class.Doc, DOMAIN_GITHUB_SYNC)
|
||||
export class TDocSyncInfo extends TDoc implements DocSyncInfo {
|
||||
// _id === objectId
|
||||
@Prop(TypeNumber(), getEmbeddedLabel('Github number'))
|
||||
@@ -152,7 +154,7 @@ export class TDocSyncInfo extends TDoc implements DocSyncInfo {
|
||||
deleted!: boolean
|
||||
}
|
||||
|
||||
@Model(github.class.GithubUserInfo, core.class.Doc, DOMAIN_GITHUB)
|
||||
@Model(github.class.GithubUserInfo, core.class.Doc, DOMAIN_GITHUB_USER)
|
||||
export class TGithubUserInfo extends TDoc implements GithubUserInfo {
|
||||
@Prop(TypeString(), getEmbeddedLabel('ID'))
|
||||
@ReadOnly()
|
||||
|
||||
@@ -32,7 +32,7 @@ import github from './plugin'
|
||||
import { DOMAIN_TIME } from '@hcengineering/model-time'
|
||||
import { DOMAIN_TRACKER } from '@hcengineering/model-tracker'
|
||||
import time from '@hcengineering/time'
|
||||
import { DOMAIN_GITHUB } from '.'
|
||||
import { DOMAIN_GITHUB, DOMAIN_GITHUB_SYNC, DOMAIN_GITHUB_USER } from '.'
|
||||
|
||||
export async function guessStatus (status: Status, statuses: Status[]): Promise<Status> {
|
||||
const active = (): Status => statuses.find((it) => it.category === task.statusCategory.Active) as Status
|
||||
@@ -328,6 +328,13 @@ export const githubOperationPreTime: MigrateOperation = {
|
||||
func: async (client) => {
|
||||
await client.deleteMany(DOMAIN_TX, { objectClass: github.class.DocSyncInfo })
|
||||
}
|
||||
},
|
||||
{
|
||||
state: 'migrate-github-sync-domain',
|
||||
func: async (client) => {
|
||||
await client.move(DOMAIN_GITHUB, { _class: github.class.DocSyncInfo }, DOMAIN_GITHUB_SYNC)
|
||||
await client.move(DOMAIN_GITHUB, { _class: github.class.GithubUserInfo }, DOMAIN_GITHUB_USER)
|
||||
}
|
||||
}
|
||||
])
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user