From 6952c225c964fef7159447a2595165f0a024a808 Mon Sep 17 00:00:00 2001 From: sprint-edu Date: Mon, 13 Jan 2025 17:47:50 +0900 Subject: [PATCH 01/16] docs: update readme --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..1d466372 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# ๐Ÿผ ํŒ๋‹ค๋งˆ์ผ“ ํ”„๋กœ์ ํŠธ + +> _์ด ์ €์žฅ์†Œ๋Š” ํŒ๋‹ค๋งˆ์ผ“ ํ”„๋กœ์ ํŠธ์˜ ๋ฐฑ์—”๋“œ ์ฝ”๋“œ๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๊ณณ์ž…๋‹ˆ๋‹ค. ํ”„๋กœ์ ํŠธ๋ฅผ ํด๋ก ํ•˜์—ฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ์„ค์ •ํ•˜๊ณ , ๊ฐ ๋ธŒ๋žœ์น˜์—์„œ ํ•ด๋‹น ์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜์„ ์ˆ˜ํ–‰ํ•ด ์ฃผ์„ธ์š”!_ ๐Ÿ› ๏ธ + +## ์†Œ๊ฐœ + +์•ˆ๋…•ํ•˜์„ธ์š”! ํŒ๋‹ค๋งˆ์ผ“ ํ”„๋กœ์ ํŠธ์— ์˜ค์‹  ๊ฒƒ์„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค! ๐Ÿฅณ +ํŒ๋‹ค๋งˆ์ผ“์€ ๋”ฐ๋œปํ•œ ์ค‘๊ณ ๊ฑฐ๋ž˜๋ฅผ ์œ„ํ•œ ์ปค๋ฎค๋‹ˆํ‹ฐ ํ”Œ๋žซํผ์ด์—์š”. ์—ฌ๋Ÿฌ๋ถ„์€ ์ด๊ณณ์—์„œ ์ƒํ’ˆ์„ ๋“ฑ๋กํ•˜๊ณ , ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž๋“ค๊ณผ ์†Œํ†ตํ•˜๋ฉฐ, ์ž์œ ๋กญ๊ฒŒ ์ด์•ผ๊ธฐ๋ฅผ ๋‚˜๋ˆŒ ์ˆ˜ ์žˆ์–ด์š”. ๋งค์ฃผ ์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜์„ ํ†ตํ•ด ๊ธฐ๋Šฅ์„ ํ•˜๋‚˜์”ฉ ๋งŒ๋“ค์–ด ๊ฐ€๋ฉฐ ์„ฑ์žฅํ•ด ๋‚˜๊ฐ€๋Š” ์—ฌ์ •์„ ํ•จ๊ป˜ํ•ด์š”. ๐Ÿš€ + +![PandaMarket](https://github.com/user-attachments/assets/3784b99f-73c9-4349-a9a9-92b2a7563574) +_์œ„ ์ด๋ฏธ์ง€๋Š” ํŒ๋‹ค๋งˆ์ผ“์˜ ๋Œ€ํ‘œ ์ด๋ฏธ์ง€์ž…๋‹ˆ๋‹ค. ํ”„๋กœ์ ํŠธ๊ฐ€ ์ง„ํ–‰๋จ์— ๋”ฐ๋ผ ๋” ๋งŽ์€ ์ด๋ฏธ์ง€๋ฅผ ์ถ”๊ฐ€ํ•  ์˜ˆ์ •์ด์—์š”!_ ๐Ÿ“ธ + +## ์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜์ด๋ž€? ๐Ÿค” + +์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜์€ **ํ•˜๋‚˜์˜ ๊ฐœ์ธ ํ”„๋กœ์ ํŠธ๋ฅผ ๊ธธ๊ฒŒ ์ง„ํ–‰ํ•˜๋ฉด์„œ, ๊ทธ ๊ณผ์ •์—์„œ ์ฃผ๊ธฐ์ ์œผ๋กœ ํ”ผ๋“œ๋ฐฑ์„ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” ์‹œ์Šคํ…œ**์ด์—์š”. ๊ฐ ์Šคํ”„๋ฆฐํŠธ๋งˆ๋‹ค ๋ฐฐ์šด ์ด๋ก ์„ ์ ์šฉํ•ด ๋ณด๊ณ , **๋ฉ˜ํ† ๋‹˜๊ป˜ ์ฝ”๋“œ ๋ฆฌ๋ทฐ๋ฅผ ๋ฐ›์•„๊ฐ€๋ฉฐ ์‹ค๋ ฅ์„ ์‘ฅ์‘ฅ ํ‚ค์›Œ๊ฐˆ ์ˆ˜ ์žˆ๋Š” ์ค‘์š”ํ•œ ๊ฐœ์ธ ๊ณผ์ œ**๋ž๋‹ˆ๋‹ค. ๐Ÿ’ช + +## ์ฃผ์š” ๊ธฐ๋Šฅ โœจ + +1. **์ƒํ’ˆ ๋“ฑ๋ก**: ๋‚ด๊ฐ€ ๊ฐ€์ง„ ๋ฌผ๊ฑด์„ ์˜ฌ๋ฆฌ๊ณ , ์‚ฌ์ง„๊ณผ ์„ค๋ช…์„ ์ถ”๊ฐ€ํ•ด ์ง์ ‘ ํŒ๋งคํ•  ์ˆ˜ ์žˆ์–ด์š”! +2. **๋ฌธ์˜ ๋Œ“๊ธ€**: ์ƒํ’ˆ์— ๋Œ€ํ•œ ๊ถ๊ธˆํ•œ ์ ์ด๋‚˜ ์˜๊ฒฌ์„ ์ž์œ ๋กญ๊ฒŒ ๋‚จ๊ธธ ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค. ๐Ÿ“ +3. **์ž์œ ๊ฒŒ์‹œํŒ**: ๋‹ค์–‘ํ•œ ์ฃผ์ œ๋กœ ์นœ๊ตฌ๋“ค๊ณผ ์ด์•ผ๊ธฐ๋ฅผ ๋‚˜๋ˆ„๊ณ , ์ •๋ณด๋ฅผ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ณต๊ฐ„์ด์—์š”! ๐Ÿ—ฃ๏ธ + +## ํ”„๋กœ์ ํŠธ ๋ธŒ๋žœ์น˜ ๊ตฌ์กฐ ๐Ÿ—๏ธ + +ํ”„๋กœ์ ํŠธ๋Š” ๋‹จ๊ณ„๋ณ„๋กœ ๋‚˜๋‰˜์–ด ์žˆ๊ณ , ๊ฐ ์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜์— ๋งž๋Š” ๋ธŒ๋žœ์น˜๊ฐ€ ์žˆ์–ด์š”. ๊ฐ ๋ธŒ๋žœ์น˜๋ฅผ ํ†ตํ•ด ์ฒด๊ณ„์ ์œผ๋กœ ๊ฐœ๋ฐœํ•˜๋ฉฐ ํ•™์Šตํ•  ์ˆ˜ ์žˆ์–ด์š”. ๐ŸŽฏ + +### ๋ธŒ๋žœ์น˜ ์„ค๋ช… + +1. **node (part1): ์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜ 4์˜ BE ์š”๊ตฌ์‚ฌํ•ญ** + + - ๋ฐฑ์—”๋“œ ์„œ๋ฒ„ ์„ค์ •๊ณผ ๊ฐ„๋‹จํ•œ API ๊ตฌํ˜„์„ ์œ„ํ•œ Express.js ํ”„๋กœ์ ํŠธ์˜ ์ดˆ๊ธฐ ์„ธํŒ…์ด ํฌํ•จ๋ผ์š”. + - **์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜ 4**์˜ ๋ฐฑ์—”๋“œ ๋‚ด์šฉ์ด ํฌํ•จ๋ผ ์žˆ์–ด์š”. + +2. **express (part2~4): ์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜ 6 ~ 12์˜ BE ์š”๊ตฌ์‚ฌํ•ญ** + - Express.js๋ฅผ ์ด์šฉํ•ด ๋” ๋ณต์žกํ•œ ๋ฐฑ์—”๋“œ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๋Š” ๋ฏธ์…˜์ž…๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๋™, ์ธ์ฆ ๋ฐ ๊ถŒํ•œ ๊ด€๋ฆฌ ๋“ฑ ๊ณ ๊ธ‰ API ์„ค๊ณ„๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. + - **์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜ 6๋ถ€ํ„ฐ 12๊นŒ์ง€**์˜ ๋ฐฑ์—”๋“œ ๋‚ด์šฉ์ด ๋“ค์–ด ์žˆ์–ด์š”. + +> _์Šคํ”„๋ฆฐํŠธ ๋ฏธ์…˜ ๋‚ด ํ”„๋ก ํŠธ์—”๋“œ ์š”๊ตฌ์‚ฌํ•ญ์€ [ํ”„๋ก ํŠธ์—”๋“œ ๋ ˆํฌ์ง€ํ† ๋ฆฌ](https://github.com/codeit-sprint-fullstack/6-Sprint-mission-FE)์˜ ๋ธŒ๋žœ์น˜์—์„œ ๊ด€๋ฆฌํ•ด์ฃผ์„ธ์š”_ + +--- + +๋ณธ ํ”„๋กœ์ ํŠธ๋Š” [์ฝ”๋“œ์ž‡](https://www.codeit.kr)์˜ ์†Œ์œ ์ด๋ฉฐ, ๊ต์œก ๋ชฉ์ ์œผ๋กœ๋งŒ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ยฉ 2024 Codeit. All rights reserved. From 108e0f3f2721d857bd0ee1b88a3e2970a3863e1d Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:32:47 +0900 Subject: [PATCH 02/16] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8/?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/authController.js | 74 ++++++++++++++++++++++++++ src/middlewares/auth.js | 55 ++++++++++++++++++++ src/routes/authRouter.js | 22 ++++++++ src/services/authService.js | 86 +++++++++++++++++++++++++++++++ src/utils/jwtUtils.js | 11 ++++ 5 files changed, 248 insertions(+) create mode 100644 src/controllers/authController.js create mode 100644 src/middlewares/auth.js create mode 100644 src/routes/authRouter.js create mode 100644 src/services/authService.js create mode 100644 src/utils/jwtUtils.js diff --git a/src/controllers/authController.js b/src/controllers/authController.js new file mode 100644 index 00000000..ba615c31 --- /dev/null +++ b/src/controllers/authController.js @@ -0,0 +1,74 @@ +import authService from "../services/authService.js"; +import { generateAccessToken, generateRefreshToken } from '../utils/jwtUtils.js'; + +const authController = { + async signup(req, res, next) { + try { + const { email, nickname, password, passwordConfirmation } = req.body; + const newUserInfo = await authService.signup(email, nickname, password, passwordConfirmation); + const accessToken = generateAccessToken(newUserInfo.id); + const refreshToken = generateRefreshToken(newUserInfo.id); + await authService.saveRefreshToken(newUserInfo.id, refreshToken); + + res.status(201).json({ + accessToken, + refreshToken, + user: newUserInfo, + }); + } catch (error) { + next(error); + } + }, + + async login(req, res, next) { + try { + const { email, password } = req.body; + const userInfo = await authService.login(email, password); + const accessToken = generateAccessToken(userInfo.id); + const refreshToken = generateRefreshToken(userInfo.id); + await authService.saveRefreshToken(userInfo.id, refreshToken); + + res.cookie('refreshToken', refreshToken, { httpOnly: true,sameSite: "none",secure: true, maxAge: 7 * 24 * 60 * 60 * 1000 }); // 7์ผ + res.status(200).json({ accessToken, user: userInfo }); + } catch (error) { + next(error); + } + }, + + async getUserInfo(req, res, next) { + try { + const userId = req.auth.id; + const user = await authService.getUserById(userId); + res.json({ id: user.id, email: user.email, nickname: user.nickname, profileImage: user.profileImage }); + } catch (error) { + next(error); + } + }, + + async refreshAccessToken(req, res, next) { + const refreshToken = req.cookies.refreshToken; + try { + const user = await authService.findUserByRefreshToken(refreshToken); + if (!user) { + return res.status(401).json({ message: '์œ ํšจํ•˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค.' }); + } + const newAccessToken = generateAccessToken(user.id); + res.json({ token: newAccessToken }); + } catch (error) { + next(error); + } + }, + + async logout(req, res, next) { + const refreshToken = req.cookies.refreshToken; + try { + await authService.clearRefreshToken(refreshToken); + res.clearCookie('refreshToken', { httpOnly: true, secure: true }); + res.status(204).send(); + } catch (error) { + next(error); + } + }, +}; + +export default authController; \ No newline at end of file diff --git a/src/middlewares/auth.js b/src/middlewares/auth.js new file mode 100644 index 00000000..c20f00b9 --- /dev/null +++ b/src/middlewares/auth.js @@ -0,0 +1,55 @@ +import { expressjwt } from "express-jwt"; +import jwt from 'jsonwebtoken'; +import userService from '../services/authService.js'; + +const verifyAccessToken = expressjwt({ + secret: process.env.JWT_SECRET, + algorithms: ["HS256"], +}); + +const verifyRefreshToken = async (req, res, next) => { + const refreshToken = req.cookies.refreshToken; + + if (!refreshToken) { + return res.status(401).json({ message: '๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ด ์—†์Šต๋‹ˆ๋‹ค.' }); + } + + try { + const decoded = jwt.verify(refreshToken, process.env.JWT_SECRET_REFRESH); + const user = await userService.findUserByRefreshToken(refreshToken); + if (!user || user.id !== decoded.userId) { + return res.status(401).json({ message: '์œ ํšจํ•˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค.' }); + } + req.auth = { id: decoded.userId }; + next(); + } catch (error) { + return res.status(401).json({ message: '์œ ํšจํ•˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค.' }); + } +}; + +function validateEmailAndPassword(req, res, next) { + const { email, password } = req.body; + if (!email || !password) { + const error = new Error("email, password ๊ฐ€ ๋ชจ๋‘ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค."); + error.code = 422; + return next(error); + } + next(); +} + +function validateSignupData(req, res, next) { + const { email, password, nickname } = req.body; + if (!email || !password || !nickname) { + const error = new Error("email, password, nickname ๊ฐ€ ๋ชจ๋‘ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค."); + error.code = 422; + return next(error); + } + next(); +} + +export default { + verifyAccessToken, + verifyRefreshToken, + validateEmailAndPassword, + validateSignupData, +}; \ No newline at end of file diff --git a/src/routes/authRouter.js b/src/routes/authRouter.js new file mode 100644 index 00000000..07564b4a --- /dev/null +++ b/src/routes/authRouter.js @@ -0,0 +1,22 @@ +import express from 'express'; +import auth from '../middlewares/auth.js'; +import authController from '../controllers/authController.js'; + +const authRouter = express.Router(); + +// ํšŒ์›๊ฐ€์ž… +authRouter.post('/signup', authController.signup); + +// ๋กœ๊ทธ์ธ +authRouter.post('/signIn', auth.validateEmailAndPassword, authController.login); + +// ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์œผ๋กœ ์ƒˆ ์•ก์„ธ์Šค ํ† ํฐ ๋ฐœ๊ธ‰ +authRouter.post('/refresh-token', auth.verifyRefreshToken, authController.refreshAccessToken); + +// ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ (์•ก์„ธ์Šค ํ† ํฐ ์ธ์ฆ ํ•„์š”) +authRouter.get('/me', auth.verifyAccessToken, authController.getUserInfo); + +// ๋กœ๊ทธ์•„์›ƒ +authRouter.post('/logout', authController.logout); + +export default authRouter; \ No newline at end of file diff --git a/src/services/authService.js b/src/services/authService.js new file mode 100644 index 00000000..95f7fc6c --- /dev/null +++ b/src/services/authService.js @@ -0,0 +1,86 @@ +import userRepository from '../repositories/userRepository.js'; +import bcrypt from 'bcrypt'; + +const SALT_ROUNDS = +process.env.SALT_ROUNDS; + +const authService = { + async signup(email, nickname, password, passwordConfirmation) { + const existingUserByEmail = await userRepository.findUserByEmail(email); + if (existingUserByEmail) { + const error = new Error('์ด๋ฏธ ์กด์žฌํ•˜๋Š” ์ด๋ฉ”์ผ์ž…๋‹ˆ๋‹ค.'); + error.code = 409; + throw error; + } + + const existingUserBynickname = await userRepository.findUserBynickname(nickname); + if (existingUserBynickname) { + const error = new Error('์ด๋ฏธ ์กด์žฌํ•˜๋Š” ๋‹‰๋„ค์ž„์ž…๋‹ˆ๋‹ค.'); + error.code = 409; + throw error; + } + + if (password !== passwordConfirmation) { + const error = new Error('๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.'); + error.code = 409; + throw error; + } + + const salt = await bcrypt.genSalt(SALT_ROUNDS); + const hashedPassword = await bcrypt.hash(password, salt); + const newUser = await userRepository.createUser(email, hashedPassword, nickname); + + return { + id: newUser.id, + email: newUser.email, + nickname: newUser.nickname, + profile : user.profileImage, + }; + }, + + async login(email, password) { + const user = await userRepository.findUserByEmail(email); + if (!user) { + const error = new Error('์กด์žฌํ•˜์ง€ ์•Š๋Š” ์ด๋ฉ”์ผ์ž…๋‹ˆ๋‹ค.'); + error.code = 401; + throw error; + } + + const isPasswordValid = await bcrypt.compare(password, user.encryptedPassword); + if (!isPasswordValid) { + const error = new Error('๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.'); + error.code = 401; + throw error; + } + + return { + id: user.id, + email: user.email, + nickname: user.nickname, + profile : user.profileImage, + }; + }, + + async getUserById(userId) { + const user = await userRepository.findUserById(userId); + if (!user) { + const error = new Error('ํ•ด๋‹น ID์˜ ์‚ฌ์šฉ์ž๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.'); + error.code = 404; + throw error; + } + return user; + }, + + async saveRefreshToken(userId, refreshToken) { + await userRepository.saveRefreshToken(userId, refreshToken); + }, + + async findUserByRefreshToken(refreshToken) { + return await userRepository.findUserByRefreshToken(refreshToken); + }, + + async clearRefreshToken(refreshToken) { + await userRepository.clearRefreshToken(refreshToken); + }, +}; + +export default authService; \ No newline at end of file diff --git a/src/utils/jwtUtils.js b/src/utils/jwtUtils.js new file mode 100644 index 00000000..e4554945 --- /dev/null +++ b/src/utils/jwtUtils.js @@ -0,0 +1,11 @@ +import jwt from 'jsonwebtoken'; + +const generateAccessToken = (userId) => { + return jwt.sign({ userId }, process.env.JWT_SECRET, { expiresIn: process.env.ACCESS_TOKEN_EXPIRES_IN }); +}; + +const generateRefreshToken = (userId) => { + return jwt.sign({ userId }, process.env.JWT_SECRET_REFRESH, { expiresIn: process.env.REFRESH_TOKEN_EXPIRES_IN }); +}; + +export { generateAccessToken, generateRefreshToken }; \ No newline at end of file From 436051a7197d6c087f66db1b7a403a08ad900903 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:35:05 +0900 Subject: [PATCH 03/16] =?UTF-8?q?feat:=20MVC=20=ED=8C=A8=ED=84=B4=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/articleController.js | 64 ++++++++++++++++++++++ src/repositories/articleRepository.js | 79 +++++++++++++++++++++++++++ src/routes/articleRouter.js | 22 ++++++++ src/services/articleService.js | 43 +++++++++++++++ 4 files changed, 208 insertions(+) create mode 100644 src/controllers/articleController.js create mode 100644 src/repositories/articleRepository.js create mode 100644 src/routes/articleRouter.js create mode 100644 src/services/articleService.js diff --git a/src/controllers/articleController.js b/src/controllers/articleController.js new file mode 100644 index 00000000..aa145ac3 --- /dev/null +++ b/src/controllers/articleController.js @@ -0,0 +1,64 @@ +import articleService from '../services/articleService.js'; + +const articleController = { + createArticle: async (req, res, next) => { + try { + const { title, content, images } = req.body; + const userId = req.auth.id; + const newArticle = await articleService.createArticle(userId, title, content, images); + return res.status(201).json(newArticle); + } catch (error) { + next(error); + } + }, + + getArticles: async (req, res, next) => { + try { + const articles = await articleService.getArticles(); + return res.status(200).json(articles); + } catch (error) { + next(error); + } + }, + + getArticleById: async (req, res, next) => { + try { + const { articleId } = req.params; + const article = await articleService.getArticleById(parseInt(articleId)); + return res.status(200).json(article); + } catch (error) { + next(error); + } + }, + + updateArticle: async (req, res, next) => { + try { + const { articleId } = req.params; + const { title, content, images } = req.body; + const userId = req.auth.id; + const updatedArticle = await articleService.updateArticle( + parseInt(articleId), + userId, + title, + content, + images + ); + return res.status(200).json(updatedArticle); + } catch (error) { + next(error); + } + }, + + deleteArticle: async (req, res, next) => { + try { + const { articleId } = req.params; + const userId = req.auth.id; + await articleService.deleteArticle(parseInt(articleId), userId); + return res.status(204).send(); + } catch (error) { + next(error); + } + }, +}; + +export default articleController; \ No newline at end of file diff --git a/src/repositories/articleRepository.js b/src/repositories/articleRepository.js new file mode 100644 index 00000000..09df9093 --- /dev/null +++ b/src/repositories/articleRepository.js @@ -0,0 +1,79 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +const articleRepository = { + createArticle: async (userId, title, content, images) => { + return prisma.article.create({ + data: { + userId, + title, + content, + images, + }, + }); + }, + + findAllArticles: async () => { + return prisma.article.findMany({ + include: { + user: { + select: { + id: true, + nickname: true, + }, + }, + likes: true, + comments: true, + }, + orderBy: { + createdAt: 'desc', + }, + }); + }, + + findArticleById: async (id) => { + return prisma.article.findUnique({ + where: { id }, + include: { + user: { + select: { + id: true, + nickname: true, + }, + }, + likes: true, + comments: { + include: { + writer: { + select: { + id: true, + nickname: true, + }, + }, + }, + }, + }, + }); + }, + + updateArticle: async (id, title, content, images) => { + return prisma.article.update({ + where: { id }, + data: { + title, + content, + images, + updatedAt: new Date(), + }, + }); + }, + + deleteArticle: async (id) => { + return prisma.article.delete({ + where: { id }, + }); + }, +}; + +export default articleRepository; \ No newline at end of file diff --git a/src/routes/articleRouter.js b/src/routes/articleRouter.js new file mode 100644 index 00000000..9bfac9a6 --- /dev/null +++ b/src/routes/articleRouter.js @@ -0,0 +1,22 @@ +import express from 'express'; +import articleController from '../controllers/articleController.js'; +import auth from '../middlewares/auth.js'; + +const articleRouter = express.Router(); + +// ๊ฒŒ์‹œ๊ธ€ ์ƒ์„ฑ (์ธ์ฆ ํ•„์š”) +articleRouter.post('/', auth.verifyAccessToken, articleController.createArticle); + +// ๋ชจ๋“  ๊ฒŒ์‹œ๊ธ€ ์กฐํšŒ +articleRouter.get('/', articleController.getArticles); + +// ํŠน์ • ๊ฒŒ์‹œ๊ธ€ ์กฐํšŒ +articleRouter.get('/:articleId', articleController.getArticleById); + +// ๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ • (์ธ์ฆ ํ•„์š”) +articleRouter.put('/:articleId', auth.verifyAccessToken, articleController.updateArticle); + +// ๊ฒŒ์‹œ๊ธ€ ์‚ญ์ œ (์ธ์ฆ ํ•„์š”) +articleRouter.delete('/:articleId', auth.verifyAccessToken, articleController.deleteArticle); + +export default articleRouter; \ No newline at end of file diff --git a/src/services/articleService.js b/src/services/articleService.js new file mode 100644 index 00000000..d8da6da5 --- /dev/null +++ b/src/services/articleService.js @@ -0,0 +1,43 @@ +import articleRepository from '../repositories/articleRepository.js'; + +const articleService = { + createArticle: async (userId, title, content, images) => { + return articleRepository.createArticle(userId, title, content, images); + }, + + getArticles: async () => { + return articleRepository.findAllArticles(); + }, + + getArticleById: async (id) => { + const article = await articleRepository.findArticleById(id); + if (!article) { + throw { status: 404, message: '๊ฒŒ์‹œ๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return article; + }, + + updateArticle: async (id, userId, title, content, images) => { + const article = await articleRepository.findArticleById(id); + if (!article) { + throw { status: 404, message: '๊ฒŒ์‹œ๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + if (article.userId !== userId) { + throw { status: 403, message: '๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ • ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return articleRepository.updateArticle(id, title, content, images); + }, + + deleteArticle: async (id, userId) => { + const article = await articleRepository.findArticleById(id); + if (!article) { + throw { status: 404, message: '๊ฒŒ์‹œ๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + if (article.userId !== userId) { + throw { status: 403, message: '๊ฒŒ์‹œ๊ธ€ ์‚ญ์ œ ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return articleRepository.deleteArticle(id); + }, +}; + +export default articleService; \ No newline at end of file From 1a48b736fb7f1e268a1b9924cbc872225b23d071 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:35:31 +0900 Subject: [PATCH 04/16] =?UTF-8?q?feat:=20MVC=20=ED=8C=A8=ED=84=B4=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EC=83=81=ED=92=88=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/productController.js | 66 +++++++++++++++++++++ src/repositories/productRepository.js | 83 +++++++++++++++++++++++++++ src/routes/productRouter.js | 22 +++++++ src/services/productService.js | 43 ++++++++++++++ 4 files changed, 214 insertions(+) create mode 100644 src/controllers/productController.js create mode 100644 src/repositories/productRepository.js create mode 100644 src/routes/productRouter.js create mode 100644 src/services/productService.js diff --git a/src/controllers/productController.js b/src/controllers/productController.js new file mode 100644 index 00000000..143b13d1 --- /dev/null +++ b/src/controllers/productController.js @@ -0,0 +1,66 @@ +import productService from '../services/productService.js'; + +const productController = { + createProduct: async (req, res, next) => { + try { + const { name, description, price, tags, images } = req.body; + const userId = req.auth.id; + const newProduct = await productService.createProduct(userId, name, description, price, tags, images); + return res.status(201).json(newProduct); + } catch (error) { + next(error); + } + }, + + getProducts: async (req, res, next) => { + try { + const products = await productService.getProducts(); + return res.status(200).json(products); + } catch (error) { + next(error); + } + }, + + getProductById: async (req, res, next) => { + try { + const { productId } = req.params; + const product = await productService.getProductById(parseInt(productId)); + return res.status(200).json(product); + } catch (error) { + next(error); + } + }, + + updateProduct: async (req, res, next) => { + try { + const { productId } = req.params; + const { name, description, price, tags, images } = req.body; + const userId = req.auth.id; + const updatedProduct = await productService.updateProduct( + parseInt(productId), + userId, + name, + description, + price, + tags, + images + ); + return res.status(200).json(updatedProduct); + } catch (error) { + next(error); + } + }, + + deleteProduct: async (req, res, next) => { + try { + const { productId } = req.params; + const userId = req.auth.id; + await productService.deleteProduct(parseInt(productId), userId); + return res.status(204).send(); + } catch (error) { + next(error); + } + }, +}; + +export default productController; \ No newline at end of file diff --git a/src/repositories/productRepository.js b/src/repositories/productRepository.js new file mode 100644 index 00000000..2da158f2 --- /dev/null +++ b/src/repositories/productRepository.js @@ -0,0 +1,83 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +const productRepository = { + createProduct: async (userId, name, description, price, tags , images ) => { + return prisma.product.create({ + data: { + userId, + name, + description, + price: parseInt(price), + tags, + images, + }, + }); + }, + + findAllProducts: async () => { + return prisma.product.findMany({ + include: { + user: { + select: { + id: true, + nickname: true, + }, + }, + likes: true, + comments: true, + }, + orderBy: { + createdAt: 'desc', + }, + }); + }, + + findProductById: async (id) => { + return prisma.product.findUnique({ + where: { id }, + include: { + user: { + select: { + id: true, + nickname: true, + }, + }, + likes: true, + comments: { + include: { + writer: { + select: { + id: true, + nickname: true, + }, + }, + }, + }, + }, + }); + }, + + updateProduct: async (id, name, description, price, tags, images) => { + return prisma.product.update({ + where: { id }, + data: { + name, + description, + price: parseInt(price), + tags, + images, + updatedAt: new Date(), + }, + }); + }, + + deleteProduct: async (id) => { + return prisma.product.delete({ + where: { id }, + }); + }, +}; + +export default productRepository; \ No newline at end of file diff --git a/src/routes/productRouter.js b/src/routes/productRouter.js new file mode 100644 index 00000000..9d855fdb --- /dev/null +++ b/src/routes/productRouter.js @@ -0,0 +1,22 @@ +import express from 'express'; +import productController from '../controllers/productController.js'; +import auth from '../middlewares/auth.js'; + +const productRouter = express.Router(); + +// ์ƒํ’ˆ ์ƒ์„ฑ (์ธ์ฆ ํ•„์š”) +productRouter.post('/', auth.verifyAccessToken, productController.createProduct); + +// ๋ชจ๋“  ์ƒํ’ˆ ์กฐํšŒ +productRouter.get('/', productController.getProducts); + +// ํŠน์ • ์ƒํ’ˆ ์กฐํšŒ +productRouter.get('/:productId', productController.getProductById); + +// ์ƒํ’ˆ ์ˆ˜์ • (์ธ์ฆ ํ•„์š”) +productRouter.put('/:productId', auth.verifyAccessToken, productController.updateProduct); + +// ์ƒํ’ˆ ์‚ญ์ œ (์ธ์ฆ ํ•„์š”) +productRouter.delete('/:productId', auth.verifyAccessToken, productController.deleteProduct); + +export default productRouter; \ No newline at end of file diff --git a/src/services/productService.js b/src/services/productService.js new file mode 100644 index 00000000..bac9b4eb --- /dev/null +++ b/src/services/productService.js @@ -0,0 +1,43 @@ +import productRepository from '../repositories/productRepository.js'; + +const productService = { + createProduct: async (userId, name, description, price, tags, images) => { + return productRepository.createProduct(userId, name, description, price, tags, images); + }, + + getProducts: async () => { + return productRepository.findAllProducts(); + }, + + getProductById: async (id) => { + const product = await productRepository.findProductById(id); + if (!product) { + throw { status: 404, message: '์ƒํ’ˆ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return product; + }, + + updateProduct: async (id, userId, name, description, price, tags, images) => { + const product = await productRepository.findProductById(id); + if (!product) { + throw { status: 404, message: '์ƒํ’ˆ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + if (product.userId !== userId) { + throw { status: 403, message: '์ƒํ’ˆ ์ˆ˜์ • ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return productRepository.updateProduct(id, name, description, price, tags, images); + }, + + deleteProduct: async (id, userId) => { + const product = await productRepository.findProductById(id); + if (!product) { + throw { status: 404, message: '์ƒํ’ˆ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + if (product.userId !== userId) { + throw { status: 403, message: '์ƒํ’ˆ ์‚ญ์ œ ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return productRepository.deleteProduct(id); + }, +}; + +export default productService; \ No newline at end of file From 333321b6887dc222b97adce0f8c92589a6f37db9 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:40:11 +0900 Subject: [PATCH 05/16] =?UTF-8?q?feat:=20DB=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db/prisma.js | 5 + .../migration.sql | 118 ++++++++++++++++++ .../migration.sql | 13 ++ .../migration.sql | 95 ++++++++++++++ .../migration.sql | 12 ++ src/db/prisma/migrations/migration_lock.toml | 3 + src/db/prisma/schema.prisma | 84 +++++++++++++ 7 files changed, 330 insertions(+) create mode 100644 src/db/prisma.js create mode 100644 src/db/prisma/migrations/20250417004608_sprint_mission_8/migration.sql create mode 100644 src/db/prisma/migrations/20250509064855_add_email_column/migration.sql create mode 100644 src/db/prisma/migrations/20250512075135_integrate_article_product_comments_and_likes/migration.sql create mode 100644 src/db/prisma/migrations/20250513004810_add_image_column/migration.sql create mode 100644 src/db/prisma/migrations/migration_lock.toml create mode 100644 src/db/prisma/schema.prisma diff --git a/src/db/prisma.js b/src/db/prisma.js new file mode 100644 index 00000000..de08f2a2 --- /dev/null +++ b/src/db/prisma.js @@ -0,0 +1,5 @@ +import { PrismaClient } from "@prisma/client"; + +const prisma = new PrismaClient(); + +export default prisma; \ No newline at end of file diff --git a/src/db/prisma/migrations/20250417004608_sprint_mission_8/migration.sql b/src/db/prisma/migrations/20250417004608_sprint_mission_8/migration.sql new file mode 100644 index 00000000..1e0c2a37 --- /dev/null +++ b/src/db/prisma/migrations/20250417004608_sprint_mission_8/migration.sql @@ -0,0 +1,118 @@ +-- CreateTable +CREATE TABLE "User" ( + "id" TEXT NOT NULL, + "nickname" TEXT NOT NULL, + "encryptedPassword" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "User_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Article" ( + "id" SERIAL NOT NULL, + "userId" TEXT NOT NULL, + "title" TEXT NOT NULL DEFAULT '', + "content" TEXT NOT NULL DEFAULT '', + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Article_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "ArticleComment" ( + "id" SERIAL NOT NULL, + "userId" TEXT NOT NULL, + "content" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + "articleId" INTEGER NOT NULL, + + CONSTRAINT "ArticleComment_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "ArticleLike" ( + "id" SERIAL NOT NULL, + "userId" TEXT NOT NULL, + "articleId" INTEGER NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "ArticleLike_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Product" ( + "id" SERIAL NOT NULL, + "userId" TEXT NOT NULL, + "name" TEXT NOT NULL DEFAULT '', + "description" TEXT NOT NULL DEFAULT '', + "price" INTEGER NOT NULL, + "tags" TEXT[], + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Product_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "ProductComment" ( + "id" SERIAL NOT NULL, + "userId" TEXT NOT NULL, + "content" TEXT NOT NULL DEFAULT '', + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + "productId" INTEGER NOT NULL, + + CONSTRAINT "ProductComment_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "ProductLike" ( + "id" SERIAL NOT NULL, + "userId" TEXT NOT NULL, + "productId" INTEGER NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "ProductLike_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_nickname_key" ON "User"("nickname"); + +-- CreateIndex +CREATE UNIQUE INDEX "ArticleLike_userId_articleId_key" ON "ArticleLike"("userId", "articleId"); + +-- CreateIndex +CREATE UNIQUE INDEX "ProductLike_userId_productId_key" ON "ProductLike"("userId", "productId"); + +-- AddForeignKey +ALTER TABLE "Article" ADD CONSTRAINT "Article_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ArticleComment" ADD CONSTRAINT "ArticleComment_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ArticleComment" ADD CONSTRAINT "ArticleComment_articleId_fkey" FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ArticleLike" ADD CONSTRAINT "ArticleLike_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ArticleLike" ADD CONSTRAINT "ArticleLike_articleId_fkey" FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Product" ADD CONSTRAINT "Product_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ProductComment" ADD CONSTRAINT "ProductComment_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ProductComment" ADD CONSTRAINT "ProductComment_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ProductLike" ADD CONSTRAINT "ProductLike_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ProductLike" ADD CONSTRAINT "ProductLike_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/db/prisma/migrations/20250509064855_add_email_column/migration.sql b/src/db/prisma/migrations/20250509064855_add_email_column/migration.sql new file mode 100644 index 00000000..a48aad1e --- /dev/null +++ b/src/db/prisma/migrations/20250509064855_add_email_column/migration.sql @@ -0,0 +1,13 @@ +/* + Warnings: + + - A unique constraint covering the columns `[email]` on the table `User` will be added. If there are existing duplicate values, this will fail. + - Added the required column `email` to the `User` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "User" ADD COLUMN "email" TEXT NOT NULL, +ADD COLUMN "refreshToken" TEXT; + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); diff --git a/src/db/prisma/migrations/20250512075135_integrate_article_product_comments_and_likes/migration.sql b/src/db/prisma/migrations/20250512075135_integrate_article_product_comments_and_likes/migration.sql new file mode 100644 index 00000000..6ce7c5fb --- /dev/null +++ b/src/db/prisma/migrations/20250512075135_integrate_article_product_comments_and_likes/migration.sql @@ -0,0 +1,95 @@ +/* + Warnings: + + - You are about to drop the `ArticleComment` table. If the table is not empty, all the data it contains will be lost. + - You are about to drop the `ArticleLike` table. If the table is not empty, all the data it contains will be lost. + - You are about to drop the `ProductComment` table. If the table is not empty, all the data it contains will be lost. + - You are about to drop the `ProductLike` table. If the table is not empty, all the data it contains will be lost. + +*/ +-- DropForeignKey +ALTER TABLE "ArticleComment" DROP CONSTRAINT "ArticleComment_articleId_fkey"; + +-- DropForeignKey +ALTER TABLE "ArticleComment" DROP CONSTRAINT "ArticleComment_userId_fkey"; + +-- DropForeignKey +ALTER TABLE "ArticleLike" DROP CONSTRAINT "ArticleLike_articleId_fkey"; + +-- DropForeignKey +ALTER TABLE "ArticleLike" DROP CONSTRAINT "ArticleLike_userId_fkey"; + +-- DropForeignKey +ALTER TABLE "ProductComment" DROP CONSTRAINT "ProductComment_productId_fkey"; + +-- DropForeignKey +ALTER TABLE "ProductComment" DROP CONSTRAINT "ProductComment_userId_fkey"; + +-- DropForeignKey +ALTER TABLE "ProductLike" DROP CONSTRAINT "ProductLike_productId_fkey"; + +-- DropForeignKey +ALTER TABLE "ProductLike" DROP CONSTRAINT "ProductLike_userId_fkey"; + +-- AlterTable +ALTER TABLE "User" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; + +-- DropTable +DROP TABLE "ArticleComment"; + +-- DropTable +DROP TABLE "ArticleLike"; + +-- DropTable +DROP TABLE "ProductComment"; + +-- DropTable +DROP TABLE "ProductLike"; + +-- CreateTable +CREATE TABLE "Comment" ( + "id" SERIAL NOT NULL, + "content" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "productId" INTEGER, + "articleId" INTEGER, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Comment_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Like" ( + "id" SERIAL NOT NULL, + "userId" TEXT NOT NULL, + "articleId" INTEGER, + "productId" INTEGER, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "Like_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "Like_userId_articleId_key" ON "Like"("userId", "articleId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Like_userId_productId_key" ON "Like"("userId", "productId"); + +-- AddForeignKey +ALTER TABLE "Comment" ADD CONSTRAINT "Comment_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Comment" ADD CONSTRAINT "Comment_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Comment" ADD CONSTRAINT "Comment_articleId_fkey" FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Like" ADD CONSTRAINT "Like_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Like" ADD CONSTRAINT "Like_articleId_fkey" FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Like" ADD CONSTRAINT "Like_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/db/prisma/migrations/20250513004810_add_image_column/migration.sql b/src/db/prisma/migrations/20250513004810_add_image_column/migration.sql new file mode 100644 index 00000000..f0dd0bc1 --- /dev/null +++ b/src/db/prisma/migrations/20250513004810_add_image_column/migration.sql @@ -0,0 +1,12 @@ +-- AlterTable +ALTER TABLE "Article" ADD COLUMN "images" TEXT[] DEFAULT ARRAY[]::TEXT[], +ALTER COLUMN "title" DROP DEFAULT; + +-- AlterTable +ALTER TABLE "Product" ADD COLUMN "images" TEXT[] DEFAULT ARRAY[]::TEXT[], +ALTER COLUMN "name" DROP DEFAULT, +ALTER COLUMN "price" SET DEFAULT 0, +ALTER COLUMN "tags" SET DEFAULT ARRAY[]::TEXT[]; + +-- AlterTable +ALTER TABLE "User" ADD COLUMN "profileImage" TEXT; diff --git a/src/db/prisma/migrations/migration_lock.toml b/src/db/prisma/migrations/migration_lock.toml new file mode 100644 index 00000000..044d57cd --- /dev/null +++ b/src/db/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (e.g., Git) +provider = "postgresql" diff --git a/src/db/prisma/schema.prisma b/src/db/prisma/schema.prisma new file mode 100644 index 00000000..7ccc037e --- /dev/null +++ b/src/db/prisma/schema.prisma @@ -0,0 +1,84 @@ +// This is your Prisma schema file, +// learn more about it in the docs: https://pris.ly/d/prisma-schema + +// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? +// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init + +generator client { + provider = "prisma-client-js" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +model User { + id String @id @default(cuid()) + email String @unique + nickname String @unique + encryptedPassword String + refreshToken String? + profileImage String? + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt + comments Comment[] + likes Like[] + articles Article[] + products Product[] +} + +model Article { + id Int @id @default(autoincrement()) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + userId String + title String + content String @default("") + images String[] @default([]) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + likes Like[] + comments Comment[] +} + +model Product { + id Int @id @default(autoincrement()) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + userId String + name String + description String @default("") + price Int @default(0) + tags String[] @default([]) + images String[] @default([]) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + likes Like[] + comments Comment[] +} + +model Comment { + id Int @id @default(autoincrement()) + content String + writer User @relation(fields: [userId], references: [id], onDelete: Cascade) + userId String + product Product? @relation(fields: [productId], references: [id], onDelete: Cascade) + productId Int? + article Article? @relation(fields: [articleId], references: [id], onDelete: Cascade) + articleId Int? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt +} + +model Like { + id Int @id @default(autoincrement()) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + userId String + article Article? @relation(fields: [articleId], references: [id], onDelete: Cascade) + articleId Int? + product Product? @relation(fields: [productId], references: [id], onDelete: Cascade) + productId Int? + createdAt DateTime @default(now()) + + @@unique([userId, articleId]) + @@unique([userId, productId]) +} From b082e84abd05a98a8ab54a0eb1b91aeb138c03fb Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:41:32 +0900 Subject: [PATCH 06/16] =?UTF-8?q?feat:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/uploadController.js | 33 +++++++++++++++++++++++++++++ src/middlewares/upload.js | 32 ++++++++++++++++++++++++++++ src/routes/uploadRouter.js | 13 ++++++++++++ src/services/uploadService.js | 7 ++++++ 4 files changed, 85 insertions(+) create mode 100644 src/controllers/uploadController.js create mode 100644 src/middlewares/upload.js create mode 100644 src/routes/uploadRouter.js create mode 100644 src/services/uploadService.js diff --git a/src/controllers/uploadController.js b/src/controllers/uploadController.js new file mode 100644 index 00000000..8bbc1781 --- /dev/null +++ b/src/controllers/uploadController.js @@ -0,0 +1,33 @@ +import uploadService from '../services/uploadService.js'; + +const uploadController = { + uploadSingleImage: async (req, res) => { + try { + if (!req.file) { + return res.status(400).json({ message: 'ํŒŒ์ผ์ด ์—…๋กœ๋“œ๋˜์ง€ ์•Š์•˜๊ฑฐ๋‚˜, ํ—ˆ์šฉ๋˜์ง€ ์•Š๋Š” ํŒŒ์ผ ํ˜•์‹์ž…๋‹ˆ๋‹ค.' }); + } + const imageUrl = await uploadService.generateImageUrl(req.file.filename); + res.status(200).json({ imageUrl }); + } catch (error) { + console.error('์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ์˜ค๋ฅ˜:', error); + res.status(500).json({ message: '์ด๋ฏธ์ง€ ์—…๋กœ๋“œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.' }); + } + }, + + uploadMultipleImages: async (req, res) => { + try { + if (!req.files || req.files.length === 0) { + return res.status(400).json({ message: 'ํŒŒ์ผ์ด ์—…๋กœ๋“œ๋˜์ง€ ์•Š์•˜๊ฑฐ๋‚˜, ํ—ˆ์šฉ๋˜์ง€ ์•Š๋Š” ํŒŒ์ผ ํ˜•์‹์ž…๋‹ˆ๋‹ค.' }); + } + const imageUrls = await Promise.all( + req.files.map(async (file) => await uploadService.generateImageUrl(file.filename)) + ); + res.status(200).json({ imageUrls }); + } catch (error) { + console.error('์ด๋ฏธ์ง€๋“ค ์—…๋กœ๋“œ ์˜ค๋ฅ˜:', error); + res.status(500).json({ message: '์ด๋ฏธ์ง€๋“ค ์—…๋กœ๋“œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.' }); + } + }, +}; + +export default uploadController; \ No newline at end of file diff --git a/src/middlewares/upload.js b/src/middlewares/upload.js new file mode 100644 index 00000000..7f699252 --- /dev/null +++ b/src/middlewares/upload.js @@ -0,0 +1,32 @@ +import multer from 'multer'; +import path from 'path'; + +// ์ €์žฅ๋  ๋””์Šคํฌ ์Šคํ† ๋ฆฌ์ง€ ์„ค์ • +const storage = multer.diskStorage({ + destination: (req, file, cb) => { + cb(null, 'uploads/'); // ์—…๋กœ๋“œ๋œ ์ด๋ฏธ์ง€๊ฐ€ ์ €์žฅ๋  ํด๋” + }, + filename: (req, file, cb) => { + const ext = path.extname(file.originalname); // ํŒŒ์ผ ํ™•์žฅ์ž ์ถ”์ถœ + const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9); + cb(null, file.fieldname + '-' + uniqueSuffix + ext); // ์ €์žฅ๋  ํŒŒ์ผ๋ช… (์›๋ณธ์ด๋ฆ„-ํƒ€์ž„์Šคํƒฌํ”„-๋žœ๋ค๊ฐ’.ํ™•์žฅ์ž) + }, +}); + +// ํŒŒ์ผ ํ•„ํ„ฐ๋ง (์ด๋ฏธ์ง€ ํŒŒ์ผ๋งŒ ํ—ˆ์šฉ) +const fileFilter = (req, file, cb) => { + const allowedMimeTypes = ['image/jpeg', 'image/png', 'image/gif']; + if (allowedMimeTypes.includes(file.mimetype)) { + cb(null, true); + } else { + cb(null, false); + } +}; + +const upload = multer({ + storage: storage, + fileFilter: fileFilter, + limits: { fileSize: 5 * 1024 * 1024 }, // ์ตœ๋Œ€ ํŒŒ์ผ ํฌ๊ธฐ 5MB +}); + +export default upload; \ No newline at end of file diff --git a/src/routes/uploadRouter.js b/src/routes/uploadRouter.js new file mode 100644 index 00000000..49627598 --- /dev/null +++ b/src/routes/uploadRouter.js @@ -0,0 +1,13 @@ +import express from 'express'; +import upload from '../middlewares/upload.js'; +import uploadController from '../controllers/uploadController.js'; + +const uploadRouter = express.Router(); + +// ๋‹จ์ผ ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ +uploadRouter.post('/image', upload.single('image'), uploadController.uploadSingleImage); + +// ์—ฌ๋Ÿฌ ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ (์ตœ๋Œ€ 3๊ฐœ) +uploadRouter.post('/images', upload.array('images', 3), uploadController.uploadMultipleImages); + +export default uploadRouter; \ No newline at end of file diff --git a/src/services/uploadService.js b/src/services/uploadService.js new file mode 100644 index 00000000..e8e7d99f --- /dev/null +++ b/src/services/uploadService.js @@ -0,0 +1,7 @@ +const uploadService = { + generateImageUrl: (filename) => { + return `/uploads/${filename}`; // ํด๋ผ์ด์–ธํŠธ์—์„œ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ ์ด๋ฏธ์ง€ URL ์ƒ์„ฑ + }, +}; + +export default uploadService; \ No newline at end of file From 425edec91e485266acdd6e8cfbbb912b9ba97eb0 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:41:51 +0900 Subject: [PATCH 07/16] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8/?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/repositories/userRepository.js | 69 ++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/repositories/userRepository.js diff --git a/src/repositories/userRepository.js b/src/repositories/userRepository.js new file mode 100644 index 00000000..74ef6f3a --- /dev/null +++ b/src/repositories/userRepository.js @@ -0,0 +1,69 @@ +import prisma from "../db/prisma.js"; + +const userRepository = { + async createUser(email, password, nickname) { + return prisma.user.create({ + data: { + email, + encryptedPassword : password, + nickname, + }, + }); + }, + + async findUserByEmail(email) { + return prisma.user.findUnique({ + where: { + email, + }, + }); + }, + + async findUserBynickname(nickname) { + return prisma.user.findUnique({ + where: { + nickname, + }, + }); + }, + + async findUserById(id) { + return prisma.user.findUnique({ + where: { + id, + }, + }); + }, + + async saveRefreshToken(userId, refreshToken) { + return prisma.user.update({ + where: { + id: userId, + }, + data: { + refreshToken, + }, + }); + }, + + async findUserByRefreshToken(refreshToken) { + return prisma.user.findFirst({ + where: { + refreshToken, + }, + }); + }, + + async clearRefreshToken(refreshToken) { + return prisma.user.updateMany({ + where: { + refreshToken, + }, + data: { + refreshToken: null, + }, + }); + }, +}; + +export default userRepository; \ No newline at end of file From c0238ca9da4ad198db8492303f66c3e02327f9af Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:42:46 +0900 Subject: [PATCH 08/16] =?UTF-8?q?feat:=20MVC=20=ED=8C=A8=ED=84=B4=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EB=8C=93=EA=B8=80=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/commentController.js | 64 +++++++++++++++++ src/repositories/commentRepository.js | 98 +++++++++++++++++++++++++++ src/routes/commentRouter.js | 22 ++++++ src/services/commentService.js | 50 ++++++++++++++ 4 files changed, 234 insertions(+) create mode 100644 src/controllers/commentController.js create mode 100644 src/repositories/commentRepository.js create mode 100644 src/routes/commentRouter.js create mode 100644 src/services/commentService.js diff --git a/src/controllers/commentController.js b/src/controllers/commentController.js new file mode 100644 index 00000000..11cc89f4 --- /dev/null +++ b/src/controllers/commentController.js @@ -0,0 +1,64 @@ +import commentService from '../services/commentService.js'; + +const commentController = { + createComment: async (req, res, next) => { + try { + const { content, articleId, productId } = req.body; + const userId = req.auth.id; + const newComment = await commentService.createComment( + userId, + content, + parseInt(articleId) || null, + parseInt(productId) || null + ); + return res.status(201).json(newComment); + } catch (error) { + next(error); + } + }, + + getCommentsByArticleId: async (req, res, next) => { + try { + const { articleId } = req.params; + const comments = await commentService.getCommentsByArticleId(parseInt(articleId)); + return res.status(200).json(comments); + } catch (error) { + next(error); + } + }, + + getCommentsByProductId: async (req, res, next) => { + try { + const { productId } = req.params; + const comments = await commentService.getCommentsByProductId(parseInt(productId)); + return res.status(200).json(comments); + } catch (error) { + next(error); + } + }, + + updateComment: async (req, res, next) => { + try { + const { commentId } = req.params; + const { content } = req.body; + const userId = req.auth.id; + const updatedComment = await commentService.updateComment(parseInt(commentId), userId, content); + return res.status(200).json(updatedComment); + } catch (error) { + next(error); + } + }, + + deleteComment: async (req, res, next) => { + try { + const { commentId } = req.params; + const userId = req.auth.id; + await commentService.deleteComment(parseInt(commentId), userId); + return res.status(204).send(); + } catch (error) { + next(error); + } + }, +}; + +export default commentController; \ No newline at end of file diff --git a/src/repositories/commentRepository.js b/src/repositories/commentRepository.js new file mode 100644 index 00000000..7fd45b8a --- /dev/null +++ b/src/repositories/commentRepository.js @@ -0,0 +1,98 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +const commentRepository = { + createComment: async (userId, content, articleId = null, productId = null) => { + return prisma.comment.create({ + data: { + userId, + content, + articleId, + productId, + }, + include: { + writer: { + select: { + id: true, + nickname: true, + }, + }, + }, + }); + }, + + findAllCommentsByArticleId: async (articleId) => { + return prisma.comment.findMany({ + where: { articleId }, + include: { + writer: { + select: { + id: true, + nickname: true, + }, + }, + }, + orderBy: { + createdAt: 'desc', + }, + }); + }, + + findAllCommentsByProductId: async (productId) => { + return prisma.comment.findMany({ + where: { productId }, + include: { + writer: { + select: { + id: true, + nickname: true, + }, + }, + }, + orderBy: { + createdAt: 'desc', + }, + }); + }, + + findCommentById: async (id) => { + return prisma.comment.findUnique({ + where: { id }, + include: { + writer: { + select: { + id: true, + nickname: true, + }, + }, + }, + }); + }, + + updateComment: async (id, content) => { + return prisma.comment.update({ + where: { id }, + data: { + content, + updatedAt: new Date(), + }, + include: { + writer: { + select: { + id: true, + nickname: true, + }, + }, + }, + }); + }, + + deleteComment: async (id) => { + return prisma.comment.delete({ + where: { id }, + }); + }, +}; + +export default commentRepository; \ No newline at end of file diff --git a/src/routes/commentRouter.js b/src/routes/commentRouter.js new file mode 100644 index 00000000..b5ae524e --- /dev/null +++ b/src/routes/commentRouter.js @@ -0,0 +1,22 @@ +import express from 'express'; +import commentController from '../controllers/commentController.js'; +import auth from '../middlewares/auth.js'; + +const commentRouter = express.Router(); + +// ๋Œ“๊ธ€ ์ƒ์„ฑ (์ธ์ฆ ํ•„์š”) +commentRouter.post('/', auth.verifyAccessToken, commentController.createComment); + +// ํŠน์ • ๊ฒŒ์‹œ๊ธ€์˜ ๋ชจ๋“  ๋Œ“๊ธ€ ์กฐํšŒ +commentRouter.get('/articles/:articleId', commentController.getCommentsByArticleId); + +// ํŠน์ • ์ƒํ’ˆ์˜ ๋ชจ๋“  ๋Œ“๊ธ€ ์กฐํšŒ +commentRouter.get('/products/:productId', commentController.getCommentsByProductId); + +// ํŠน์ • ๋Œ“๊ธ€ ์ˆ˜์ • (์ธ์ฆ ํ•„์š”) +commentRouter.put('/:commentId', auth.verifyAccessToken, commentController.updateComment); + +// ํŠน์ • ๋Œ“๊ธ€ ์‚ญ์ œ (์ธ์ฆ ํ•„์š”) +commentRouter.delete('/:commentId', auth.verifyAccessToken, commentController.deleteComment); + +export default commentRouter; \ No newline at end of file diff --git a/src/services/commentService.js b/src/services/commentService.js new file mode 100644 index 00000000..c6ce5ead --- /dev/null +++ b/src/services/commentService.js @@ -0,0 +1,50 @@ +import commentRepository from '../repositories/commentRepository.js'; + +const commentService = { + createComment: async (userId, content, articleId, productId) => { + if (!articleId && !productId) { + throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; + } + return commentRepository.createComment(userId, content, articleId, productId); + }, + + getCommentsByArticleId: async (articleId) => { + return commentRepository.findAllCommentsByArticleId(articleId); + }, + + getCommentsByProductId: async (productId) => { + return commentRepository.findAllCommentsByProductId(productId); + }, + + getCommentById: async (id) => { + const comment = await commentRepository.findCommentById(id); + if (!comment) { + throw { status: 404, message: '๋Œ“๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return comment; + }, + + updateComment: async (id, userId, content) => { + const comment = await commentRepository.findCommentById(id); + if (!comment) { + throw { status: 404, message: '๋Œ“๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + if (comment.userId !== userId) { + throw { status: 403, message: '๋Œ“๊ธ€ ์ˆ˜์ • ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return commentRepository.updateComment(id, content); + }, + + deleteComment: async (id, userId) => { + const comment = await commentRepository.findCommentById(id); + if (!comment) { + throw { status: 404, message: '๋Œ“๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + if (comment.userId !== userId) { + throw { status: 403, message: '๋Œ“๊ธ€ ์‚ญ์ œ ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return commentRepository.deleteComment(id); + }, +}; + +export default commentService; \ No newline at end of file From baa6f14c9631779a3cfbee26d788f525f1c84d54 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:43:52 +0900 Subject: [PATCH 09/16] =?UTF-8?q?feat:=20MVC=20=ED=8C=A8=ED=84=B4=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EC=A2=8B=EC=95=84=EC=9A=94=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/likeController.js | 47 +++++++++++ src/repositories/likeRepository.js | 66 +++++++++++++++ src/routes/likeRouter.js | 19 +++++ src/services/likeService.js | 129 +++++++++++++++++++++++++++++ 4 files changed, 261 insertions(+) create mode 100644 src/controllers/likeController.js create mode 100644 src/repositories/likeRepository.js create mode 100644 src/routes/likeRouter.js create mode 100644 src/services/likeService.js diff --git a/src/controllers/likeController.js b/src/controllers/likeController.js new file mode 100644 index 00000000..1a8aa4ed --- /dev/null +++ b/src/controllers/likeController.js @@ -0,0 +1,47 @@ +import likeService from '../services/likeService.js'; + +const likeController = { + addLike: async (req, res, next) => { + try { + const { articleId, productId } = req.body; + const userId = req.auth.id; + await likeService.addLike(userId, parseInt(articleId) || null, parseInt(productId) || null); + return res.status(201).json({ message: '์ข‹์•„์š”๋ฅผ ๋ˆŒ๋ €์Šต๋‹ˆ๋‹ค.' }); + } catch (error) { + next(error); + } + }, + + removeLike: async (req, res, next) => { + try { + const { articleId, productId } = req.body; + const userId = req.auth.id; + await likeService.removeLike(userId, parseInt(articleId) || null, parseInt(productId) || null); + return res.status(200).json({ message: '์ข‹์•„์š”๋ฅผ ์ทจ์†Œํ–ˆ์Šต๋‹ˆ๋‹ค.' }); + } catch (error) { + next(error); + } + }, + + getArticleLikeCount: async (req, res, next) => { + try { + const { articleId } = req.params; + const count = await likeService.getArticleLikeCount(parseInt(articleId)); + return res.status(200).json({ count }); + } catch (error) { + next(error); + } + }, + + getProductLikeCount: async (req, res, next) => { + try { + const { productId } = req.params; + const count = await likeService.getProductLikeCount(parseInt(productId)); + return res.status(200).json({ count }); + } catch (error) { + next(error); + } + }, +}; + +export default likeController; \ No newline at end of file diff --git a/src/repositories/likeRepository.js b/src/repositories/likeRepository.js new file mode 100644 index 00000000..ff601d78 --- /dev/null +++ b/src/repositories/likeRepository.js @@ -0,0 +1,66 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +const likeRepository = { + createLike: async (userId, articleId = null, productId = null) => { + return prisma.like.create({ + data: { + userId, + articleId, + productId, + }, + }); + }, + + deleteLike: async (userId, articleId = null, productId = null) => { + const where = { + userId, + }; + if (articleId) { + where.articleId = articleId; + } + if (productId) { + where.productId = productId; + } + return prisma.like.delete({ + where, + }); + }, + + countLikesByArticleId: async (articleId) => { + return prisma.like.count({ + where: { articleId }, + }); + }, + + countLikesByProductId: async (productId) => { + return prisma.like.count({ + where: { productId }, + }); + }, + + findLikeByUserIdAndArticleId: async (userId, articleId) => { + return prisma.like.findUnique({ + where: { + userId_articleId: { + userId, + articleId, + }, + }, + }); + }, + + findLikeByUserIdAndProductId: async (userId, productId) => { + return prisma.like.findUnique({ + where: { + userId_productId: { + userId, + productId, + }, + }, + }); + }, +}; + +export default likeRepository; \ No newline at end of file diff --git a/src/routes/likeRouter.js b/src/routes/likeRouter.js new file mode 100644 index 00000000..6ef08929 --- /dev/null +++ b/src/routes/likeRouter.js @@ -0,0 +1,19 @@ +import express from 'express'; +import likeController from '../controllers/likeController.js'; +import auth from '../middlewares/auth.js'; + +const likeRouter = express.Router(); + +// ์ข‹์•„์š” ์ถ”๊ฐ€ (์ธ์ฆ ํ•„์š”) +likeRouter.post('/', auth.verifyAccessToken, likeController.addLike); + +// ์ข‹์•„์š” ์ทจ์†Œ (์ธ์ฆ ํ•„์š”) +likeRouter.delete('/', auth.verifyAccessToken, likeController.removeLike); + +// ํŠน์ • ๊ฒŒ์‹œ๊ธ€์˜ ์ข‹์•„์š” ์ˆ˜ ์กฐํšŒ +likeRouter.get('/articles/:articleId/count', likeController.getArticleLikeCount); + +// ํŠน์ • ์ƒํ’ˆ์˜ ์ข‹์•„์š” ์ˆ˜ ์กฐํšŒ +likeRouter.get('/products/:productId/count', likeController.getProductLikeCount); + +export default likeRouter; \ No newline at end of file diff --git a/src/services/likeService.js b/src/services/likeService.js new file mode 100644 index 00000000..c4f335b5 --- /dev/null +++ b/src/services/likeService.js @@ -0,0 +1,129 @@ +import likeRepository from '../repositories/likeRepository.js'; + +const likeService = { + addLike: async (userId, articleId, productId) => { + if (!articleId && !productId) { + throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; + } + if (articleId) { + const existingLike = await likeRepository.findLikeByUserIdAndArticleId(userId, articleId); + if (existingLike) { + throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; + } + } + if (productId) { + const existingLike = await likeRepository.findLikeByUserIdAndProductId(userId, productId); + if (existingLike) { + throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; + } + } + return likeRepository.createLike(userId, articleId, productId); + }, + + removeLike: async (userId, articleId, productId) => { + if (!articleId && !productId) { + throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; + } + const result = await likeRepository.deleteLike(userId, articleId, productId); + if (result.count === 0) { + throw { status: 404, message: '์ข‹์•„์š”๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return result; + }, + + getArticleLikeCount: async (articleId) => { + return likeRepository.countLikesByArticleId(articleId); + }, + + getProductLikeCount: async (productId) => { + return likeRepository.countLikesByProductId(productId); + }, +}; + +export default likeService; + + + + + +// import prisma from '../db/prisma.js'; +// import likeRepository from '../repositories/likeRepository.js'; + +// const likeService = { +// addLike: async (userId, articleId, productId) => { +// return prisma.$transaction(async (tx) => { +// if (!articleId && !productId) { +// throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; +// } +// if (articleId) { +// const existingLike = await tx.like.findUnique({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์กฐํšŒ +// where: { +// userId_articleId: { +// userId, +// articleId, +// }, +// }, +// }); +// if (existingLike) { +// throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; +// } +// return tx.like.create({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์ƒ์„ฑ +// data: { +// userId, +// articleId, +// productId, +// }, +// }); +// } +// if (productId) { +// const existingLike = await tx.like.findUnique({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์กฐํšŒ +// where: { +// userId_productId: { +// userId, +// productId, +// }, +// }, +// }); +// if (existingLike) { +// throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; +// } +// return tx.like.create({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์ƒ์„ฑ +// data: { +// userId, +// articleId, +// productId, +// }, +// }); +// } +// }); +// }, + +// removeLike: async (userId, articleId, productId) => { +// return prisma.$transaction(async (tx) => { +// if (!articleId && !productId) { +// throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; +// } +// const deleteResult = await tx.like.deleteMany({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์‚ญ์ œ +// where: { +// userId, +// articleId, +// productId, +// }, +// }); +// if (deleteResult.count === 0) { +// throw { status: 404, message: '์ข‹์•„์š”๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; +// } +// return deleteResult; +// }); +// }, + +// getArticleLikeCount: async (articleId) => { +// return likeRepository.countLikesByArticleId(articleId); // ํŠธ๋žœ์žญ์…˜ ๋ถˆํ•„์š” +// }, + +// getProductLikeCount: async (productId) => { +// return likeRepository.countLikesByProductId(productId); // ํŠธ๋žœ์žญ์…˜ ๋ถˆํ•„์š” +// }, +// }; + +// export default likeService; \ No newline at end of file From 3258fcefb1cf0da575156ba42fa71528dd6f08bc Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:46:30 +0900 Subject: [PATCH 10/16] =?UTF-8?q?feat:=20=EA=B8=B0=EB=B3=B8=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85=20=EB=B0=8F=20=ED=95=84=EC=88=98=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 22 + .gitignore | 27 + package-lock.json | 2918 +++++++++++++++++++++++++++++++ package.json | 38 + src/app.js | 37 + src/jsconfig.json | 1 + src/middlewares/errorHandler.js | 17 + src/routes/index.js | 19 + 8 files changed, 3079 insertions(+) create mode 100644 .env.example create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/app.js create mode 100644 src/jsconfig.json create mode 100644 src/middlewares/errorHandler.js create mode 100644 src/routes/index.js diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..7839c6bf --- /dev/null +++ b/.env.example @@ -0,0 +1,22 @@ +# DB URL +DATABASE_URL= + +# ๋ฐฑ์—”๋“œ ํฌํŠธ +BE_PORT= + +# ํ—ˆ์šฉํ•ด์ค„ ํ”„๋ก ํŠธ ๋กœ์ปฌ ํฌํŠธ +HTTP_PORT= + +# ๋‚˜์ค‘์— ํ—ˆ์šฉํ•ด์ค„ ํ”„๋ก ํŠธ ๋ฐฐํฌ ์‚ฌ์ดํŠธ +HTTPS_PORT= + +# ๋น„๋ฐ€๋ฒˆํ˜ธ ํ•ด์‹ฑ +SALT_ROUNDS= + +# JWT SECRET +JWT_SECRET= +JWT_SECRET_REFRESH= + +# ํ† ๊ทผ ๋งŒ๋ฃŒ ์‹œ๊ฐ„ +ACCESS_TOKEN_EXPIRES_IN= +REFRESH_TOKEN_EXPIRES_IN= diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..a3fe0992 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Environment variables +.env + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..dbcb27d4 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,2918 @@ +{ + "name": "be", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "be", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@prisma/client": "^6.6.0", + "bcrypt": "^5.1.1", + "cookie-parser": "^1.4.7", + "cors": "^2.8.5", + "express-jwt": "^8.5.1", + "jsonwebtoken": "^9.0.2", + "morgan": "^1.10.0", + "multer": "^1.4.5-lts.2" + }, + "devDependencies": { + "@types/node": "^22.13.11", + "express": "^4.21.2", + "nodemon": "^3.1.9", + "prisma": "^6.5.0", + "tsx": "^4.19.3", + "typescript": "^5.8.2" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.2.tgz", + "integrity": "sha512-wCIboOL2yXZym2cgm6mlA742s9QeJ8DjGVaL39dLN4rRwrOgOyYSnOaFPhKZGLb2ngj4EyfAFjsNJwPXZvseag==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.2.tgz", + "integrity": "sha512-NQhH7jFstVY5x8CKbcfa166GoV0EFkaPkCKBQkdPJFvo5u+nGXLEH/ooniLb3QI8Fk58YAx7nsPLozUWfCBOJA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.2.tgz", + "integrity": "sha512-5ZAX5xOmTligeBaeNEPnPaeEuah53Id2tX4c2CVP3JaROTH+j4fnfHCkr1PjXMd78hMst+TlkfKcW/DlTq0i4w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.2.tgz", + "integrity": "sha512-Ffcx+nnma8Sge4jzddPHCZVRvIfQ0kMsUsCMcJRHkGJ1cDmhe4SsrYIjLUKn1xpHZybmOqCWwB0zQvsjdEHtkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.2.tgz", + "integrity": "sha512-MpM6LUVTXAzOvN4KbjzU/q5smzryuoNjlriAIx+06RpecwCkL9JpenNzpKd2YMzLJFOdPqBpuub6eVRP5IgiSA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.2.tgz", + "integrity": "sha512-5eRPrTX7wFyuWe8FqEFPG2cU0+butQQVNcT4sVipqjLYQjjh8a8+vUTfgBKM88ObB85ahsnTwF7PSIt6PG+QkA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.2.tgz", + "integrity": "sha512-mLwm4vXKiQ2UTSX4+ImyiPdiHjiZhIaE9QvC7sw0tZ6HoNMjYAqQpGyui5VRIi5sGd+uWq940gdCbY3VLvsO1w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.2.tgz", + "integrity": "sha512-6qyyn6TjayJSwGpm8J9QYYGQcRgc90nmfdUb0O7pp1s4lTY+9D0H9O02v5JqGApUyiHOtkz6+1hZNvNtEhbwRQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.2.tgz", + "integrity": "sha512-UHBRgJcmjJv5oeQF8EpTRZs/1knq6loLxTsjc3nxO9eXAPDLcWW55flrMVc97qFPbmZP31ta1AZVUKQzKTzb0g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.2.tgz", + "integrity": "sha512-gq/sjLsOyMT19I8obBISvhoYiZIAaGF8JpeXu1u8yPv8BE5HlWYobmlsfijFIZ9hIVGYkbdFhEqC0NvM4kNO0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.2.tgz", + "integrity": "sha512-bBYCv9obgW2cBP+2ZWfjYTU+f5cxRoGGQ5SeDbYdFCAZpYWrfjjfYwvUpP8MlKbP0nwZ5gyOU/0aUzZ5HWPuvQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.2.tgz", + "integrity": "sha512-SHNGiKtvnU2dBlM5D8CXRFdd+6etgZ9dXfaPCeJtz+37PIUlixvlIhI23L5khKXs3DIzAn9V8v+qb1TRKrgT5w==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.2.tgz", + "integrity": "sha512-hDDRlzE6rPeoj+5fsADqdUZl1OzqDYow4TB4Y/3PlKBD0ph1e6uPHzIQcv2Z65u2K0kpeByIyAjCmjn1hJgG0Q==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.2.tgz", + "integrity": "sha512-tsHu2RRSWzipmUi9UBDEzc0nLc4HtpZEI5Ba+Omms5456x5WaNuiG3u7xh5AO6sipnJ9r4cRWQB2tUjPyIkc6g==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.2.tgz", + "integrity": "sha512-k4LtpgV7NJQOml/10uPU0s4SAXGnowi5qBSjaLWMojNCUICNu7TshqHLAEbkBdAszL5TabfvQ48kK84hyFzjnw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.2.tgz", + "integrity": "sha512-GRa4IshOdvKY7M/rDpRR3gkiTNp34M0eLTaC1a08gNrh4u488aPhuZOCpkF6+2wl3zAN7L7XIpOFBhnaE3/Q8Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.2.tgz", + "integrity": "sha512-QInHERlqpTTZ4FRB0fROQWXcYRD64lAoiegezDunLpalZMjcUcld3YzZmVJ2H/Cp0wJRZ8Xtjtj0cEHhYc/uUg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.2.tgz", + "integrity": "sha512-talAIBoY5M8vHc6EeI2WW9d/CkiO9MQJ0IOWX8hrLhxGbro/vBXJvaQXefW2cP0z0nQVTdQ/eNyGFV1GSKrxfw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.2.tgz", + "integrity": "sha512-voZT9Z+tpOxrvfKFyfDYPc4DO4rk06qamv1a/fkuzHpiVBMOhpjK+vBmWM8J1eiB3OLSMFYNaOaBNLXGChf5tg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.2.tgz", + "integrity": "sha512-dcXYOC6NXOqcykeDlwId9kB6OkPUxOEqU+rkrYVqJbK2hagWOMrsTGsMr8+rW02M+d5Op5NNlgMmjzecaRf7Tg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.2.tgz", + "integrity": "sha512-t/TkWwahkH0Tsgoq1Ju7QfgGhArkGLkF1uYz8nQS/PPFlXbP5YgRpqQR3ARRiC2iXoLTWFxc6DJMSK10dVXluw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.2.tgz", + "integrity": "sha512-cfZH1co2+imVdWCjd+D1gf9NjkchVhhdpgb1q5y6Hcv9TP6Zi9ZG/beI3ig8TvwT9lH9dlxLq5MQBBgwuj4xvA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.2.tgz", + "integrity": "sha512-7Loyjh+D/Nx/sOTzV8vfbB3GJuHdOQyrOryFdZvPHLf42Tk9ivBU5Aedi7iyX+x6rbn2Mh68T4qq1SDqJBQO5Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.2.tgz", + "integrity": "sha512-WRJgsz9un0nqZJ4MfhabxaD9Ft8KioqU3JMinOTvobbX6MOSUigSBlogP8QB3uxpJDsFS6yN+3FDBdqE5lg9kg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.2.tgz", + "integrity": "sha512-kM3HKb16VIXZyIeVrM1ygYmZBKybX8N4p754bw390wGO3Tf2j4L2/WYL+4suWujpgf6GBYs3jv7TyUivdd05JA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "license": "BSD-3-Clause", + "dependencies": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/@prisma/client": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.6.0.tgz", + "integrity": "sha512-vfp73YT/BHsWWOAuthKQ/1lBgESSqYqAWZEYyTdGXyFAHpmewwWL2Iz6ErIzkj4aHbuc6/cGSsE6ZY+pBO04Cg==", + "hasInstallScript": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "peerDependencies": { + "prisma": "*", + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/@prisma/config": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.6.0.tgz", + "integrity": "sha512-d8FlXRHsx72RbN8nA2QCRORNv5AcUnPXgtPvwhXmYkQSMF/j9cKaJg+9VcUzBRXGy9QBckNzEQDEJZdEOZ+ubA==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "esbuild": ">=0.12 <1", + "esbuild-register": "3.6.0" + } + }, + "node_modules/@prisma/debug": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.6.0.tgz", + "integrity": "sha512-DL6n4IKlW5k2LEXzpN60SQ1kP/F6fqaCgU/McgaYsxSf43GZ8lwtmXLke9efS+L1uGmrhtBUP4npV/QKF8s2ZQ==", + "devOptional": true, + "license": "Apache-2.0" + }, + "node_modules/@prisma/engines": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.6.0.tgz", + "integrity": "sha512-nC0IV4NHh7500cozD1fBoTwTD1ydJERndreIjpZr/S3mno3P6tm8qnXmIND5SwUkibNeSJMpgl4gAnlqJ/gVlg==", + "devOptional": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "6.6.0", + "@prisma/engines-version": "6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a", + "@prisma/fetch-engine": "6.6.0", + "@prisma/get-platform": "6.6.0" + } + }, + "node_modules/@prisma/engines-version": { + "version": "6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a.tgz", + "integrity": "sha512-JzRaQ5Em1fuEcbR3nUsMNYaIYrOT1iMheenjCvzZblJcjv/3JIuxXN7RCNT5i6lRkLodW5ojCGhR7n5yvnNKrw==", + "devOptional": true, + "license": "Apache-2.0" + }, + "node_modules/@prisma/fetch-engine": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.6.0.tgz", + "integrity": "sha512-Ohfo8gKp05LFLZaBlPUApM0M7k43a0jmo86YY35u1/4t+vuQH9mRGU7jGwVzGFY3v+9edeb/cowb1oG4buM1yw==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "6.6.0", + "@prisma/engines-version": "6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a", + "@prisma/get-platform": "6.6.0" + } + }, + "node_modules/@prisma/get-platform": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.6.0.tgz", + "integrity": "sha512-3qCwmnT4Jh5WCGUrkWcc6VZaw0JY7eWN175/pcb5Z6FiLZZ3ygY93UX0WuV41bG51a6JN/oBH0uywJ90Y+V5eA==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "6.6.0" + } + }, + "node_modules/@types/jsonwebtoken": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz", + "integrity": "sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==", + "license": "MIT", + "dependencies": { + "@types/ms": "*", + "@types/node": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.14.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.1.tgz", + "integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "license": "ISC" + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/agent-base/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, + "node_modules/aproba": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", + "license": "ISC" + }, + "node_modules/are-we-there-yet": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", + "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "deprecated": "This package is no longer supported.", + "license": "ISC", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/basic-auth/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/bcrypt": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.1.1.tgz", + "integrity": "sha512-AGBHOG5hPYZ5Xl9KXzU5iKq9516yEmvCKDg3ecP5kX2aB6UqTeXZxk2ELnDgDm6BQSMlLt9rDB4LoSMx0rYwww==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.11", + "node-addon-api": "^5.0.0" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "license": "ISC", + "bin": { + "color-support": "bin.js" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "engines": [ + "node >= 0.8" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/concat-stream/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/concat-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/concat-stream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "license": "ISC" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-parser": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz", + "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==", + "license": "MIT", + "dependencies": { + "cookie": "0.7.2", + "cookie-signature": "1.0.6" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/cookie-parser/node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "license": "MIT" + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-libc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", + "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.2.tgz", + "integrity": "sha512-16854zccKPnC+toMywC+uKNeYSv+/eXkevRAfwRD/G9Cleq66m8XFIrigkbvauLLlCfDL45Q2cWegSg53gGBnQ==", + "devOptional": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.2", + "@esbuild/android-arm": "0.25.2", + "@esbuild/android-arm64": "0.25.2", + "@esbuild/android-x64": "0.25.2", + "@esbuild/darwin-arm64": "0.25.2", + "@esbuild/darwin-x64": "0.25.2", + "@esbuild/freebsd-arm64": "0.25.2", + "@esbuild/freebsd-x64": "0.25.2", + "@esbuild/linux-arm": "0.25.2", + "@esbuild/linux-arm64": "0.25.2", + "@esbuild/linux-ia32": "0.25.2", + "@esbuild/linux-loong64": "0.25.2", + "@esbuild/linux-mips64el": "0.25.2", + "@esbuild/linux-ppc64": "0.25.2", + "@esbuild/linux-riscv64": "0.25.2", + "@esbuild/linux-s390x": "0.25.2", + "@esbuild/linux-x64": "0.25.2", + "@esbuild/netbsd-arm64": "0.25.2", + "@esbuild/netbsd-x64": "0.25.2", + "@esbuild/openbsd-arm64": "0.25.2", + "@esbuild/openbsd-x64": "0.25.2", + "@esbuild/sunos-x64": "0.25.2", + "@esbuild/win32-arm64": "0.25.2", + "@esbuild/win32-ia32": "0.25.2", + "@esbuild/win32-x64": "0.25.2" + } + }, + "node_modules/esbuild-register": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.6.0.tgz", + "integrity": "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, + "peerDependencies": { + "esbuild": ">=0.12 <1" + } + }, + "node_modules/esbuild-register/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/esbuild-register/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true, + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-jwt": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/express-jwt/-/express-jwt-8.5.1.tgz", + "integrity": "sha512-Dv6QjDLpR2jmdb8M6XQXiCcpEom7mK8TOqnr0/TngDKsG2DHVkO8+XnVxkJVN7BuS1I3OrGw6N8j5DaaGgkDRQ==", + "license": "MIT", + "dependencies": { + "@types/jsonwebtoken": "^9", + "express-unless": "^2.1.3", + "jsonwebtoken": "^9.0.0" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/express-unless": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/express-unless/-/express-unless-2.1.3.tgz", + "integrity": "sha512-wj4tLMyCVYuIIKHGt0FhCtIViBcwzWejX0EjNxveAa6dG+0XBCQhMbx+PnkLkFCxLC69qoFrxds4pIyL88inaQ==", + "license": "MIT" + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gauge": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", + "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "deprecated": "This package is no longer supported.", + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-tsconfig": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.0.tgz", + "integrity": "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "license": "ISC" + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "license": "MIT", + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsonwebtoken/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/jwa": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.2.tgz", + "integrity": "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "license": "MIT", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "license": "MIT" + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/morgan": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", + "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==", + "license": "MIT", + "dependencies": { + "basic-auth": "~2.0.1", + "debug": "2.6.9", + "depd": "~2.0.0", + "on-finished": "~2.3.0", + "on-headers": "~1.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/morgan/node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/multer": { + "version": "1.4.5-lts.2", + "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.2.tgz", + "integrity": "sha512-VzGiVigcG9zUAoCNU+xShztrlr1auZOlurXynNvO9GiWD1/mTBbUljOKY+qMeazBqXgRnjzeEgJI/wyjJUHg9A==", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.0.0", + "concat-stream": "^1.5.2", + "mkdirp": "^0.5.4", + "object-assign": "^4.1.1", + "type-is": "^1.6.4", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/multer/node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-addon-api": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", + "license": "MIT" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/nodemon": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.9.tgz", + "integrity": "sha512-hdr1oIb2p6ZSxu3PB2JWWYS7ZQ0qvaZsc3hK8DR8f02kRzc8rjYmxAIvdz+aYC+8F2IjNaB7HMcSDg8nQpJxyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/nodemon/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "license": "ISC", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npmlog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", + "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "deprecated": "This package is no longer supported.", + "license": "ISC", + "dependencies": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prisma": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.6.0.tgz", + "integrity": "sha512-SYCUykz+1cnl6Ugd8VUvtTQq5+j1Q7C0CtzKPjQ8JyA2ALh0EEJkMCS+KgdnvKW1lrxjtjCyJSHOOT236mENYg==", + "devOptional": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/config": "6.6.0", + "@prisma/engines": "6.6.0" + }, + "bin": { + "prisma": "build/index.js" + }, + "engines": { + "node": ">=18.18" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + }, + "peerDependencies": { + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "license": "ISC" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true, + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC" + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/tsx": { + "version": "4.19.3", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.3.tgz", + "integrity": "sha512-4H8vUNGNjQ4V2EOoGw005+c+dGuPSnhpPBPHBtsZdGZBk/iJb4kguGlPWaZTZ3q5nMtFOEsY0nRDlh9PJyd6SQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.25.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "devOptional": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "license": "ISC", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..11e48fd2 --- /dev/null +++ b/package.json @@ -0,0 +1,38 @@ +{ + "name": "be", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "start": "node src/app.js", + "dev": "nodemon src/app.js", + "generate": "npx prisma generate ", + "migrate": "npx prisma migrate dev ", + "reset": "npx prisma migrate reset ", + "seed": "node src/db/prisma/seed.js" + }, + "author": "", + "license": "ISC", + "description": "", + "devDependencies": { + "@types/node": "^22.13.11", + "express": "^4.21.2", + "nodemon": "^3.1.9", + "prisma": "^6.5.0", + "tsx": "^4.19.3", + "typescript": "^5.8.2" + }, + "prisma": { + "schema": "./src/db/prisma/schema.prisma" + }, + "dependencies": { + "@prisma/client": "^6.6.0", + "bcrypt": "^5.1.1", + "cookie-parser": "^1.4.7", + "cors": "^2.8.5", + "express-jwt": "^8.5.1", + "jsonwebtoken": "^9.0.2", + "morgan": "^1.10.0", + "multer": "^1.4.5-lts.2" + }, + "type": "module" +} diff --git a/src/app.js b/src/app.js new file mode 100644 index 00000000..82cb8ae9 --- /dev/null +++ b/src/app.js @@ -0,0 +1,37 @@ +import express from 'express'; +import cors from 'cors'; +import morgan from 'morgan'; +import cookieParser from 'cookie-parser'; +import path from 'path'; +import routes from './routes/index.js'; +import errorHandler from './middlewares/errorHandler.js'; + + + +const app = express(); +const PORT = process.env.BE_PORT || 5050; +const HTTP_PORT = process.env.HTTP_PORT || 3000; +const FE_PORT = `http://localhost:${HTTP_PORT}` + +// ๊ฐœ๋ฐœ ๋‹จ๊ณ„์—์„  ๋ชจ๋“  ๊ฒฝ๋กœ ํ—ˆ์šฉ. +app.use(cors()); + +// app.use(cors({ +// origin: FE_PORT, // ํ—ˆ์šฉํ•  ํ”„๋ก ํŠธ์—”๋“œ ์ฃผ์†Œ ์„ค์ • +// methods: ['GET', 'POST', 'PUT', 'DELETE'], +// allowedHeaders: ['Content-Type', 'Authorization'] +// })); + +app.use(morgan('dev')); +app.use(express.json()); +app.use(cookieParser()); + +app.use('/uploads', express.static(path.join(__dirname, 'uploads'))); + +app.use('/', routes); + +app.use(errorHandler); + +app.listen(PORT, () => { + console.log(`Server started at PORT ${PORT}`) +}) \ No newline at end of file diff --git a/src/jsconfig.json b/src/jsconfig.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/src/jsconfig.json @@ -0,0 +1 @@ +{} diff --git a/src/middlewares/errorHandler.js b/src/middlewares/errorHandler.js new file mode 100644 index 00000000..6442c428 --- /dev/null +++ b/src/middlewares/errorHandler.js @@ -0,0 +1,17 @@ +export default function errorHandler(error, req, res, next) { + console.error(error); + if (error.name === "UnauthorizedError") { + res.status(401).send("invalid token..."); + } + + const status = error.code ?? 500; + + console.error(error); + return res.status(status).json({ + path: req.path, + method: req.method, + message: error.message ?? "Internal Server Error", + data: error.data ?? undefined, + date: new Date(), + }); +} diff --git a/src/routes/index.js b/src/routes/index.js new file mode 100644 index 00000000..9bf43bb0 --- /dev/null +++ b/src/routes/index.js @@ -0,0 +1,19 @@ +import express from 'express'; +import authRouter from './authRouter.js'; +import articleRouter from './articleRouter.js'; +import productRouter from './productRouter.js'; +import commentRouter from './commentRouter.js'; +import likeRouter from './likeRouter.js'; +import uploadRouter from './uploadRouter.js'; + +const router = express.Router(); + +router.use('/auth', authRouter); +router.use('/article', articleRouter); +router.use('/product', productRouter); +router.use('/comment', commentRouter); +router.use('/like', likeRouter); +router.use('/upload', uploadRouter); + + +export default router; \ No newline at end of file From f4715bbf7545efc481b03373b66fce927f1110f5 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 09:47:11 +0900 Subject: [PATCH 11/16] =?UTF-8?q?feat:=20=EC=A2=8B=EC=95=84=EC=9A=94=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=ED=8A=B8=EB=9E=9C=EC=9E=AD=EC=85=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/likeService.js | 174 +++++++++++++----------------------- 1 file changed, 63 insertions(+), 111 deletions(-) diff --git a/src/services/likeService.js b/src/services/likeService.js index c4f335b5..c84b86ca 100644 --- a/src/services/likeService.js +++ b/src/services/likeService.js @@ -1,129 +1,81 @@ +import prisma from '../db/prisma.js'; import likeRepository from '../repositories/likeRepository.js'; const likeService = { addLike: async (userId, articleId, productId) => { - if (!articleId && !productId) { - throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; - } - if (articleId) { - const existingLike = await likeRepository.findLikeByUserIdAndArticleId(userId, articleId); - if (existingLike) { - throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; + return prisma.$transaction(async (tx) => { + if (!articleId && !productId) { + throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; } - } - if (productId) { - const existingLike = await likeRepository.findLikeByUserIdAndProductId(userId, productId); - if (existingLike) { - throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; + if (articleId) { + const existingLike = await tx.like.findUnique({ + where: { + userId_articleId: { + userId, + articleId, + }, + }, + }); + if (existingLike) { + throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; + } + return tx.like.create({ + data: { + userId, + articleId, + productId, + }, + }); } - } - return likeRepository.createLike(userId, articleId, productId); + if (productId) { + const existingLike = await tx.like.findUnique({ + where: { + userId_productId: { + userId, + productId, + }, + }, + }); + if (existingLike) { + throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; + } + return tx.like.create({ + data: { + userId, + articleId, + productId, + }, + }); + } + }); }, removeLike: async (userId, articleId, productId) => { - if (!articleId && !productId) { - throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; - } - const result = await likeRepository.deleteLike(userId, articleId, productId); - if (result.count === 0) { - throw { status: 404, message: '์ข‹์•„์š”๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; - } - return result; + return prisma.$transaction(async (tx) => { + if (!articleId && !productId) { + throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; + } + const deleteResult = await tx.like.deleteMany({ + where: { + userId, + articleId, + productId, + }, + }); + if (deleteResult.count === 0) { + throw { status: 404, message: '์ข‹์•„์š”๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; + } + return deleteResult; + }); }, getArticleLikeCount: async (articleId) => { - return likeRepository.countLikesByArticleId(articleId); + return likeRepository.countLikesByArticleId(articleId); }, getProductLikeCount: async (productId) => { - return likeRepository.countLikesByProductId(productId); + return likeRepository.countLikesByProductId(productId); }, }; -export default likeService; - - - - - -// import prisma from '../db/prisma.js'; -// import likeRepository from '../repositories/likeRepository.js'; - -// const likeService = { -// addLike: async (userId, articleId, productId) => { -// return prisma.$transaction(async (tx) => { -// if (!articleId && !productId) { -// throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; -// } -// if (articleId) { -// const existingLike = await tx.like.findUnique({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์กฐํšŒ -// where: { -// userId_articleId: { -// userId, -// articleId, -// }, -// }, -// }); -// if (existingLike) { -// throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; -// } -// return tx.like.create({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์ƒ์„ฑ -// data: { -// userId, -// articleId, -// productId, -// }, -// }); -// } -// if (productId) { -// const existingLike = await tx.like.findUnique({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์กฐํšŒ -// where: { -// userId_productId: { -// userId, -// productId, -// }, -// }, -// }); -// if (existingLike) { -// throw { status: 409, message: '์ด๋ฏธ ์ข‹์•„์š”๋ฅผ ๋ˆ„๋ฅด์…จ์Šต๋‹ˆ๋‹ค.' }; -// } -// return tx.like.create({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์ƒ์„ฑ -// data: { -// userId, -// articleId, -// productId, -// }, -// }); -// } -// }); -// }, - -// removeLike: async (userId, articleId, productId) => { -// return prisma.$transaction(async (tx) => { -// if (!articleId && !productId) { -// throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; -// } -// const deleteResult = await tx.like.deleteMany({ // tx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ์‚ญ์ œ -// where: { -// userId, -// articleId, -// productId, -// }, -// }); -// if (deleteResult.count === 0) { -// throw { status: 404, message: '์ข‹์•„์š”๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.' }; -// } -// return deleteResult; -// }); -// }, - -// getArticleLikeCount: async (articleId) => { -// return likeRepository.countLikesByArticleId(articleId); // ํŠธ๋žœ์žญ์…˜ ๋ถˆํ•„์š” -// }, - -// getProductLikeCount: async (productId) => { -// return likeRepository.countLikesByProductId(productId); // ํŠธ๋žœ์žญ์…˜ ๋ถˆํ•„์š” -// }, -// }; - -// export default likeService; \ No newline at end of file +export default likeService; \ No newline at end of file From 8386e41802e517ae37905c514315c114eda7ddc6 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Wed, 14 May 2025 16:24:27 +0900 Subject: [PATCH 12/16] =?UTF-8?q?feat:=20=EC=A0=95=EB=A0=AC,=20=EA=B2=80?= =?UTF-8?q?=EC=83=89,=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/articleController.js | 3 ++- src/controllers/productController.js | 3 ++- src/repositories/articleRepository.js | 30 +++++++++++++++++++++++---- src/repositories/productRepository.js | 30 +++++++++++++++++++++++---- src/services/articleService.js | 6 ++++-- src/services/productService.js | 6 ++++-- 6 files changed, 64 insertions(+), 14 deletions(-) diff --git a/src/controllers/articleController.js b/src/controllers/articleController.js index aa145ac3..174b40c9 100644 --- a/src/controllers/articleController.js +++ b/src/controllers/articleController.js @@ -14,7 +14,8 @@ const articleController = { getArticles: async (req, res, next) => { try { - const articles = await articleService.getArticles(); + const { page = 1, pageSize: limit = 10, orderBy: sort = 'recent', keyword: search } = req.query; + const articles = await articleService.getArticles(sort, search, parseInt(page), parseInt(limit)); return res.status(200).json(articles); } catch (error) { next(error); diff --git a/src/controllers/productController.js b/src/controllers/productController.js index 143b13d1..9c27cefd 100644 --- a/src/controllers/productController.js +++ b/src/controllers/productController.js @@ -14,7 +14,8 @@ const productController = { getProducts: async (req, res, next) => { try { - const products = await productService.getProducts(); + const { page = 1, pageSize: limit = 10, orderBy: sort = 'recent', keyword: search } = req.query; + const products = await productService.getProducts(sort, search, parseInt(page), parseInt(limit)); return res.status(200).json(products); } catch (error) { next(error); diff --git a/src/repositories/articleRepository.js b/src/repositories/articleRepository.js index 09df9093..3ad25028 100644 --- a/src/repositories/articleRepository.js +++ b/src/repositories/articleRepository.js @@ -14,8 +14,29 @@ const articleRepository = { }); }, - findAllArticles: async () => { + findAllArticles: async (sort, search, skip, limit) => { + const orderBy = {}; + if (sort === 'like') { + orderBy._count = { likes: 'desc' }; + } else { + orderBy.createdAt = 'desc'; + } + + // NaN ๋ฐฉ์ง€ ์ฒ˜๋ฆฌ + if (isNaN(skip) || skip < 0) skip = 0; + if (isNaN(limit) || limit < 1) limit = 10; + + const where = {}; + if (search) { + where.OR = [ + { title: { contains: search } }, + { content: { contains: search } }, + { user: { nickname: { contains: search } } }, + ]; + } + return prisma.article.findMany({ + where, include: { user: { select: { @@ -26,12 +47,13 @@ const articleRepository = { likes: true, comments: true, }, - orderBy: { - createdAt: 'desc', - }, + orderBy, + skip, + take: limit, }); }, + findArticleById: async (id) => { return prisma.article.findUnique({ where: { id }, diff --git a/src/repositories/productRepository.js b/src/repositories/productRepository.js index 2da158f2..eeec326b 100644 --- a/src/repositories/productRepository.js +++ b/src/repositories/productRepository.js @@ -16,8 +16,30 @@ const productRepository = { }); }, - findAllProducts: async () => { + findAllProducts: async (sort, search, skip, limit) => { + const orderBy = {}; + if (sort === 'favorite') { + orderBy._count = { likes: 'desc' }; + } else { + orderBy.createdAt = 'desc'; + } + + // NaN ๋ฐฉ์ง€ ์ฒ˜๋ฆฌ + if (isNaN(skip) || skip < 0) skip = 0; + if (isNaN(limit) || limit < 1) limit = 10; + + const where = {}; + if (search) { + where.OR = [ + { name: { contains: search } }, + { description: { contains: search } }, + { user: { nickname: { contains: search } } }, + { tags: { has: search } }, + ]; + } + return prisma.product.findMany({ + where, include: { user: { select: { @@ -28,9 +50,9 @@ const productRepository = { likes: true, comments: true, }, - orderBy: { - createdAt: 'desc', - }, + orderBy, + skip, + take: limit, }); }, diff --git a/src/services/articleService.js b/src/services/articleService.js index d8da6da5..e15dd68b 100644 --- a/src/services/articleService.js +++ b/src/services/articleService.js @@ -5,8 +5,10 @@ const articleService = { return articleRepository.createArticle(userId, title, content, images); }, - getArticles: async () => { - return articleRepository.findAllArticles(); + getArticles: async (sort, search, page, limit) => { + const skip = (page - 1) * limit; + const articles = await articleRepository.findAllArticles(sort, search, skip, limit); + return articles; }, getArticleById: async (id) => { diff --git a/src/services/productService.js b/src/services/productService.js index bac9b4eb..e4446bb6 100644 --- a/src/services/productService.js +++ b/src/services/productService.js @@ -5,8 +5,10 @@ const productService = { return productRepository.createProduct(userId, name, description, price, tags, images); }, - getProducts: async () => { - return productRepository.findAllProducts(); + getProducts: async (sort, search, page, limit) => { + const skip = (page - 1) * limit; + const products = await productRepository.findAllProducts(sort, search, skip, limit); + return products; }, getProductById: async (id) => { From eb00c58f77b1656e50ac37265652bdfa3b329413 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Mon, 19 May 2025 02:33:11 +0900 Subject: [PATCH 13/16] =?UTF-8?q?refactor:=20api=20path=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.js | 4 ++++ src/controllers/articleController.js | 6 +++--- src/controllers/authController.js | 2 +- src/controllers/productController.js | 6 +++--- src/routes/articleRouter.js | 2 +- src/routes/authRouter.js | 2 +- src/routes/commentRouter.js | 4 ++-- src/routes/index.js | 6 +++--- src/routes/productRouter.js | 2 +- src/services/likeService.js | 2 ++ 10 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/app.js b/src/app.js index 82cb8ae9..30aa01e9 100644 --- a/src/app.js +++ b/src/app.js @@ -3,6 +3,7 @@ import cors from 'cors'; import morgan from 'morgan'; import cookieParser from 'cookie-parser'; import path from 'path'; +import { fileURLToPath } from 'url'; import routes from './routes/index.js'; import errorHandler from './middlewares/errorHandler.js'; @@ -13,6 +14,9 @@ const PORT = process.env.BE_PORT || 5050; const HTTP_PORT = process.env.HTTP_PORT || 3000; const FE_PORT = `http://localhost:${HTTP_PORT}` +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + // ๊ฐœ๋ฐœ ๋‹จ๊ณ„์—์„  ๋ชจ๋“  ๊ฒฝ๋กœ ํ—ˆ์šฉ. app.use(cors()); diff --git a/src/controllers/articleController.js b/src/controllers/articleController.js index 174b40c9..67a8115e 100644 --- a/src/controllers/articleController.js +++ b/src/controllers/articleController.js @@ -4,7 +4,7 @@ const articleController = { createArticle: async (req, res, next) => { try { const { title, content, images } = req.body; - const userId = req.auth.id; + const {userId} = req.auth; const newArticle = await articleService.createArticle(userId, title, content, images); return res.status(201).json(newArticle); } catch (error) { @@ -36,7 +36,7 @@ const articleController = { try { const { articleId } = req.params; const { title, content, images } = req.body; - const userId = req.auth.id; + const {userId} = req.auth; const updatedArticle = await articleService.updateArticle( parseInt(articleId), userId, @@ -53,7 +53,7 @@ const articleController = { deleteArticle: async (req, res, next) => { try { const { articleId } = req.params; - const userId = req.auth.id; + const {userId} = req.auth; await articleService.deleteArticle(parseInt(articleId), userId); return res.status(204).send(); } catch (error) { diff --git a/src/controllers/authController.js b/src/controllers/authController.js index ba615c31..c8396895 100644 --- a/src/controllers/authController.js +++ b/src/controllers/authController.js @@ -37,7 +37,7 @@ const authController = { async getUserInfo(req, res, next) { try { - const userId = req.auth.id; + const {userId} = req.auth; const user = await authService.getUserById(userId); res.json({ id: user.id, email: user.email, nickname: user.nickname, profileImage: user.profileImage }); } catch (error) { diff --git a/src/controllers/productController.js b/src/controllers/productController.js index 9c27cefd..ca91a77d 100644 --- a/src/controllers/productController.js +++ b/src/controllers/productController.js @@ -4,7 +4,7 @@ const productController = { createProduct: async (req, res, next) => { try { const { name, description, price, tags, images } = req.body; - const userId = req.auth.id; + const {userId} = req.auth; const newProduct = await productService.createProduct(userId, name, description, price, tags, images); return res.status(201).json(newProduct); } catch (error) { @@ -36,7 +36,7 @@ const productController = { try { const { productId } = req.params; const { name, description, price, tags, images } = req.body; - const userId = req.auth.id; + const {userId} = req.auth; const updatedProduct = await productService.updateProduct( parseInt(productId), userId, @@ -55,7 +55,7 @@ const productController = { deleteProduct: async (req, res, next) => { try { const { productId } = req.params; - const userId = req.auth.id; + const {userId} = req.auth; await productService.deleteProduct(parseInt(productId), userId); return res.status(204).send(); } catch (error) { diff --git a/src/routes/articleRouter.js b/src/routes/articleRouter.js index 9bfac9a6..ee31fa22 100644 --- a/src/routes/articleRouter.js +++ b/src/routes/articleRouter.js @@ -14,7 +14,7 @@ articleRouter.get('/', articleController.getArticles); articleRouter.get('/:articleId', articleController.getArticleById); // ๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ • (์ธ์ฆ ํ•„์š”) -articleRouter.put('/:articleId', auth.verifyAccessToken, articleController.updateArticle); +articleRouter.patch('/:articleId', auth.verifyAccessToken, articleController.updateArticle); // ๊ฒŒ์‹œ๊ธ€ ์‚ญ์ œ (์ธ์ฆ ํ•„์š”) articleRouter.delete('/:articleId', auth.verifyAccessToken, articleController.deleteArticle); diff --git a/src/routes/authRouter.js b/src/routes/authRouter.js index 07564b4a..2ab0030f 100644 --- a/src/routes/authRouter.js +++ b/src/routes/authRouter.js @@ -5,7 +5,7 @@ import authController from '../controllers/authController.js'; const authRouter = express.Router(); // ํšŒ์›๊ฐ€์ž… -authRouter.post('/signup', authController.signup); +authRouter.post('/signUp', authController.signup); // ๋กœ๊ทธ์ธ authRouter.post('/signIn', auth.validateEmailAndPassword, authController.login); diff --git a/src/routes/commentRouter.js b/src/routes/commentRouter.js index b5ae524e..790277ef 100644 --- a/src/routes/commentRouter.js +++ b/src/routes/commentRouter.js @@ -5,7 +5,7 @@ import auth from '../middlewares/auth.js'; const commentRouter = express.Router(); // ๋Œ“๊ธ€ ์ƒ์„ฑ (์ธ์ฆ ํ•„์š”) -commentRouter.post('/', auth.verifyAccessToken, commentController.createComment); +commentRouter.post('/:itemType/:itemId', auth.verifyAccessToken, commentController.createComment); // ํŠน์ • ๊ฒŒ์‹œ๊ธ€์˜ ๋ชจ๋“  ๋Œ“๊ธ€ ์กฐํšŒ commentRouter.get('/articles/:articleId', commentController.getCommentsByArticleId); @@ -14,7 +14,7 @@ commentRouter.get('/articles/:articleId', commentController.getCommentsByArticle commentRouter.get('/products/:productId', commentController.getCommentsByProductId); // ํŠน์ • ๋Œ“๊ธ€ ์ˆ˜์ • (์ธ์ฆ ํ•„์š”) -commentRouter.put('/:commentId', auth.verifyAccessToken, commentController.updateComment); +commentRouter.patch('/:commentId', auth.verifyAccessToken, commentController.updateComment); // ํŠน์ • ๋Œ“๊ธ€ ์‚ญ์ œ (์ธ์ฆ ํ•„์š”) commentRouter.delete('/:commentId', auth.verifyAccessToken, commentController.deleteComment); diff --git a/src/routes/index.js b/src/routes/index.js index 9bf43bb0..83a4b83d 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -9,9 +9,9 @@ import uploadRouter from './uploadRouter.js'; const router = express.Router(); router.use('/auth', authRouter); -router.use('/article', articleRouter); -router.use('/product', productRouter); -router.use('/comment', commentRouter); +router.use('/articles', articleRouter); +router.use('/products', productRouter); +router.use('/comments', commentRouter); router.use('/like', likeRouter); router.use('/upload', uploadRouter); diff --git a/src/routes/productRouter.js b/src/routes/productRouter.js index 9d855fdb..edd46510 100644 --- a/src/routes/productRouter.js +++ b/src/routes/productRouter.js @@ -14,7 +14,7 @@ productRouter.get('/', productController.getProducts); productRouter.get('/:productId', productController.getProductById); // ์ƒํ’ˆ ์ˆ˜์ • (์ธ์ฆ ํ•„์š”) -productRouter.put('/:productId', auth.verifyAccessToken, productController.updateProduct); +productRouter.patch('/:productId', auth.verifyAccessToken, productController.updateProduct); // ์ƒํ’ˆ ์‚ญ์ œ (์ธ์ฆ ํ•„์š”) productRouter.delete('/:productId', auth.verifyAccessToken, productController.deleteProduct); diff --git a/src/services/likeService.js b/src/services/likeService.js index c84b86ca..ddd5c601 100644 --- a/src/services/likeService.js +++ b/src/services/likeService.js @@ -3,6 +3,8 @@ import likeRepository from '../repositories/likeRepository.js'; const likeService = { addLike: async (userId, articleId, productId) => { + console.log("articleId:", articleId) + console.log("productId:",productId) return prisma.$transaction(async (tx) => { if (!articleId && !productId) { throw { status: 400, message: '๊ฒŒ์‹œ๊ธ€ ID ๋˜๋Š” ์ƒํ’ˆ ID ์ค‘ ํ•˜๋‚˜๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.' }; From 07f9191d9dedbd878ed18b5555de6b523efaa7c5 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Mon, 19 May 2025 02:33:53 +0900 Subject: [PATCH 14/16] =?UTF-8?q?feat:=20=EA=B2=8C=EC=8B=9C=EA=B8=80?= =?UTF-8?q?=EA=B3=BC=20=EC=83=81=ED=92=88=20=EB=8C=93=EA=B8=80=EA=B3=BC=20?= =?UTF-8?q?=EC=A2=8B=EC=95=84=EC=9A=94=20=EA=B8=B0=EB=8A=A5=20=EA=B0=81?= =?UTF-8?q?=EA=B0=81=20=ED=95=98=EB=82=98=EB=A1=9C=20=EA=B5=AC=ED=98=84.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/commentController.js | 20 +++++++++++++---- src/controllers/likeController.js | 33 +++++++++++++++++++++++----- src/routes/likeRouter.js | 4 ++-- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/controllers/commentController.js b/src/controllers/commentController.js index 11cc89f4..19f6423f 100644 --- a/src/controllers/commentController.js +++ b/src/controllers/commentController.js @@ -3,8 +3,20 @@ import commentService from '../services/commentService.js'; const commentController = { createComment: async (req, res, next) => { try { - const { content, articleId, productId } = req.body; - const userId = req.auth.id; + const { content } = req.body; + const { userId } = req.auth; + const { itemType, itemId } = req.params; + let articleId = null; + let productId = null; + + if (itemType === 'articles') { + articleId = itemId; + } else if (itemType === 'products') { + productId = itemId; + } else { + return res.status(400).json({ message: '์ž˜๋ชป๋œ itemType์ž…๋‹ˆ๋‹ค.' }); + } + const newComment = await commentService.createComment( userId, content, @@ -41,7 +53,7 @@ const commentController = { try { const { commentId } = req.params; const { content } = req.body; - const userId = req.auth.id; + const {userId} = req.auth; const updatedComment = await commentService.updateComment(parseInt(commentId), userId, content); return res.status(200).json(updatedComment); } catch (error) { @@ -52,7 +64,7 @@ const commentController = { deleteComment: async (req, res, next) => { try { const { commentId } = req.params; - const userId = req.auth.id; + const {userId} = req.auth; await commentService.deleteComment(parseInt(commentId), userId); return res.status(204).send(); } catch (error) { diff --git a/src/controllers/likeController.js b/src/controllers/likeController.js index 1a8aa4ed..e486f211 100644 --- a/src/controllers/likeController.js +++ b/src/controllers/likeController.js @@ -2,9 +2,21 @@ import likeService from '../services/likeService.js'; const likeController = { addLike: async (req, res, next) => { - try { - const { articleId, productId } = req.body; - const userId = req.auth.id; + try { + const { itemType, itemId } = req.params; + const { userId } = req.auth; + let articleId = null; + let productId = null; + + if (itemType === 'articles') { + articleId = itemId; + } else if (itemType === 'products') { + productId = itemId; + } else { + return res.status(400).json({ message: '์ž˜๋ชป๋œ itemType์ž…๋‹ˆ๋‹ค.' }); + } + + await likeService.addLike(userId, parseInt(articleId) || null, parseInt(productId) || null); return res.status(201).json({ message: '์ข‹์•„์š”๋ฅผ ๋ˆŒ๋ €์Šต๋‹ˆ๋‹ค.' }); } catch (error) { @@ -14,8 +26,19 @@ const likeController = { removeLike: async (req, res, next) => { try { - const { articleId, productId } = req.body; - const userId = req.auth.id; + const { itemType, itemId } = req.params; + const { userId } = req.auth; + let articleId = null; + let productId = null; + + if (itemType === 'articles') { + articleId = itemId; + } else if (itemType === 'products') { + productId = itemId; + } else { + return res.status(400).json({ message: '์ž˜๋ชป๋œ itemType์ž…๋‹ˆ๋‹ค.' }); + } + await likeService.removeLike(userId, parseInt(articleId) || null, parseInt(productId) || null); return res.status(200).json({ message: '์ข‹์•„์š”๋ฅผ ์ทจ์†Œํ–ˆ์Šต๋‹ˆ๋‹ค.' }); } catch (error) { diff --git a/src/routes/likeRouter.js b/src/routes/likeRouter.js index 6ef08929..26f80617 100644 --- a/src/routes/likeRouter.js +++ b/src/routes/likeRouter.js @@ -5,10 +5,10 @@ import auth from '../middlewares/auth.js'; const likeRouter = express.Router(); // ์ข‹์•„์š” ์ถ”๊ฐ€ (์ธ์ฆ ํ•„์š”) -likeRouter.post('/', auth.verifyAccessToken, likeController.addLike); +likeRouter.post('/:itemType/:itemId', auth.verifyAccessToken, likeController.addLike); // ์ข‹์•„์š” ์ทจ์†Œ (์ธ์ฆ ํ•„์š”) -likeRouter.delete('/', auth.verifyAccessToken, likeController.removeLike); +likeRouter.delete('/:itemType/:itemId', auth.verifyAccessToken, likeController.removeLike); // ํŠน์ • ๊ฒŒ์‹œ๊ธ€์˜ ์ข‹์•„์š” ์ˆ˜ ์กฐํšŒ likeRouter.get('/articles/:articleId/count', likeController.getArticleLikeCount); From ed1854aabb4531618b4fc210a0c6451a29fbb15a Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Mon, 19 May 2025 02:35:22 +0900 Subject: [PATCH 15/16] =?UTF-8?q?Docs:=20.gitignore=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a3fe0992..902251fe 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ dist-ssr # Environment variables .env +*.http # Editor directories and files .vscode/* From 7834a52c84072e839de23a695e1c16fdf5b495c6 Mon Sep 17 00:00:00 2001 From: rlawodnr1109 Date: Mon, 19 May 2025 02:36:06 +0900 Subject: [PATCH 16/16] =?UTF-8?q?feat:=20api=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20.http=20=ED=8C=8C=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - http/article.http | 30 ++++++++++++++++++++++++++++++ http/auth.http | 39 +++++++++++++++++++++++++++++++++++++++ http/comment.http | 46 ++++++++++++++++++++++++++++++++++++++++++++++ http/like.http | 24 ++++++++++++++++++++++++ http/product.http | 32 ++++++++++++++++++++++++++++++++ http/user.http | 33 +++++++++++++++++++++++++++++++++ 7 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 http/article.http create mode 100644 http/auth.http create mode 100644 http/comment.http create mode 100644 http/like.http create mode 100644 http/product.http create mode 100644 http/user.http diff --git a/.gitignore b/.gitignore index 902251fe..a3fe0992 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ dist-ssr # Environment variables .env -*.http # Editor directories and files .vscode/* diff --git a/http/article.http b/http/article.http new file mode 100644 index 00000000..93e5c3bc --- /dev/null +++ b/http/article.http @@ -0,0 +1,30 @@ +### ์ƒˆ ๊ฒŒ์‹œ๊ธ€ ์ƒ์„ฑ +POST http://localhost:5050/articles +Content-Type: application/json +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MTg1OTgzLCJleHAiOjE3NDcxODk1ODN9.8KUfvmhW3vn6-TcqzU5nUg5TzZV8bfsWiAa15kVxz0E + +{ + "title": "์ƒˆ๋กœ์šด ๊ฒŒ์‹œ๊ธ€ ์ œ๋ชฉ5", + "content": "์ƒˆ๋กœ์šด ๊ฒŒ์‹œ๊ธ€ ๋‚ด์šฉ" +} + +### ๋ชจ๋“  ๊ฒŒ์‹œ๊ธ€ ์กฐํšŒ +GET http://localhost:5050/articles?orderBy=recent&keyword= + +### ํŠน์ • ๊ฒŒ์‹œ๊ธ€ ์กฐํšŒ +GET http://localhost:5050/articles/1 + +### ํŠน์ • ๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ • +PATCH http://localhost:5050/articles/1 +Content-Type: application/json +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MTg1OTgzLCJleHAiOjE3NDcxODk1ODN9.8KUfvmhW3vn6-TcqzU5nUg5TzZV8bfsWiAa15kVxz0E + +{ + "title": "์ˆ˜์ •๋œ ๊ฒŒ์‹œ๊ธ€ ์ œ๋ชฉ", + "content": "์ˆ˜์ •๋œ ๊ฒŒ์‹œ๊ธ€ ๋‚ด์šฉ" +} + +### ํŠน์ • ๊ฒŒ์‹œ๊ธ€ ์‚ญ์ œ +DELETE http://localhost:5050/articles/4 +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MTg1OTgzLCJleHAiOjE3NDcxODk1ODN9.8KUfvmhW3vn6-TcqzU5nUg5TzZV8bfsWiAa15kVxz0E + diff --git a/http/auth.http b/http/auth.http new file mode 100644 index 00000000..58386bb0 --- /dev/null +++ b/http/auth.http @@ -0,0 +1,39 @@ +POST http://localhost:5050/auth/signUp +Content-Type: application/json + +{ + "email": "test2@test.com", + "nickname": "test2", + "password": "test", + "passwordConfirmation" : "test" +} + + +### +POST http://localhost:5050/auth/signIn +Content-Type: application/json + +{ + "email": "test2@test.com", + "password": "test" +} + + +### +POST http://localhost:5050/auth/refresh-token +Content-Type: application/json + +{ + "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MDE1NTM2LCJleHAiOjE3NDc2MjAzMzZ9.PHPZiGAVNK6ZkOzkGx8UC86JEmpfbrDvZ7zCnR7yzes" +} + + +### +POST http://localhost:5050/auth/refresh-token +Cookie: refreshToken={"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MDE1NTM2LCJleHAiOjE3NDc2MjAzMzZ9.PHPZiGAVNK6ZkOzkGx8UC86JEmpfbrDvZ7zCnR7yzes"} + +### +GET http://localhost:3000/auth/google + +### +GET http://localhost:3000/auth/google/callback diff --git a/http/comment.http b/http/comment.http new file mode 100644 index 00000000..f76cf7a2 --- /dev/null +++ b/http/comment.http @@ -0,0 +1,46 @@ +### ํŠน์ • ์ƒํ’ˆ์— ๋Œ“๊ธ€ ์ž‘์„ฑ +POST http://localhost:5050/comments/products/2 +Content-Type: application/json +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MzI2MDk2LCJleHAiOjE3NDczMjk2OTZ9.aWrWLpdFO-lisU2dvqL-oLxRBvPUjw1e7_H-jAlxhQ4 + +{ + "content": "์ƒํ’ˆ์— ๋Œ€ํ•œ ๋Œ“๊ธ€ ๋‚ด์šฉ3" +} + +### + +### ํŠน์ • ์ƒํ’ˆ์˜ ๋ชจ๋“  ๋Œ“๊ธ€ ์กฐํšŒ +GET http://localhost:5050/comments/products/2 + +### + +### ํŠน์ • ๊ฒŒ์‹œ๊ธ€์— ๋Œ“๊ธ€ ์ž‘์„ฑ +POST http://localhost:5050/comments/articles/2 +Content-Type: application/json +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MzI2MDk2LCJleHAiOjE3NDczMjk2OTZ9.aWrWLpdFO-lisU2dvqL-oLxRBvPUjw1e7_H-jAlxhQ4 + +{ + "content": "๊ฒŒ์‹œ๊ธ€์— ๋Œ€ํ•œ ๋Œ“๊ธ€ ๋‚ด์šฉ1" +} + +### + +### ํŠน์ • ๊ฒŒ์‹œ๊ธ€์˜ ๋ชจ๋“  ๋Œ“๊ธ€ ์กฐํšŒ +GET http://localhost:5050/comments/articles/2 + +### + +### ํŠน์ • ๋Œ“๊ธ€ ์ˆ˜์ • +PATCH http://localhost:5050/comments/2 +Content-Type: application/json +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MzI2MDk2LCJleHAiOjE3NDczMjk2OTZ9.aWrWLpdFO-lisU2dvqL-oLxRBvPUjw1e7_H-jAlxhQ4 + +{ + "content": "์ˆ˜์ •๋œ ๋Œ“๊ธ€ ๋‚ด์šฉ" +} + +### + +### ํŠน์ • ๋Œ“๊ธ€ ์‚ญ์ œ +DELETE http://localhost:5050/comments/2 +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MzI2MDk2LCJleHAiOjE3NDczMjk2OTZ9.aWrWLpdFO-lisU2dvqL-oLxRBvPUjw1e7_H-jAlxhQ4 \ No newline at end of file diff --git a/http/like.http b/http/like.http new file mode 100644 index 00000000..2441cfd2 --- /dev/null +++ b/http/like.http @@ -0,0 +1,24 @@ + +### ํŠน์ • ์ƒํ’ˆ ์ฐœํ•˜๊ธฐ +POST http://localhost:5050/like/products/2 +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MzI2MDk2LCJleHAiOjE3NDczMjk2OTZ9.aWrWLpdFO-lisU2dvqL-oLxRBvPUjw1e7_H-jAlxhQ4 + +### ํŠน์ • ์ƒํ’ˆ ์ฐœ ์ทจ์†Œ +DELETE http://localhost:5050/like/products/2 +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MzI2MDk2LCJleHAiOjE3NDczMjk2OTZ9.aWrWLpdFO-lisU2dvqL-oLxRBvPUjw1e7_H-jAlxhQ4 + + + +### ํŠน์ • ๊ฒŒ์‹œ๊ธ€ ์ข‹์•„์š” +POST http://localhost:5050/like/articles/2 +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MzI2MDk2LCJleHAiOjE3NDczMjk2OTZ9.aWrWLpdFO-lisU2dvqL-oLxRBvPUjw1e7_H-jAlxhQ4 + +### ํŠน์ • ๊ฒŒ์‹œ๊ธ€ ์ข‹์•„์š” ์ทจ์†Œ +DELETE http://localhost:5050/like/articles/2 +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MzI2MDk2LCJleHAiOjE3NDczMjk2OTZ9.aWrWLpdFO-lisU2dvqL-oLxRBvPUjw1e7_H-jAlxhQ4 + + + + + + diff --git a/http/product.http b/http/product.http new file mode 100644 index 00000000..abc7951b --- /dev/null +++ b/http/product.http @@ -0,0 +1,32 @@ +### ์ƒˆ ์ƒํ’ˆ ๋“ฑ๋ก +POST http://localhost:5050/products +Content-Type: application/json +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MTg1OTgzLCJleHAiOjE3NDcxODk1ODN9.8KUfvmhW3vn6-TcqzU5nUg5TzZV8bfsWiAa15kVxz0E + +{ + "name": "์ƒˆ ์ƒํ’ˆ ์ด๋ฆ„3", + "description": "์ƒˆ ์ƒํ’ˆ ์„ค๋ช…", + "price": 10000, + "tags": ["ํƒœ๊ทธ1", "ํƒœ๊ทธ2"] +} + +### ๋ชจ๋“  ์ƒํ’ˆ ์กฐํšŒ +GET http://localhost:5050/products?orderBy=recent&keyword= + +### ํŠน์ • ์ƒํ’ˆ ์กฐํšŒ +GET http://localhost:5050/products/2 + +### ํŠน์ • ์ƒํ’ˆ ์ •๋ณด ์ˆ˜์ • +PATCH http://localhost:5050/products/1 +Content-Type: application/json +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MTg1OTgzLCJleHAiOjE3NDcxODk1ODN9.8KUfvmhW3vn6-TcqzU5nUg5TzZV8bfsWiAa15kVxz0E + +{ + "name": "์ˆ˜์ •๋œ ์ƒํ’ˆ ์ด๋ฆ„", + "price": 12000, + "tags": ["ํƒœ๊ทธ11", "ํƒœ๊ทธ12"] +} + +### ํŠน์ • ์ƒํ’ˆ ์‚ญ์ œ +DELETE http://localhost:5050/products/5 +Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbWFrZXJrdXIwMDAxdzQxZ2Y2YWVvNTdoIiwiaWF0IjoxNzQ3MTg1OTgzLCJleHAiOjE3NDcxODk1ODN9.8KUfvmhW3vn6-TcqzU5nUg5TzZV8bfsWiAa15kVxz0E diff --git a/http/user.http b/http/user.http new file mode 100644 index 00000000..2e4c48d0 --- /dev/null +++ b/http/user.http @@ -0,0 +1,33 @@ +### ๋‚ด ์ •๋ณด ์กฐํšŒ +GET http://localhost:5050/users/me +Authorization: Bearer # ์ธ์ฆ ํ•„์š” + +### ๋‚ด ์ •๋ณด ์ˆ˜์ • +PATCH http://localhost:5050/users/me +Content-Type: application/json +Authorization: Bearer # ์ธ์ฆ ํ•„์š” + +{ + "nickname": "์ƒˆ๋กœ์šด๋‹‰๋„ค์ž„", + "image": "์ƒˆ๋กœ์šด์ด๋ฏธ์ง€URL" + // ์ˆ˜์ •ํ•  ํ•„๋“œ๋“ค์„ JSON ํ˜•ํƒœ๋กœ ํฌํ•จ +} + +### ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ +PATCH http://localhost:5050/users/me/password +Content-Type: application/json +Authorization: Bearer # ์ธ์ฆ ํ•„์š” + +{ + "currentPassword": "ํ˜„์žฌ๋น„๋ฐ€๋ฒˆํ˜ธ", + "newPassword": "์ƒˆ๋กœ์šด๋น„๋ฐ€๋ฒˆํ˜ธ", + "newPasswordConfirmation": "์ƒˆ๋กœ์šด๋น„๋ฐ€๋ฒˆํ˜ธํ™•์ธ" +} + +### ๋‚ด๊ฐ€ ๋“ฑ๋กํ•œ ์ƒํ’ˆ ์กฐํšŒ +GET http://localhost:5050/users/me/products +Authorization: Bearer # ์ธ์ฆ ํ•„์š” + +### ๋‚ด๊ฐ€ ์ฐœํ•œ ์ƒํ’ˆ ์กฐํšŒ +GET http://localhost:5050/users/me/favorites +Authorization: Bearer # ์ธ์ฆ ํ•„์š” \ No newline at end of file