mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-07 02:07:43 +02:00
TSK-803: Fix load speed (#2728)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
+17
-3
@@ -34,8 +34,10 @@ import {
|
||||
DOMAIN_MODEL,
|
||||
Enum,
|
||||
EnumOf,
|
||||
FieldIndex,
|
||||
FullTextData,
|
||||
FullTextSearchContext,
|
||||
IndexingConfiguration,
|
||||
IndexKind,
|
||||
IndexStageState,
|
||||
Interface,
|
||||
@@ -249,15 +251,22 @@ export class TFulltextData extends TDoc implements FullTextData {
|
||||
export class TDocIndexState extends TDoc implements DocIndexState {
|
||||
objectClass!: Ref<Class<Doc>>
|
||||
|
||||
attachedTo?: Ref<Doc>
|
||||
attachedToClass?: Ref<Class<Doc>>
|
||||
@Prop(TypeRef(core.class.Doc), core.string.AttachedTo)
|
||||
@Index(IndexKind.Indexed)
|
||||
@Hidden()
|
||||
attachedTo?: Ref<Doc>
|
||||
|
||||
@Prop(TypeRef(core.class.Doc), core.string.AttachedToClass)
|
||||
@Index(IndexKind.Indexed)
|
||||
@Hidden()
|
||||
attachedToClass?: Ref<Class<Doc>>
|
||||
|
||||
// Indexable attributes of document.
|
||||
attributes!: Record<string, any>
|
||||
|
||||
removed!: boolean
|
||||
|
||||
// States for diffetent stages
|
||||
// States for different stages
|
||||
stages!: Record<string, boolean | string>
|
||||
}
|
||||
|
||||
@@ -284,3 +293,8 @@ export class TConfiguration extends TDoc implements Configuration {
|
||||
@Prop(TypeBoolean(), core.string.Private)
|
||||
enabled!: boolean
|
||||
}
|
||||
|
||||
@MMixin(core.mixin.IndexConfiguration, core.class.Class)
|
||||
export class TIndexConfiguration<T extends Doc = Doc> extends TClass implements IndexingConfiguration<T> {
|
||||
indexes!: FieldIndex<T>[]
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { AccountRole } from '@hcengineering/core'
|
||||
import { AccountRole, TxCollectionCUD, Doc, AttachedDoc, IndexingConfiguration, Class } from '@hcengineering/core'
|
||||
import { Builder } from '@hcengineering/model'
|
||||
import core from './component'
|
||||
import {
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
TEnumOf,
|
||||
TFulltextData,
|
||||
TFullTextSearchContext,
|
||||
TIndexConfiguration,
|
||||
TIndexStageState,
|
||||
TInterface,
|
||||
TMixin,
|
||||
@@ -104,7 +105,8 @@ export function createModel (builder: Builder): void {
|
||||
TIndexStageState,
|
||||
TFullTextSearchContext,
|
||||
TConfiguration,
|
||||
TConfigurationElement
|
||||
TConfigurationElement,
|
||||
TIndexConfiguration
|
||||
)
|
||||
|
||||
builder.createDoc(
|
||||
@@ -116,4 +118,23 @@ export function createModel (builder: Builder): void {
|
||||
},
|
||||
core.account.System
|
||||
)
|
||||
|
||||
builder.mixin<Class<TxCollectionCUD<Doc, AttachedDoc>>, IndexingConfiguration<TxCollectionCUD<Doc, AttachedDoc>>>(
|
||||
core.class.TxCollectionCUD,
|
||||
core.class.Class,
|
||||
core.mixin.IndexConfiguration,
|
||||
{
|
||||
indexes: [
|
||||
'tx.objectId',
|
||||
'tx._class',
|
||||
'tx.objectClass',
|
||||
'tx.operations.attachedTo',
|
||||
'objectSpace',
|
||||
{
|
||||
objectSpace: 1,
|
||||
_id: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+11
-3
@@ -35,7 +35,7 @@ import {
|
||||
TxRemoveDoc,
|
||||
TxUpdateDoc
|
||||
} from '@hcengineering/core'
|
||||
import { Index, Model } from '@hcengineering/model'
|
||||
import { Hidden, Index, Model, Prop, TypeRef } from '@hcengineering/model'
|
||||
import core from './component'
|
||||
import { TDoc } from './core'
|
||||
|
||||
@@ -43,7 +43,10 @@ import { TDoc } from './core'
|
||||
|
||||
@Model(core.class.Tx, core.class.Doc, DOMAIN_TX)
|
||||
export class TTx extends TDoc implements Tx {
|
||||
objectSpace!: Ref<Space>
|
||||
@Prop(TypeRef(core.class.Space), core.string.Space)
|
||||
@Index(IndexKind.Indexed)
|
||||
@Hidden()
|
||||
objectSpace!: Ref<Space>
|
||||
}
|
||||
|
||||
@Model(core.class.TxModelUpgrade, core.class.Tx, DOMAIN_TX)
|
||||
@@ -51,10 +54,15 @@ export class TTxModelUpgrade extends TTx {}
|
||||
|
||||
@Model(core.class.TxCUD, core.class.Tx)
|
||||
export class TTxCUD<T extends Doc> extends TTx implements TxCUD<T> {
|
||||
@Prop(TypeRef(core.class.Doc), core.string.Object)
|
||||
@Index(IndexKind.Indexed)
|
||||
@Hidden()
|
||||
objectId!: Ref<T>
|
||||
|
||||
objectClass!: Ref<Class<T>>
|
||||
@Prop(TypeRef(core.class.Class), core.string.ClassLabel)
|
||||
@Index(IndexKind.Indexed)
|
||||
@Hidden()
|
||||
objectClass!: Ref<Class<T>>
|
||||
}
|
||||
|
||||
@Model(core.class.TxCreateDoc, core.class.TxCUD)
|
||||
|
||||
Reference in New Issue
Block a user