1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-03 01:08:15 +09:00

Apply suggestions from code review

Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
皐月なふ (Nafu Satsuki) 2024-08-22 22:26:51 +09:00 committed by GitHub
parent 023b34df11
commit 4331d0bd43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -212,7 +212,7 @@ export class SearchService {
tags: note.tags,
};
await this.elasticsearch.index({
index: this.elasticsearchNoteIndex + `-${createdAt.toISOString().slice(0, 7).replace(/-/g, '')}` as string,
index: `${this.elasticsearchNoteIndex}-${createdAt.toISOString().slice(0, 7).replace(/-/g, '')}`,
id: note.id,
body: body,
}).catch((error) => {
@ -229,7 +229,7 @@ export class SearchService {
this.meilisearchNoteIndex!.deleteDocument(note.id);
} else if (this.elasticsearch) {
await this.elasticsearch.delete({
index: this.elasticsearchNoteIndex + `-${this.idService.parse(note.id).date.toISOString().slice(0, 7).replace(/-/g, '')}` as string,
index: `${this.elasticsearchNoteIndex}-${this.idService.parse(note.id).date.toISOString().slice(0, 7).replace(/-/g, '')}`,
id: note.id,
}).catch((error) => {
this.logger.error(error);