From 74f76a47b3d72e120a3e2ce69eeff824619d73f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=9A=B0?= <83938394+yunuo46@users.noreply.github.com> Date: Mon, 11 Dec 2023 10:46:15 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20save=20=ED=8A=B8=EB=9E=9C=EC=9E=AD?= =?UTF-8?q?=EC=85=98=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/package-lock.json | 11 +++++++++ back/package.json | 1 + back/src/modules/message/message.service.ts | 23 ++++++++----------- back/src/modules/snowball/snowball.service.ts | 5 +++- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/back/package-lock.json b/back/package-lock.json index 75bd631..30a1319 100644 --- a/back/package-lock.json +++ b/back/package-lock.json @@ -25,6 +25,7 @@ "class-validator": "^0.14.0", "dotenv": "^16.3.1", "express-basic-auth": "^1.2.1", + "k6": "^0.0.0", "mysql2": "^3.6.3", "passport": "^0.6.0", "passport-facebook": "^3.0.0", @@ -7095,6 +7096,11 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/k6": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/k6/-/k6-0.0.0.tgz", + "integrity": "sha512-GAQSWayS2+LjbH5bkRi+pMPYyP1JSp7o+4j58ANZ762N/RH/SdlAT3CHHztnn8s/xgg8kYNM24Gd2IPo9b5W+g==" + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -16202,6 +16208,11 @@ "safe-buffer": "^5.0.1" } }, + "k6": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/k6/-/k6-0.0.0.tgz", + "integrity": "sha512-GAQSWayS2+LjbH5bkRi+pMPYyP1JSp7o+4j58ANZ762N/RH/SdlAT3CHHztnn8s/xgg8kYNM24Gd2IPo9b5W+g==" + }, "keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", diff --git a/back/package.json b/back/package.json index e3372f5..bc39b1a 100644 --- a/back/package.json +++ b/back/package.json @@ -36,6 +36,7 @@ "class-validator": "^0.14.0", "dotenv": "^16.3.1", "express-basic-auth": "^1.2.1", + "k6": "^0.0.0", "mysql2": "^3.6.3", "passport": "^0.6.0", "passport-facebook": "^3.0.0", diff --git a/back/src/modules/message/message.service.ts b/back/src/modules/message/message.service.ts index 65c4ddc..24a7ba2 100644 --- a/back/src/modules/message/message.service.ts +++ b/back/src/modules/message/message.service.ts @@ -56,24 +56,21 @@ export class MessageService { ...createMessageDto }); try { - await this.messageRepository.save(messageEntity, { - transaction: false, - reload: false + const resCreateMessage = await this.messageRepository.save( + messageEntity, + { + transaction: false, + reload: false + } + ); + console.log(resCreateMessage); + return plainToInstance(ResCreateMessageDto, resCreateMessage, { + excludeExtraneousValues: true }); } catch (err) { console.log(err); throw new BadRequestException('Insert Fail'); } - - const resCreateMessage = { - ...createMessageDto, - ...resClovaSentiment, - location: location - }; - - return plainToInstance(ResCreateMessageDto, resCreateMessage, { - excludeExtraneousValues: true - }); } async isInsertAllowed(snowball_id: number): Promise { diff --git a/back/src/modules/snowball/snowball.service.ts b/back/src/modules/snowball/snowball.service.ts index 09dc896..ac8deb8 100644 --- a/back/src/modules/snowball/snowball.service.ts +++ b/back/src/modules/snowball/snowball.service.ts @@ -49,7 +49,10 @@ export class SnowballService { ...createSnowballDto }); - const savedSnowballEntity = await this.snowballRepository.save(snowball); + const savedSnowballEntity = await this.snowballRepository.save(snowball, { + reload: false, + transaction: false + }); const savedSnowball = instanceToPlain(savedSnowballEntity); const combinedSnowballDto = {