diff --git a/src/routes/parts.js b/src/routes/parts.js index f8d6d9ac1f616986ac636b76b9abab7a8ddd5c2e..e456151903b682ac6a6881cee59dc518739aac6e 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 2a9c553afef474cb422491aa174a3b0c932b75db..642ff21fb34a7044e5cb0c728f977d77ce605c89 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;