fix: 为hook/endpoint补全条目状态过滤机制

This commit is contained in:
2025-12-05 08:02:20 +00:00
parent c16818a6bb
commit 4c74530165
2 changed files with 46 additions and 10 deletions

View File

@ -131,7 +131,16 @@ export default defineEndpoint({
const queryFields = buildQueryFields(fields); const queryFields = buildQueryFields(fields);
const itemService = new ItemsService(cfg.collection_name, { schema }); const itemService = new ItemsService(cfg.collection_name, { schema });
const items = await itemService.readByQuery({ fields: queryFields, limit: -1 }); const items = await itemService.readByQuery({
fields: queryFields,
filter: {
_or: [
{ status: { _neq: 'archived' } },
{ status: { _null: true } }
]
},
limit: -1,
});
// 为每种语言重建索引 // 为每种语言重建索引
for (const lang of availableLanguages) { for (const lang of availableLanguages) {

View File

@ -161,8 +161,8 @@ export default defineHook(async ({ init, filter, action, schedule }, { services,
fields: queryFields, fields: queryFields,
filter: { filter: {
_or: [ _or: [
{ status: { _null: true }}, { status: { _neq: 'archived' } },
{ status: { _neq: 'archived'}}, { status: { _null: true } },
] ]
}, },
limit: -1 limit: -1
@ -238,7 +238,16 @@ export default defineHook(async ({ init, filter, action, schedule }, { services,
const queryFields = buildQueryFields(fields); const queryFields = buildQueryFields(fields);
const itemService = new ItemsService(cfg.collection_name, { schema }); const itemService = new ItemsService(cfg.collection_name, { schema });
const items = await itemService.readByQuery({ fields: queryFields, limit: -1 }); const items = await itemService.readByQuery({
fields: queryFields,
filter: {
_or: [
{ status: { _neq: 'archived' } },
{ status: { _null: true } },
]
},
limit: -1
});
// 为每种语言重建索引 // 为每种语言重建索引
for (const lang of availableLanguages) { for (const lang of availableLanguages) {
@ -310,7 +319,16 @@ export default defineHook(async ({ init, filter, action, schedule }, { services,
const queryFields = buildQueryFields(fields); const queryFields = buildQueryFields(fields);
const itemService = new ItemsService(cfg.collection_name, { schema }); const itemService = new ItemsService(cfg.collection_name, { schema });
const items = await itemService.readByQuery({ fields: queryFields, limit: -1 }); const items = await itemService.readByQuery({
fields: queryFields,
filter: {
_or: [
{ status: { _neq: 'archived' } },
{ status: { _null: true } },
]
},
limit: -1
});
// 为每种语言重建索引 // 为每种语言重建索引
for (const lang of availableLanguages) { for (const lang of availableLanguages) {
@ -386,7 +404,16 @@ export default defineHook(async ({ init, filter, action, schedule }, { services,
const queryFields = buildQueryFields(fields); const queryFields = buildQueryFields(fields);
const itemService = new ItemsService(cfg.collection_name, { schema }); const itemService = new ItemsService(cfg.collection_name, { schema });
const items = await itemService.readByQuery({ fields: queryFields, limit: -1 }); const items = await itemService.readByQuery({
fields: queryFields,
filter: {
_or: [
{ status: { _neq: 'archived' } },
{ status: { _null: true } },
]
},
limit: -1
});
// 为每种语言重建索引 // 为每种语言重建索引
for (const lang of availableLanguages) { for (const lang of availableLanguages) {