Fix List Category requests (#3938)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-11-04 00:00:43 +07:00 committed by GitHub
parent 66915d29e3
commit 7872a460e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 8 deletions

View File

@ -707,7 +707,7 @@ export function createModel (builder: Builder): void {
label: recruit.string.HideArchivedVacancies label: recruit.string.HideArchivedVacancies
} }
const applicantViewOptions = (colors: boolean): ViewOptionsModel => { const applicantViewOptions = (colors: boolean, hides: boolean): ViewOptionsModel => {
const model: ViewOptionsModel = { const model: ViewOptionsModel = {
groupBy: ['status', 'assignee', 'space', 'createdBy', 'modifiedBy'], groupBy: ['status', 'assignee', 'space', 'createdBy', 'modifiedBy'],
orderBy: [ orderBy: [
@ -725,14 +725,15 @@ export function createModel (builder: Builder): void {
actionTarget: 'category', actionTarget: 'category',
action: view.function.ShowEmptyGroups, action: view.function.ShowEmptyGroups,
label: view.string.ShowEmptyGroups label: view.string.ShowEmptyGroups
}, }
applicationDoneOption,
vacancyHideOption
] ]
} }
if (colors) { if (colors) {
model.other.push(showColorsViewOption) model.other.push(showColorsViewOption)
} }
if (hides) {
model.other.push(...[applicationDoneOption, vacancyHideOption])
}
return model return model
} }
@ -810,7 +811,7 @@ export function createModel (builder: Builder): void {
strict: true, strict: true,
hiddenKeys: ['name', 'attachedTo'] hiddenKeys: ['name', 'attachedTo']
}, },
viewOptions: applicantViewOptions(true) viewOptions: applicantViewOptions(true, true)
}, },
recruit.viewlet.ListApplicant recruit.viewlet.ListApplicant
) )
@ -977,8 +978,12 @@ export function createModel (builder: Builder): void {
attachTo: recruit.class.Applicant, attachTo: recruit.class.Applicant,
descriptor: task.viewlet.Kanban, descriptor: task.viewlet.Kanban,
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
baseQuery: {
isDone: { $ne: true },
'$lookup.space.archived': false
},
viewOptions: { viewOptions: {
...applicantViewOptions(false), ...applicantViewOptions(false, false),
groupDepth: 1 groupDepth: 1
}, },
options: { options: {

View File

@ -59,7 +59,7 @@
let resultQuery: DocumentQuery<Doc> = query let resultQuery: DocumentQuery<Doc> = query
$: getResultQuery(query, viewOptionsConfig, viewOptions).then((p) => { $: getResultQuery(query, viewOptionsConfig, viewOptions).then((p) => {
resultQuery = { ...p, ...query } resultQuery = { ...query, ...p }
}) })
$: queryNoLookup = noLookup(resultQuery) $: queryNoLookup = noLookup(resultQuery)
@ -68,7 +68,7 @@
let categoryQueryOptions: Partial<FindOptions<Doc>> let categoryQueryOptions: Partial<FindOptions<Doc>>
$: categoryQueryOptions = { $: categoryQueryOptions = {
...resultOptions, ...noLookupOptions(resultOptions),
projection: { projection: {
...resultOptions.projection, ...resultOptions.projection,
_id: 1, _id: 1,
@ -132,6 +132,11 @@
return newQuery return newQuery
} }
function noLookupOptions (options: FindOptions<Doc>): FindOptions<Doc> {
const { lookup, ...resultOptions } = options
return resultOptions
}
$: dispatch('content', docs) $: dispatch('content', docs)
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()