Extract github domains (#7420)
Some checks are pending
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-12-10 19:08:44 +05:00 committed by GitHub
parent d3e74aeba0
commit 087cf2a43f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 4 deletions

View File

@ -251,6 +251,15 @@ const docSyncInfo: Schema = {
}
}
const githubLogin: Schema = {
...baseSchema,
login: {
type: 'text',
notNull: true,
index: true
}
}
export function addSchema (domain: string, schema: Schema): void {
domainSchemas[translateDomain(domain)] = schema
domainSchemaFields.set(domain, createSchemaFields(schema))
@ -271,7 +280,8 @@ export const domainSchemas: Record<string, Schema> = {
notification: notificationSchema,
[translateDomain('notification-dnc')]: dncSchema,
[translateDomain('notification-user')]: userNotificationSchema,
github: docSyncInfo
[translateDomain('github_sync')]: docSyncInfo,
[translateDomain('github_user')]: githubLogin
}
export function getSchema (domain: string): Schema {

View File

@ -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()

View File

@ -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)
}
}
])
},