From c0ada6344bbdece093b339874b813b6115c7aedc Mon Sep 17 00:00:00 2001 From: Hyeongmin Jo Date: Mon, 6 Jan 2025 14:15:06 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20investment=20=ED=85=8C=EC=9D=B4=EB=B8=94?= =?UTF-8?q?=EC=97=90=20'=ED=88=AC=EC=9E=90=EC=9E=90=20=EC=9D=B4=EB=A6=84'?= =?UTF-8?q?=20=EC=86=8D=EC=84=B1=20=EC=B6=94=EA=B0=80=20-=20name=20String?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=ED=95=98=EC=98=80=EC=9D=8C=20-=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20=EB=B0=A9=EB=B2=95=20=20=20-=20git=20pull?= =?UTF-8?q?=20upstream=20dev=20=20=20-=20npx=20prisma=20migrate=20dev=20?= =?UTF-8?q?=20=20-=20=EC=B4=88=EA=B8=B0=ED=99=94=ED=95=98=EA=B2=A0?= =?UTF-8?q?=EB=83=90=EA=B3=A0=20=EB=AC=BC=EC=96=B4=EB=B3=B4=EB=A9=B4=20?= =?UTF-8?q?=ED=95=98=EC=84=B8=EC=9A=94=20=20=20-=20migration=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=EC=9D=80=20init=EC=9C=BC=EB=A1=9C=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=ED=95=98=EC=84=B8=EC=9A=94=20=20=20-=20npx=20prisma?= =?UTF-8?q?=20db=20seed=20=20=20-=20seed=20=EC=84=B1=EA=B3=B5=20=EB=A9=94?= =?UTF-8?q?=EC=8B=9C=EC=A7=80=20=ED=99=95=EC=9D=B8=20=ED=9B=84=20=20=20-?= =?UTF-8?q?=20npx=20prisma=20studio=20=EC=8B=A4=ED=96=89=ED=95=98=EC=97=AC?= =?UTF-8?q?=20=ED=99=95=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/mock.js | 7 +++++++ src/routes/getCompany_jhm.js | 17 ++++++++++++++++- structs.js | 10 +++++++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/data/mock.js b/src/data/mock.js index 49ed415..8e3f844 100644 --- a/src/data/mock.js +++ b/src/data/mock.js @@ -375,6 +375,7 @@ export const COMPANIES = [ export const INVESTMENTS = [ { id: '9416b954-5fa1-464e-972c-6b39f5200b62', + name: '투자자A', userId: 'a98f5413-04c9-47e9-80cf-dd00cdf8090c', companyId: 'f700fba6-627b-41b8-86e6-ec6aaa2d2020', amount: 50000000, @@ -385,6 +386,7 @@ export const INVESTMENTS = [ }, { id: '61340461-d2ac-4ef1-a0c4-f7c6928a9d8c', + name: '투자자B', userId: '1ef3627b-ea92-4c9e-8562-ea7b27a49a0a', companyId: '0e72d625-933c-4ba6-9aa3-69c31e4ed836', amount: 50000000, @@ -395,6 +397,7 @@ export const INVESTMENTS = [ }, { id: '811c7f7a-8b3d-450e-914a-bf5e2fd70ca2', + name: '투자자B', userId: '1ef3627b-ea92-4c9e-8562-ea7b27a49a0a', companyId: '3542fe00-5f5b-4572-8011-e2d27cf70350', amount: 10000000, @@ -405,6 +408,7 @@ export const INVESTMENTS = [ }, { id: '11594a3f-4e3b-4b44-9f2a-2611f378e5b0', + name: '투자자C', userId: '5d8844dc-0c2d-40bc-8710-e54e662b4b1f', companyId: '773e9e43-6e4a-44a9-9064-34b5db84f6d1', amount: 100000000, @@ -416,6 +420,7 @@ export const INVESTMENTS = [ }, { id: 'c472119a-14a9-42ea-8782-f8a5de19e5b2', + name: '투자자D', userId: '5645d9f6-cb2d-4004-a522-5909d1592662', companyId: 'db1a0353-8e84-476c-9b52-53df166a3503', amount: 100000000, @@ -427,6 +432,7 @@ export const INVESTMENTS = [ }, { id: 'e32a0585-d8ce-43d7-95ef-6d36a0656b02', + name: '투자자E', userId: 'fca6ef85-02ba-4868-a7b7-4f49ed16e881', companyId: '9b43d01f-6e70-431d-a852-cc30ba51c4d57', amount: 30000000, @@ -437,6 +443,7 @@ export const INVESTMENTS = [ }, { id: '69534aad-54ce-41ec-8017-f9f31a6764f9', + name: '투자자E', userId: 'fca6ef85-02ba-4868-a7b7-4f49ed16e881', companyId: '1c0d70dd-677e-46bc-a863-b746e5e1ff8c', amount: 2000000, diff --git a/src/routes/getCompany_jhm.js b/src/routes/getCompany_jhm.js index 8b9428b..a9deefc 100644 --- a/src/routes/getCompany_jhm.js +++ b/src/routes/getCompany_jhm.js @@ -15,7 +15,22 @@ router.get( '/companies/:id', asyncHandler(async (req, res) => { const { id } = req.params; - const company = await prisma.company.findUniqueOrThrow({ where: { id } }); + const company = await prisma.company.findUniqueOrThrow({ + where: { id }, + select: { + id: true, + name: true, + imageUrl: true, + description: true, + category: true, + actualInvest: true, + simInvest: true, + revenue: true, + employeesCount: true, + mySelectionCount: true, + compareSelectionCount: true, + }, + }); res.send(convertToBigIntFromObject(company)); }) ); diff --git a/structs.js b/structs.js index 4b99772..4562fb6 100644 --- a/structs.js +++ b/structs.js @@ -1,7 +1,14 @@ import * as s from 'superstruct'; import isUuid from 'is-uuid'; -const CATEGORIES = ['EDUTECH', 'FASHION', 'PET', 'ENVIRONMENT', 'FINTECH', 'TRAVEL']; +const CATEGORIES = [ + 'EDUTECH', + 'FASHION', + 'PET', + 'ENVIRONMENT', + 'FINTECH', + 'TRAVEL', +]; const Uuid = s.define('Uuid', (value) => isUuid.v4(value)); @@ -27,6 +34,7 @@ export const PatchCompany = s.partial(CreateCompany); export const CreateInvestment = s.object({ userId: Uuid, + name: s.size(s.string(), 1, 20), companyID: Uuid, amount: s.min(s.integer(), 0), comment: s.size(s.string(), 1, 200),