From 586827e03a50d2ed864a531ae339f247c2a41ca6 Mon Sep 17 00:00:00 2001 From: Eunhak Lee <lee@enak.kr> Date: Sun, 8 Dec 2024 02:14:45 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20uuid=EB=A1=9C=20=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?=EC=A1=B0=ED=95=A9=20=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/parts.js | 9 +++++++++ src/services/partService.js | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/routes/parts.js b/src/routes/parts.js index f8d6d9a..e456151 100644 --- a/src/routes/parts.js +++ b/src/routes/parts.js @@ -52,4 +52,13 @@ partRouter.get( }) ); +partRouter.get( + '/combination/by-uuid/:uuid', + wrapAsync(async (req, res) => { + const { uuid } = req.params; + const info = await PartService.getCombinationByUuid(uuid); + return res.sendResponse('', 200, { ...info }); + }) +); + export default partRouter; diff --git a/src/services/partService.js b/src/services/partService.js index 2a9c553..642ff21 100644 --- a/src/services/partService.js +++ b/src/services/partService.js @@ -1,6 +1,7 @@ import { columnMapping } from '../constants/columnMapping.js'; import { ReportableError } from '../errors.js'; import PartRepository from '../repositories/partRepository.js'; +import ShareRepository from '../repositories/shareRepository.js'; const PartService = { cleanEntity(entity) { @@ -108,6 +109,14 @@ const PartService = { partIds: combination.partids, })); }, + + async getCombinationByUuid(uuid) { + if (!uuid) throw new ReportableError(400, '올바르지 않은 요청입니다.'); + + const { combination_id, parts, created_at, updated_at } = + await ShareRepository.getCombinationByUuid(uuid); + return { combination_id, parts, created_at, updated_at }; + }, }; export default PartService; -- GitLab