260326:1347 Fixing Refactor ADR-019 Naming convention uuid #01
CI / CD Pipeline / build (push) Failing after 17m29s
CI / CD Pipeline / deploy (push) Has been skipped

This commit is contained in:
admin
2026-03-26 13:47:07 +07:00
parent 978d66e49e
commit 1aff83214f
34 changed files with 217 additions and 222 deletions
+8 -2
View File
@@ -73,12 +73,18 @@ export class SearchService implements OnModuleInit {
* Index เอกสาร (Create/Update)
*/
async indexDocument(
doc: Record<string, unknown> & { type: string; id?: number; uuid?: string }
doc: Record<string, unknown> & {
type: string;
id?: number;
publicId?: string;
}
) {
try {
return await this.esService.index({
index: this.indexName,
id: doc.uuid ? `${doc.type}_${doc.uuid}` : `${doc.type}_${doc.id}`, // ADR-019: prefer UUID key
id: doc.publicId
? `${doc.type}_${doc.publicId}`
: `${doc.type}_${doc.id}`, // ADR-019: prefer publicId key
document: doc, // ✅ Library รุ่นใหม่ใช้ 'document' แทน 'body' ในบางเวอร์ชัน
});
} catch (error) {