mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 01:10:17 +00:00
extract ObjectDDParticipantFunc (#4236)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
ac3fec3f35
commit
d80ca00f98
@ -14,27 +14,19 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { type Builder, Model, Mixin } from '@hcengineering/model'
|
||||
import { Mixin, Model, type Builder } from '@hcengineering/model'
|
||||
import { TClass, TDoc } from '@hcengineering/model-core'
|
||||
import type { Resource } from '@hcengineering/platform'
|
||||
|
||||
import core, {
|
||||
type Class,
|
||||
DOMAIN_MODEL,
|
||||
type Doc,
|
||||
type DocumentQuery,
|
||||
type FindOptions,
|
||||
type FindResult,
|
||||
type Hierarchy,
|
||||
type Ref
|
||||
} from '@hcengineering/core'
|
||||
import core, { DOMAIN_MODEL } from '@hcengineering/core'
|
||||
import type {
|
||||
ClassSearchConfig,
|
||||
ObjectDDParticipant,
|
||||
Trigger,
|
||||
TriggerFunc,
|
||||
ObjectDDParticipantFunc,
|
||||
SearchPresenter,
|
||||
SearchPresenterFunc,
|
||||
ClassSearchConfig
|
||||
Trigger,
|
||||
TriggerFunc
|
||||
} from '@hcengineering/server-core'
|
||||
import serverCore from '@hcengineering/server-core'
|
||||
|
||||
@ -47,17 +39,7 @@ export class TTrigger extends TDoc implements Trigger {
|
||||
|
||||
@Model(serverCore.mixin.ObjectDDParticipant, core.class.Class)
|
||||
export class TObjectDDParticipant extends TClass implements ObjectDDParticipant {
|
||||
collectDocs!: Resource<
|
||||
(
|
||||
doc: Doc,
|
||||
hiearachy: Hierarchy,
|
||||
findAll: <T extends Doc>(
|
||||
clazz: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
options?: FindOptions<T>
|
||||
) => Promise<FindResult<T>>
|
||||
) => Promise<Doc[]>
|
||||
>
|
||||
collectDocs!: Resource<ObjectDDParticipantFunc>
|
||||
}
|
||||
|
||||
@Mixin(serverCore.mixin.SearchPresenter, core.class.Class)
|
||||
|
@ -14,11 +14,10 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref } from '@hcengineering/core'
|
||||
import type { Plugin, Resource } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import type { ObjectDDParticipantFunc, TriggerFunc } from '@hcengineering/server-core'
|
||||
import { Presenter } from '@hcengineering/server-notification'
|
||||
import type { TriggerFunc } from '@hcengineering/server-core'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -32,17 +31,7 @@ export default plugin(serverCalendarId, {
|
||||
function: {
|
||||
ReminderHTMLPresenter: '' as Resource<Presenter>,
|
||||
ReminderTextPresenter: '' as Resource<Presenter>,
|
||||
FindReminders: '' as Resource<
|
||||
(
|
||||
doc: Doc,
|
||||
hiearachy: Hierarchy,
|
||||
findAll: <T extends Doc>(
|
||||
clazz: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
options?: FindOptions<T>
|
||||
) => Promise<FindResult<T>>
|
||||
) => Promise<Doc[]>
|
||||
>
|
||||
FindReminders: '' as Resource<ObjectDDParticipantFunc>
|
||||
},
|
||||
trigger: {
|
||||
OnPersonAccountCreate: '' as Resource<TriggerFunc>
|
||||
|
@ -13,11 +13,10 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref } from '@hcengineering/core'
|
||||
import type { Plugin, Resource } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import { TriggerFunc } from '@hcengineering/server-core'
|
||||
import { Presenter, TypeMatchFunc, NotificationContentProvider } from '@hcengineering/server-notification'
|
||||
import { ObjectDDParticipantFunc, TriggerFunc } from '@hcengineering/server-core'
|
||||
import { NotificationContentProvider, Presenter, TypeMatchFunc } from '@hcengineering/server-notification'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -34,17 +33,7 @@ export default plugin(serverChunterId, {
|
||||
OnMessageSent: '' as Resource<TriggerFunc>
|
||||
},
|
||||
function: {
|
||||
CommentRemove: '' as Resource<
|
||||
(
|
||||
doc: Doc,
|
||||
hiearachy: Hierarchy,
|
||||
findAll: <T extends Doc>(
|
||||
clazz: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
options?: FindOptions<T>
|
||||
) => Promise<FindResult<T>>
|
||||
) => Promise<Doc[]>
|
||||
>,
|
||||
CommentRemove: '' as Resource<ObjectDDParticipantFunc>,
|
||||
ChannelHTMLPresenter: '' as Resource<Presenter>,
|
||||
ChannelTextPresenter: '' as Resource<Presenter>,
|
||||
IsDirectMessage: '' as TypeMatchFunc,
|
||||
|
@ -14,11 +14,10 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref } from '@hcengineering/core'
|
||||
import type { Plugin, Resource } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import { ObjectDDParticipantFunc, TriggerFunc } from '@hcengineering/server-core'
|
||||
import { TypeMatchFunc } from '@hcengineering/server-notification'
|
||||
import { TriggerFunc } from '@hcengineering/server-core'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -34,16 +33,6 @@ export default plugin(serverGmailId, {
|
||||
},
|
||||
function: {
|
||||
IsIncomingMessage: '' as TypeMatchFunc,
|
||||
FindMessages: '' as Resource<
|
||||
(
|
||||
doc: Doc,
|
||||
hiearachy: Hierarchy,
|
||||
findAll: <T extends Doc>(
|
||||
clazz: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
options?: FindOptions<T>
|
||||
) => Promise<FindResult<T>>
|
||||
) => Promise<Doc[]>
|
||||
>
|
||||
FindMessages: '' as Resource<ObjectDDParticipantFunc>
|
||||
}
|
||||
})
|
||||
|
@ -13,10 +13,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Class, Doc, Hierarchy, Ref, FindResult, FindOptions, DocumentQuery } from '@hcengineering/core'
|
||||
import type { Plugin, Resource } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import { TriggerFunc } from '@hcengineering/server-core'
|
||||
import { ObjectDDParticipantFunc, TriggerFunc } from '@hcengineering/server-core'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -31,16 +30,6 @@ export default plugin(serverTagsId, {
|
||||
onTagReference: '' as Resource<TriggerFunc>
|
||||
},
|
||||
function: {
|
||||
TagElementRemove: '' as Resource<
|
||||
(
|
||||
doc: Doc,
|
||||
hiearachy: Hierarchy,
|
||||
findAll: <T extends Doc>(
|
||||
clazz: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
options?: FindOptions<T>
|
||||
) => Promise<FindResult<T>>
|
||||
) => Promise<Doc[]>
|
||||
>
|
||||
TagElementRemove: '' as Resource<ObjectDDParticipantFunc>
|
||||
}
|
||||
})
|
||||
|
@ -14,11 +14,10 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref } from '@hcengineering/core'
|
||||
import type { Plugin, Resource } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import { ObjectDDParticipantFunc, TriggerFunc } from '@hcengineering/server-core'
|
||||
import { TypeMatchFunc } from '@hcengineering/server-notification'
|
||||
import { TriggerFunc } from '@hcengineering/server-core'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -34,16 +33,6 @@ export default plugin(serverTelegramId, {
|
||||
},
|
||||
function: {
|
||||
IsIncomingMessage: '' as TypeMatchFunc,
|
||||
FindMessages: '' as Resource<
|
||||
(
|
||||
doc: Doc,
|
||||
hiearachy: Hierarchy,
|
||||
findAll: <T extends Doc>(
|
||||
clazz: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
options?: FindOptions<T>
|
||||
) => Promise<FindResult<T>>
|
||||
) => Promise<Doc[]>
|
||||
>
|
||||
FindMessages: '' as Resource<ObjectDDParticipantFunc>
|
||||
}
|
||||
})
|
||||
|
@ -27,6 +27,9 @@ import {
|
||||
ModelDb,
|
||||
Obj,
|
||||
Ref,
|
||||
SearchOptions,
|
||||
SearchQuery,
|
||||
SearchResult,
|
||||
ServerStorage,
|
||||
Space,
|
||||
Storage,
|
||||
@ -34,13 +37,10 @@ import {
|
||||
Tx,
|
||||
TxFactory,
|
||||
TxResult,
|
||||
WorkspaceId,
|
||||
SearchQuery,
|
||||
SearchOptions,
|
||||
SearchResult
|
||||
WorkspaceId
|
||||
} from '@hcengineering/core'
|
||||
import { MinioService } from '@hcengineering/minio'
|
||||
import type { Resource, Asset } from '@hcengineering/platform'
|
||||
import type { Asset, Resource } from '@hcengineering/platform'
|
||||
import { Readable } from 'stream'
|
||||
|
||||
/**
|
||||
@ -321,19 +321,19 @@ export interface WithFind {
|
||||
*/
|
||||
export interface ObjectDDParticipant extends Class<Obj> {
|
||||
// Collect more items to be deleted if parent document is deleted.
|
||||
collectDocs: Resource<
|
||||
(
|
||||
doc: Doc,
|
||||
hiearachy: Hierarchy,
|
||||
findAll: <T extends Doc>(
|
||||
clazz: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
options?: FindOptions<T>
|
||||
) => Promise<FindResult<T>>
|
||||
) => Promise<Doc[]>
|
||||
>
|
||||
collectDocs: Resource<ObjectDDParticipantFunc>
|
||||
}
|
||||
|
||||
export type ObjectDDParticipantFunc = (
|
||||
doc: Doc,
|
||||
hiearachy: Hierarchy,
|
||||
findAll: <T extends Doc>(
|
||||
clazz: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
options?: FindOptions<T>
|
||||
) => Promise<FindResult<T>>
|
||||
) => Promise<Doc[]>
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user