Skip to content

Commit

Permalink
fix: 데이터 동기화 dto 수정 #203
Browse files Browse the repository at this point in the history
  • Loading branch information
koomchang committed Nov 28, 2024
1 parent b0d2b45 commit 82d6e3a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
10 changes: 10 additions & 0 deletions backend/src/repl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { repl } from '@nestjs/core';
import { AppModule } from '@src/app.module';
import { initializeTransactionalContext } from 'typeorm-transactional';

async function bootstrap() {
await repl(AppModule);
}

initializeTransactionalContext();
bootstrap();
20 changes: 19 additions & 1 deletion backend/src/search/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,27 @@ export class SearchService {
const bulkOperations = [];

places.forEach((place: Place) => {
const esPlaceDto = {
id: place.id,
name: place.name,
location: {
lat: place.latitude,
lon: place.longitude,
},
googlePlaceId: place.googlePlaceId,
category: place.category,
description: place.description,
detailPageUrl: place.detailPageUrl,
thumbnailUrl: place.thumbnailUrl,
rating: place.rating,
formattedAddress: place.formattedAddress,
createdAt: place.createdAt.toISOString(),
updatedAt: place.updatedAt.toISOString(),
deletedAt: place.deletedAt?.toISOString() || null,
};
bulkOperations.push(
{ update: { _index: ElasticSearchConfig.PLACE_INDEX, _id: place.id } },
{ doc: place, doc_as_upsert: true },
{ doc: esPlaceDto, doc_as_upsert: true },
);
});

Expand Down

0 comments on commit 82d6e3a

Please sign in to comment.