diff --git a/models/lead/src/index.ts b/models/lead/src/index.ts index 9cf27750b3..ab1bcb40c9 100644 --- a/models/lead/src/index.ts +++ b/models/lead/src/index.ts @@ -134,7 +134,7 @@ export function createModel (builder: Builder): void { const leadLookup: Lookup = { - attachedTo: [contact.class.Contact, { _id: { channels: contact.class.Channel } }], + attachedTo: [contact.class.Contact, { _id: { channels: lead.mixin.Customer } }], state: task.class.State } @@ -161,9 +161,11 @@ export function createModel (builder: Builder): void { descriptor: task.viewlet.Kanban, // eslint-disable-next-line @typescript-eslint/consistent-type-assertions options: { - lookup: leadLookup + lookup: { + attachedTo: lead.mixin.Customer + } } as FindOptions, // TODO: fix - config: ['$lookup.customer', '$lookup.state'] + config: [] }) builder.mixin(lead.class.Lead, core.class.Class, task.mixin.KanbanCard, { diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 004dcdf2eb..a686a89605 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -210,8 +210,8 @@ export function createModel (builder: Builder): void { const applicantKanbanLookup: Lookup = { - attachedTo: [recruit.mixin.Candidate, { _id: { channels: contact.class.Channel } }], - state: task.class.State + attachedTo: recruit.mixin.Candidate, + assignee: contact.class.Employee } builder.createDoc(view.class.Viewlet, core.space.Model, { @@ -221,7 +221,7 @@ export function createModel (builder: Builder): void { options: { lookup: applicantKanbanLookup } as FindOptions, // TODO: fix - config: ['$lookup.attachedTo', '$lookup.state', '$lookup.attachedTo.city', '$lookup.attachedTo.$lookup.channels'] + config: [] }) builder.createDoc(view.class.Viewlet, core.space.Model, { diff --git a/models/task/src/index.ts b/models/task/src/index.ts index 738333b9be..4e86739642 100644 --- a/models/task/src/index.ts +++ b/models/task/src/index.ts @@ -317,15 +317,10 @@ export function createModel (builder: Builder): void { // eslint-disable-next-line @typescript-eslint/consistent-type-assertions options: { lookup: { - state: task.class.State, assignee: contact.class.Employee } } as FindOptions, // TODO: fix - config: [ - // '$lookup.attachedTo', - '$lookup.state', - '$lookup.assignee' - ] + config: [] }) builder.mixin(task.class.Issue, core.class.Class, task.mixin.KanbanCard, { diff --git a/packages/core/src/storage.ts b/packages/core/src/storage.ts index 11bb73f74b..998ea33b48 100644 --- a/packages/core/src/storage.ts +++ b/packages/core/src/storage.ts @@ -115,20 +115,13 @@ export enum SortingOrder { * @public */ export type RefsAsDocs = { - [P in keyof T]: T[P] extends Ref ? (T extends X ? X : X | WithLookup) : never + [P in keyof T]: T[P] extends Ref | null ? (T extends X ? X : X | WithLookup) : AttachedDoc[] } /** * @public */ -export type RemoveNever = Omit> - -/** - * @public - */ -export type LookupData = Partial>> | RemoveNever<{ - [key: string]: Doc[] -}> +export type LookupData = Partial> /** * @public diff --git a/plugins/lead-resources/src/components/KanbanCard.svelte b/plugins/lead-resources/src/components/KanbanCard.svelte index bb909dc169..0fee4c9e79 100644 --- a/plugins/lead-resources/src/components/KanbanCard.svelte +++ b/plugins/lead-resources/src/components/KanbanCard.svelte @@ -45,8 +45,8 @@
- {#if object.$lookup?.customer} - + {#if object.$lookup?.attachedTo} + {/if}
{#if (object.attachments ?? 0) > 0} diff --git a/plugins/recruit-resources/src/components/KanbanCard.svelte b/plugins/recruit-resources/src/components/KanbanCard.svelte index b27d9b7bd6..b44bcce8fd 100644 --- a/plugins/recruit-resources/src/components/KanbanCard.svelte +++ b/plugins/recruit-resources/src/components/KanbanCard.svelte @@ -54,7 +54,7 @@
{/if}
- +
diff --git a/plugins/task-resources/src/components/KanbanCard.svelte b/plugins/task-resources/src/components/KanbanCard.svelte index ec67147f18..afac3b80ad 100644 --- a/plugins/task-resources/src/components/KanbanCard.svelte +++ b/plugins/task-resources/src/components/KanbanCard.svelte @@ -47,9 +47,8 @@
{/if} - {#if object.$lookup} - - + {#if object.$lookup?.assignee} + {/if}