From ce099154d81ee60f2b251706de7fd2aec04c97b8 Mon Sep 17 00:00:00 2001 From: yhcho0405 Date: Sun, 16 Oct 2022 18:15:49 +0900 Subject: [PATCH 01/11] initial commit & update user pic & fix api url convention --- back-end/controllers/unitControllers.js | 190 ------------------------ back-end/controllers/userControllers.js | 62 +++++++- back-end/routes/userRoutes.js | 6 +- 3 files changed, 61 insertions(+), 197 deletions(-) diff --git a/back-end/controllers/unitControllers.js b/back-end/controllers/unitControllers.js index bce4798d..0d6501cb 100644 --- a/back-end/controllers/unitControllers.js +++ b/back-end/controllers/unitControllers.js @@ -85,196 +85,6 @@ const updateUnit = asyncHandler(async (req, res) => { }); -//@description Create Unit -//@route POST /api/unit/add -//@access Protected -const accessChat = asyncHandler(async (req, res) => { - const { userId } = req.body; - - if (!userId) { - console.log("UserId param not sent with request"); - return res.sendStatus(400); - } - - var isChat = await Chat.find({ - isGroupChat: false, - $and: [ - { users: { $elemMatch: { $eq: req.user._id } } }, - { users: { $elemMatch: { $eq: userId } } }, - ], - }) - .populate("users", "-password") - .populate("latestMessage"); - - isChat = await User.populate(isChat, { - path: "latestMessage.sender", - select: "name pic email", - }); - - if (isChat.length > 0) { - res.send(isChat[0]); - } else { - var chatData = { - chatName: "sender", - isGroupChat: false, - users: [req.user._id, userId], - }; - - try { - const createdChat = await Chat.create(chatData); - const FullChat = await Chat.findOne({ _id: createdChat._id }).populate( - "users", - "-password" - ); - res.status(200).json(FullChat); - } catch (error) { - res.status(400); - throw new Error(error.message); - } - } -}); - -//@description Fetch all chats for a user -//@route GET /api/chat/ -//@access Protected -const fetchChats = asyncHandler(async (req, res) => { - try { - Chat.find({ users: { $elemMatch: { $eq: req.user._id } } }) - .populate("users", "-password") - .populate("groupAdmin", "-password") - .populate("latestMessage") - .sort({ updatedAt: -1 }) - .then(async (results) => { - results = await User.populate(results, { - path: "latestMessage.sender", - select: "name pic email", - }); - res.status(200).send(results); - }); - } catch (error) { - res.status(400); - throw new Error(error.message); - } -}); - -//@description Create New Group Chat -//@route POST /api/chat/group -//@access Protected -const createGroupChat = asyncHandler(async (req, res) => { - if (!req.body.users || !req.body.name) { - return res.status(400).send({ message: "Please Fill all the feilds" }); - } - - var users = JSON.parse(req.body.users); - - if (users.length < 2) { - return res - .status(400) - .send("More than 2 users are required to form a group chat"); - } - - users.push(req.user); - - try { - const groupChat = await Chat.create({ - chatName: req.body.name, - users: users, - isGroupChat: true, - groupAdmin: req.user, - }); - - const fullGroupChat = await Chat.findOne({ _id: groupChat._id }) - .populate("users", "-password") - .populate("groupAdmin", "-password"); - - res.status(200).json(fullGroupChat); - } catch (error) { - res.status(400); - throw new Error(error.message); - } -}); - -// @desc Rename Group -// @route PUT /api/chat/rename -// @access Protected -const renameGroup = asyncHandler(async (req, res) => { - const { chatId, chatName } = req.body; - - const updatedChat = await Chat.findByIdAndUpdate( - chatId, - { - chatName: chatName, - }, - { - new: true, - } - ) - .populate("users", "-password") - .populate("groupAdmin", "-password"); - - if (!updatedChat) { - res.status(404); - throw new Error("Chat Not Found"); - } else { - res.json(updatedChat); - } -}); - -// @desc Remove user from Group -// @route PUT /api/chat/groupremove -// @access Protected -const removeFromGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; - - // check if the requester is admin - - const removed = await Chat.findByIdAndUpdate( - chatId, - { - $pull: { users: userId }, - }, - { - new: true, - } - ) - .populate("users", "-password") - .populate("groupAdmin", "-password"); - - if (!removed) { - res.status(404); - throw new Error("Chat Not Found"); - } else { - res.json(removed); - } -}); - -// @desc Add user to Group / Leave -// @route PUT /api/chat/groupadd -// @access Protected -const addToGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; - - // check if the requester is admin - - const added = await Chat.findByIdAndUpdate( - chatId, - { - $push: { users: userId }, - }, - { - new: true, - } - ) - .populate("users", "-password") - .populate("groupAdmin", "-password"); - - if (!added) { - res.status(404); - throw new Error("Chat Not Found"); - } else { - res.json(added); - } -}); module.exports = { updateUnit, diff --git a/back-end/controllers/userControllers.js b/back-end/controllers/userControllers.js index c0bac172..a13ea9b2 100644 --- a/back-end/controllers/userControllers.js +++ b/back-end/controllers/userControllers.js @@ -131,7 +131,7 @@ const registerUser = asyncHandler(async (req, res) => { //@description Auth the user //@route POST /api/users/login -//@access Public +//@access public const authUser = asyncHandler(async (req, res) => { const { DoDID, password } = req.body; const user = await User.findOne({ DoDID }); @@ -157,9 +157,9 @@ const authUser = asyncHandler(async (req, res) => { } }); -//@description Register new user -//@route POST /api/user/register -//@access Public +//@description update user info +//@route PUT /api/user +//@access protect const updateUser = asyncHandler(async (req, res) => { const { Rank, Name, email, milNumber, number } = req.body; @@ -214,4 +214,56 @@ const updateUser = asyncHandler(async (req, res) => { } }); -module.exports = { allUsers, addUser, registerUser, authUser, updateUser }; +//@description update user picture +//@route PUT /api/user/pic +//@access protect +const updatePic = asyncHandler(async (req, res) => { + const { pic } = req.body; + + if (!Rank) { + res.status(400); + throw new Error("수정할 사진 정보를 입력하세요."); + } + + const DoDID = req.user.DoDID; + const userDb = await User.findOne({ DoDID }); + + if (!userDb) { + res.status(400); + throw new Error("등록되지 않은 사용자입니다. 부대 당담자에게 문의하세요."); + } + + if (!userDb.is_registered) { + res.status(400); + throw new Error("가입 후 시도하세요."); + } + + const updatedUser = await User.findByIdAndUpdate( + userDb._id, + { + pic: pic + }, + { + new: true, + } + ) + + if (!updatedUser) { + res.status(400); + throw new Error("사용자를 찾을 수 없습니다."); + } else { + res.status(201).json({ + _id: updatedUser._id, + Name: updatedUser.Name, + Rank: updatedUser.Rank, + DoDID: updatedUser.DoDID, + email: updatedUser.email, + milNumber: updatedUser.milNumber, + number: updatedUser.number, + Type: updatedUser.Type, + pic: updatedUser.pic, + }); + } +}); + +module.exports = { allUsers, addUser, registerUser, authUser, updateUser, updatePic }; diff --git a/back-end/routes/userRoutes.js b/back-end/routes/userRoutes.js index edb27ed1..d7f326f1 100644 --- a/back-end/routes/userRoutes.js +++ b/back-end/routes/userRoutes.js @@ -4,16 +4,18 @@ const { authUser, allUsers, addUser, - updateUser + updateUser, + updatePic } = require("../controllers/userControllers"); const { protect, onlyAdmin } = require("../middleware/authMiddleware"); const router = express.Router(); router.route("/").get(protect, allUsers);//protect, +router.route("/").put(protect, updateUser); +router.route("/pic").put(protect, updatePic); router.route("/add").post(onlyAdmin, addUser); router.route("/register").post(registerUser); router.post("/login", authUser); -router.post("/update", protect, updateUser); module.exports = router; From b81f41ff54124f4e4734bf92ef3a40cea200a846 Mon Sep 17 00:00:00 2001 From: yhcho0405 Date: Sun, 16 Oct 2022 18:26:23 +0900 Subject: [PATCH 02/11] access middleware & unit logo update & api url convention fix --- back-end/controllers/unitControllers.js | 40 +++++++++++++++++++++++-- back-end/middleware/authMiddleware.js | 13 +++++--- back-end/routes/unitRoutes.js | 6 ++-- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/back-end/controllers/unitControllers.js b/back-end/controllers/unitControllers.js index 0d6501cb..5fd1e5df 100644 --- a/back-end/controllers/unitControllers.js +++ b/back-end/controllers/unitControllers.js @@ -4,7 +4,7 @@ const User = require("../models/userModel"); const Unit = require("../models/unitModel"); //@description Add new unit -//@route POST /api/unit/add +//@route POST /api/unit //@access Protected const addUnit = asyncHandler(async (req, res) => { const { Unitname, Unitslogan, Logo } = req.body; @@ -46,7 +46,7 @@ const addUnit = asyncHandler(async (req, res) => { }); //@description Update unit info -//@route POST /api/unit/update +//@route POST /api/unit/ //@access Protected(only admin) const updateUnit = asyncHandler(async (req, res) => { const { Unitname, Unitslogan} = req.body; @@ -84,7 +84,43 @@ const updateUnit = asyncHandler(async (req, res) => { } }); +//@description Update unit logo +//@route put /api/unit/logo +//@access Protected(only admin) +const updateLogo = asyncHandler(async (req, res) => { + const { Logo } = req.body; + + if (!Logo) { + res.status(400); + throw new Error("수정할 Logo 정보를 입력하세요."); + } + + const unitId = req.user.Unit; + + const updatedUnit = await User.findByIdAndUpdate( + unitId, + { + Logo: Logo + }, + { + new: true, + } + ) + if (updatedUnit) { + res.status(201).json({ + _id: updatedUnit._id, + Unitname: updatedUnit.Unitname, + Unitslogan: updatedUnit.Unitslogan, + Logo: updatedUnit.Logo, + Members: updatedUnit.Members, + unitAdmins: updatedUnit.unitAdmins + }); + } else { + res.status(400); + throw new Error("부대 정보를 찾을 수 없습니다."); + } +}); module.exports = { updateUnit, diff --git a/back-end/middleware/authMiddleware.js b/back-end/middleware/authMiddleware.js index ddb87a45..eb684ef7 100644 --- a/back-end/middleware/authMiddleware.js +++ b/back-end/middleware/authMiddleware.js @@ -20,13 +20,13 @@ const protect = asyncHandler(async (req, res, next) => { next(); } catch (error) { res.status(401); - throw new Error("Not authorized, token failed"); + throw new Error("잘못된 토큰입니다."); } } if (!token) { res.status(401); - throw new Error("Not authorized, no token"); + throw new Error("토큰이 없습니다. 인증되지 않았습니다."); } }); @@ -46,13 +46,18 @@ const onlyAdmin = asyncHandler(async (req, res, next) => { // Todo: access handl next(); } catch (error) { res.status(401); - throw new Error("Not authorized, token failed"); + throw new Error("잘못된 토큰입니다."); } } if (!token) { res.status(401); - throw new Error("Not authorized, no token"); + throw new Error("토큰이 없습니다. 인증되지 않았습니다."); + } + + if (req.user.Type != "commender") { + res.status(401); + throw new Error("권한이 없습니다."); } }); diff --git a/back-end/routes/unitRoutes.js b/back-end/routes/unitRoutes.js index 6f52376c..34767934 100644 --- a/back-end/routes/unitRoutes.js +++ b/back-end/routes/unitRoutes.js @@ -1,12 +1,14 @@ const express = require("express"); const { updateUnit, + updateLogo } = require("../controllers/unitControllers"); const { protect, onlyAdmin } = require("../middleware/authMiddleware"); const router = express.Router(); -//router.route("/add").post(protect, addUnit); -router.route("/update").post(onlyAdmin, updateUnit); +//router.route("/").post(protect, addUnit); +router.route("/").put(onlyAdmin, updateUnit); +router.route("/logo").put(onlyAdmin, updateLogo); module.exports = router; From 1759eeab2ff12327bae5671cc343f303e2652730 Mon Sep 17 00:00:00 2001 From: yhcho0405 Date: Mon, 17 Oct 2022 06:17:48 +0900 Subject: [PATCH 03/11] Feat: GET api/user(index, single) --- back-end/.env.example | 3 - back-end/controllers/unitControllers.js | 7 +- back-end/controllers/userControllers.js | 32 +- back-end/package-lock.json | 1957 +---------------------- back-end/routes/userRoutes.js | 2 +- back-end/server.js | 3 + 6 files changed, 31 insertions(+), 1973 deletions(-) delete mode 100644 back-end/.env.example diff --git a/back-end/.env.example b/back-end/.env.example deleted file mode 100644 index 5763cf7f..00000000 --- a/back-end/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -PORT=5000 -MONGO_URI="" -JWT_SECRET="" \ No newline at end of file diff --git a/back-end/controllers/unitControllers.js b/back-end/controllers/unitControllers.js index 5fd1e5df..f34a365a 100644 --- a/back-end/controllers/unitControllers.js +++ b/back-end/controllers/unitControllers.js @@ -124,10 +124,5 @@ const updateLogo = asyncHandler(async (req, res) => { module.exports = { updateUnit, - accessChat, - fetchChats, - createGroupChat, - renameGroup, - addToGroup, - removeFromGroup, + updateLogo }; diff --git a/back-end/controllers/userControllers.js b/back-end/controllers/userControllers.js index a13ea9b2..5d55cf4b 100644 --- a/back-end/controllers/userControllers.js +++ b/back-end/controllers/userControllers.js @@ -4,25 +4,39 @@ const generateToken = require("../config/generateToken"); const bcrypt = require("bcryptjs"); //@description Get or Search all users -//@route GET /api/user?search= +//@route GET /api/user?search=?index= //@access Protected const allUsers = asyncHandler(async (req, res) => { - + const ranks = ["CV9", "CV8", "CV7", + "CV6", "CV5", "CV4", "CV3", "CV2", + "CV1", "PVT", "PFC", "CPL", "SGT", + "SST", "SFC", "MST", "SGM", "SEC", + "LIU", "LIU", "CPT", "MAJ", "LTC", + "COL", "BG", "MG", "LG", "GEN"]; const keyword = req.query.search ? { $or: [ - { Name: { $regex: req.query.search, $options: "i" } }, + //{ Name: { $regex: req.query.search, $options: "i" } }, { DoDID: { $regex: req.query.search, $options: "i" } }, - { email: { $regex: req.query.search, $options: "i" } }, + //{ email: { $regex: req.query.search, $options: "i" } }, ], } - : {}; - if (req.query.search == "") { - users = await User.find({}, {password:0}); + : 0 ; + users = await User.find({}, {password:0}); + users.sort(function(a,b) { + return (ranks.indexOf(b.Rank) + b.is_registered ? 0 : 100) - (ranks.indexOf(a.Rank) + a.is_registered ? 0 : 100); + }); + const index = req.query.index; + if (index) { + console.log("users"); + res.send(users.slice(parseInt(index) * 4, parseInt(index) * 4 + 4)); + } else if (keyword) { + res.send(await User.find(keyword));//.find({ _id: { $ne: req.user._id } })); } else { - users = await User.find(keyword).find({ _id: { $ne: req.user._id } }); + res.status(400); + throw new Error("잘못된 요청입니다."); } - res.send(users); + }); //@description Add new user diff --git a/back-end/package-lock.json b/back-end/package-lock.json index 0ab48f08..bf68b3e4 100644 --- a/back-end/package-lock.json +++ b/back-end/package-lock.json @@ -1,1950 +1,8 @@ { "name": "roksrs", "version": "1.0.0", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "name": "roksrs", - "version": "1.0.0", - "dependencies": { - "bcryptjs": "^2.4.3", - "classificator": "^0.3.4", - "colors": "^1.4.0", - "cors": "^2.8.5", - "dotenv": "^9.0.2", - "express": "^4.17.1", - "express-async-handler": "^1.1.4", - "jsonwebtoken": "^8.5.1", - "mongoose": "^5.12.9", - "nodemon": "^2.0.7", - "nodepapago": "^3.1.1", - "socket.io": "^4.1.2", - "wink-pos-tagger": "^2.2.2" - }, - "devDependencies": { - "swagger-jsdoc": "^6.2.5", - "swagger-ui-express": "^4.5.0" - } - }, - "node_modules/@apidevtools/json-schema-ref-parser": { - "version": "9.0.9", - "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz", - "integrity": "sha512-GBD2Le9w2+lVFoc4vswGI/TjkNIZSVp7+9xPf+X3uidBfWnAeUWmquteSyt0+VCrhNMWj/FTABISQrD3Z/YA+w==", - "dev": true, - "dependencies": { - "@jsdevtools/ono": "^7.1.3", - "@types/json-schema": "^7.0.6", - "call-me-maybe": "^1.0.1", - "js-yaml": "^4.1.0" - } - }, - "node_modules/@apidevtools/openapi-schemas": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz", - "integrity": "sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@apidevtools/swagger-methods": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz", - "integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==", - "dev": true - }, - "node_modules/@apidevtools/swagger-parser": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-10.0.2.tgz", - "integrity": "sha512-JFxcEyp8RlNHgBCE98nwuTkZT6eNFPc1aosWV6wPcQph72TSEEu1k3baJD4/x1qznU+JiDdz8F5pTwabZh+Dhg==", - "dev": true, - "dependencies": { - "@apidevtools/json-schema-ref-parser": "^9.0.6", - "@apidevtools/openapi-schemas": "^2.0.4", - "@apidevtools/swagger-methods": "^3.0.2", - "@jsdevtools/ono": "^7.1.3", - "call-me-maybe": "^1.0.1", - "z-schema": "^4.2.3" - }, - "peerDependencies": { - "openapi-types": ">=7" - } - }, - "node_modules/@jsdevtools/ono": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", - "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", - "dev": true - }, - "node_modules/@socket.io/component-emitter": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", - "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" - }, - "node_modules/@types/bson": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.5.tgz", - "integrity": "sha512-vVLwMUqhYJSQ/WKcE60eFqcyuWse5fGH+NMAXHuKrUAPoryq3ATxk5o4bgYNtg5aOM4APVg7Hnb3ASqUYG0PKg==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==" - }, - "node_modules/@types/cors": { - "version": "2.8.12", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz", - "integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==" - }, - "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true - }, - "node_modules/@types/mongodb": { - "version": "3.6.20", - "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.20.tgz", - "integrity": "sha512-WcdpPJCakFzcWWD9juKoZbRtQxKIMYF/JIAM4JrNHrMcnJL6/a2NWjXxW7fo9hxboxxkg+icff8d7+WIEvKgYQ==", - "dependencies": { - "@types/bson": "*", - "@types/node": "*" - } - }, - "node_modules/@types/node": { - "version": "18.8.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.2.tgz", - "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==" - }, - "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==" - }, - "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==", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "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==" - }, - "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, - "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==" - }, - "node_modules/base64id": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", - "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", - "engines": { - "node": "^4.5.0 || >= 5.9" - } - }, - "node_modules/bcryptjs": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", - "integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==" - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/bl": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz", - "integrity": "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==", - "dependencies": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" - }, - "node_modules/body-parser": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "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.10.3", - "raw-body": "2.5.1", - "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==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/bson": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz", - "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==", - "engines": { - "node": ">=0.6.19" - } - }, - "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==" - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/call-me-maybe": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", - "integrity": "sha512-wCyFsDQkKPwwF8BDwOiWNx/9K45L/hvggQiDbve+viMNMQnWhrlYIuBk09offfwCRtCO9P6XwUttufzU11WCVw==", - "dev": true - }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "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" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/classificator": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/classificator/-/classificator-0.3.4.tgz", - "integrity": "sha512-H0ZCdZj1oEKr7jx//k8laegv8njniDWDPRE72HQ3250ow9I1g0ueO6n/RjzZPC9AMwfs3IoOCXfyMOLSonqkmg==", - "dependencies": { - "decimal.js": "^10.0.0" - }, - "engines": { - "node": ">=5.0.0" - } - }, - "node_modules/colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/commander": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz", - "integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, - "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==", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "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==" - }, - "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==" - }, - "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==", - "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==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/decimal.js": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.2.tgz", - "integrity": "sha512-ic1yEvwT6GuvaYwBLLY6/aFFgjZdySKTE8en/fkU3QICTmRtgtSlFn0u0BXN06InZwtfCelR7j8LRiDI/02iGA==" - }, - "node_modules/denque": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz", - "integrity": "sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==", - "engines": { - "node": ">=0.10" - } - }, - "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==", - "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==", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/dotenv": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-9.0.2.tgz", - "integrity": "sha512-I9OvvrHp4pIARv4+x9iuewrWycX6CcZtoAu1XrzPxc5UygMJXJZYmBsynku8IkrJwgypE5DGNjDPmPRhDCptUg==", - "engines": { - "node": ">=10" - } - }, - "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==", - "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==" - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" - }, - "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==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/engine.io": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.0.tgz", - "integrity": "sha512-4KzwW3F3bk+KlzSOY57fj/Jx6LyRQ1nbcyIadehl+AnXjKT7gDO0ORdRi/84ixvMKTym6ZKuxvbzN62HDDU1Lg==", - "dependencies": { - "@types/cookie": "^0.4.1", - "@types/cors": "^2.8.12", - "@types/node": ">=10.0.0", - "accepts": "~1.3.4", - "base64id": "2.0.0", - "cookie": "~0.4.1", - "cors": "~2.8.5", - "debug": "~4.3.1", - "engine.io-parser": "~5.0.3", - "ws": "~8.2.3" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/engine.io-parser": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.4.tgz", - "integrity": "sha512-+nVFp+5z1E3HcToEnO7ZIj3g+3k9389DvWtvJZz0T6/eOCPIyyxehFcedoYrZQrp0LgQbD9pPXhpMBKMd5QURg==", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/engine.io/node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/engine.io/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/engine.io/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "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==" - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", - "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.0", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.10.3", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "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" - } - }, - "node_modules/express-async-handler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/express-async-handler/-/express-async-handler-1.2.0.tgz", - "integrity": "sha512-rCSVtPXRmQSW8rmik/AIb2P0op6l7r1fMW538yyvTMltCO4xQEWMmobfrIxN2V1/mVrgxB8Az3reYF6yUZw37w==" - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "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/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "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==", - "engines": { - "node": ">= 0.6" - } - }, - "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==", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "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==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "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==", - "engines": { - "node": ">=4" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "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==", - "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/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "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==" - }, - "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==", - "dev": true, - "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==" - }, - "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==", - "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==", - "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==", - "engines": { - "node": ">=0.10.0" - } - }, - "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==", - "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==", - "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==" - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsonwebtoken": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", - "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", - "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": "^5.6.0" - }, - "engines": { - "node": ">=4", - "npm": ">=1.4.28" - } - }, - "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==" - }, - "node_modules/jwa": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", - "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", - "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==", - "dependencies": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/kareem": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.2.tgz", - "integrity": "sha512-STHz9P7X2L4Kwn72fA4rGyqyXdmrMSdxqHx9IXon/FXluXieaFA6KJ2upcHAHxQPQ0LeM/OjLrhFxifHewOALQ==" - }, - "node_modules/lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "dev": true - }, - "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==" - }, - "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==" - }, - "node_modules/lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", - "dev": true - }, - "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==" - }, - "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==" - }, - "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==" - }, - "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==" - }, - "node_modules/lodash.mergewith": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", - "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", - "dev": true - }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" - }, - "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==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/memory-pager": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", - "optional": true - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" - }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "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==", - "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==", - "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==", - "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==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mongodb": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.7.3.tgz", - "integrity": "sha512-Psm+g3/wHXhjBEktkxXsFMZvd3nemI0r3IPsE0bU+4//PnvNWKkzhZcEsbPcYiWqe8XqXJJEg4Tgtr7Raw67Yw==", - "dependencies": { - "bl": "^2.2.1", - "bson": "^1.1.4", - "denque": "^1.4.1", - "optional-require": "^1.1.8", - "safe-buffer": "^5.1.2" - }, - "engines": { - "node": ">=4" - }, - "optionalDependencies": { - "saslprep": "^1.0.0" - }, - "peerDependenciesMeta": { - "aws4": { - "optional": true - }, - "bson-ext": { - "optional": true - }, - "kerberos": { - "optional": true - }, - "mongodb-client-encryption": { - "optional": true - }, - "mongodb-extjson": { - "optional": true - }, - "snappy": { - "optional": true - } - } - }, - "node_modules/mongodb/node_modules/optional-require": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.1.8.tgz", - "integrity": "sha512-jq83qaUb0wNg9Krv1c5OQ+58EK+vHde6aBPzLvPPqJm89UQWsvSuFy9X/OSNJnFeSOKo7btE0n8Nl2+nE+z5nA==", - "dependencies": { - "require-at": "^1.0.6" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mongoose": { - "version": "5.13.15", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.13.15.tgz", - "integrity": "sha512-cxp1Gbb8yUWkaEbajdhspSaKzAvsIvOtRlYD87GN/P2QEUhpd6bIvebi36T6M0tIVAMauNaK9SPA055N3PwF8Q==", - "dependencies": { - "@types/bson": "1.x || 4.0.x", - "@types/mongodb": "^3.5.27", - "bson": "^1.1.4", - "kareem": "2.3.2", - "mongodb": "3.7.3", - "mongoose-legacy-pluralize": "1.0.2", - "mpath": "0.8.4", - "mquery": "3.2.5", - "ms": "2.1.2", - "optional-require": "1.0.x", - "regexp-clone": "1.0.0", - "safe-buffer": "5.2.1", - "sift": "13.5.2", - "sliced": "1.0.1" - }, - "engines": { - "node": ">=4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mongoose" - } - }, - "node_modules/mongoose-legacy-pluralize": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", - "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==", - "peerDependencies": { - "mongoose": "*" - } - }, - "node_modules/mongoose/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/mpath": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz", - "integrity": "sha512-DTxNZomBcTWlrMW76jy1wvV37X/cNNxPW1y2Jzd4DZkAaC5ZGsm8bfGfNOthcDuRJujXLqiuS6o3Tpy0JEoh7g==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mquery": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz", - "integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==", - "dependencies": { - "bluebird": "3.5.1", - "debug": "3.1.0", - "regexp-clone": "^1.0.0", - "safe-buffer": "5.1.2", - "sliced": "1.0.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mquery/node_modules/debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/mquery/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==" - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "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==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/nodemon": { - "version": "2.0.20", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz", - "integrity": "sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==", - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "simple-update-notifier": "^1.0.7", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=8.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/nodemon/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dependencies": { - "ms": "^2.1.1" - } - }, - "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==" - }, - "node_modules/nodepapago": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/nodepapago/-/nodepapago-3.1.1.tgz", - "integrity": "sha512-67QjA2ueackA6/ijGNMn9xVHhJbg7gPE884nHmD5pJASZES3zzMVNrAtLDoRkkTLfqX9oL1C2WlXTowtqkHmag==", - "dependencies": { - "axios": "^0.21.4", - "uuid": "^8.3.2" - } - }, - "node_modules/nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "*" - } - }, - "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==", - "engines": { - "node": ">=0.10.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==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", - "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==", - "dependencies": { - "ee-first": "1.1.1" - }, - "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==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/openapi-types": { - "version": "12.0.2", - "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.0.2.tgz", - "integrity": "sha512-GuTo7FyZjOIWVhIhQSWJVaws6A82sWIGyQogxxYBYKZ0NBdyP2CYSIgOwFfSB+UVoPExk/YzFpyYitHS8KVZtA==", - "dev": true, - "peer": true - }, - "node_modules/optional-require": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz", - "integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "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==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "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==" - }, - "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==", - "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==" - }, - "node_modules/qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "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==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "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": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "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/readable-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==" - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/regexp-clone": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz", - "integrity": "sha512-TuAasHQNamyyJ2hb97IuBEif4qBHGjPHBS64sZwytpLEqtBQ1gPJTnOaQ6qmpET16cK14kkjbazl6+p0RRv0yw==" - }, - "node_modules/require-at": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/require-at/-/require-at-1.0.6.tgz", - "integrity": "sha512-7i1auJbMUrXEAZCOQ0VNJgmcT2VOKPRl2YGJwgpHpC9CE91Mv4/4UYIUm4chGJaI381ZDq1JUicFii64Hapd8g==", - "engines": { - "node": ">=4" - } - }, - "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" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/saslprep": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", - "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", - "optional": true, - "dependencies": { - "sparse-bitfield": "^3.0.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "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/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/sift": { - "version": "13.5.2", - "resolved": "https://registry.npmjs.org/sift/-/sift-13.5.2.tgz", - "integrity": "sha512-+gxdEOMA2J+AI+fVsCqeNn7Tgx3M9ZN9jdi95939l1IJ8cZsqS8sqpJyOkic2SJk+1+98Uwryt/gL6XDaV+UZA==" - }, - "node_modules/simple-update-notifier": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.7.tgz", - "integrity": "sha512-BBKgR84BJQJm6WjWFMHgLVuo61FBDSj1z/xSFUIozqO6wO7ii0JxCqlIud7Enr/+LhlbNI0whErq96P2qHNWew==", - "dependencies": { - "semver": "~7.0.0" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/simple-update-notifier/node_modules/semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/sliced": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", - "integrity": "sha512-VZBmZP8WU3sMOZm1bdgTadsQbcscK0UM8oKxKVBs4XAhUo2Xxzm/OFMGBkPusxw9xL3Uy8LrzEqGqJhclsr0yA==" - }, - "node_modules/socket.io": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.5.2.tgz", - "integrity": "sha512-6fCnk4ARMPZN448+SQcnn1u8OHUC72puJcNtSgg2xS34Cu7br1gQ09YKkO1PFfDn/wyUE9ZgMAwosJed003+NQ==", - "dependencies": { - "accepts": "~1.3.4", - "base64id": "~2.0.0", - "debug": "~4.3.2", - "engine.io": "~6.2.0", - "socket.io-adapter": "~2.4.0", - "socket.io-parser": "~4.2.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/socket.io-adapter": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.4.0.tgz", - "integrity": "sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg==" - }, - "node_modules/socket.io-parser": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.1.tgz", - "integrity": "sha512-V4GrkLy+HeF1F/en3SpUaM+7XxYXpuMUWLGde1kSSh5nQMN4hLrbPIkD+otwh6q9R6NOQBN4AMaOZ2zVjui82g==", - "dependencies": { - "@socket.io/component-emitter": "~3.1.0", - "debug": "~4.3.1" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/socket.io-parser/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/socket.io-parser/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/socket.io/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/socket.io/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/sparse-bitfield": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", - "optional": true, - "dependencies": { - "memory-pager": "^1.0.2" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "engines": { - "node": ">= 0.8" - } - }, - "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==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string_decoder/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==" - }, - "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==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/swagger-jsdoc": { - "version": "6.2.5", - "resolved": "https://registry.npmjs.org/swagger-jsdoc/-/swagger-jsdoc-6.2.5.tgz", - "integrity": "sha512-l+cdsKS2y+QDhrH1TJSUiE0y9XKuf5xaGSatjf0hR/wjTlMpO8WfubBK9d/nASdbHPMtj9iJZLBH2ogBEhL7Sw==", - "dev": true, - "dependencies": { - "commander": "6.2.0", - "doctrine": "3.0.0", - "glob": "7.1.6", - "lodash.mergewith": "^4.6.2", - "swagger-parser": "10.0.2", - "yaml": "2.0.0-1" - }, - "bin": { - "swagger-jsdoc": "bin/swagger-jsdoc.js" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/swagger-parser": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/swagger-parser/-/swagger-parser-10.0.2.tgz", - "integrity": "sha512-9jHkHM+QXyLGFLk1DkXBwV+4HyNm0Za3b8/zk/+mjr8jgOSiqm3FOTHBSDsBjtn9scdL+8eWcHdupp2NLM8tDw==", - "dev": true, - "dependencies": { - "@apidevtools/swagger-parser": "10.0.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/swagger-ui-dist": { - "version": "4.14.2", - "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.14.2.tgz", - "integrity": "sha512-kOIU7Ts3TrXDLb3/c9jRe4qGp8O3bRT19FFJA8wJfrRFkcK/4atPn3krhtBVJ57ZkNNofworXHxuYwmaisXBdg==", - "dev": true - }, - "node_modules/swagger-ui-express": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.5.0.tgz", - "integrity": "sha512-DHk3zFvsxrkcnurGvQlAcLuTDacAVN1JHKDgcba/gr2NFRE4HGwP1YeHIXMiGznkWR4AeS7X5vEblNn4QljuNA==", - "dev": true, - "dependencies": { - "swagger-ui-dist": ">=4.11.0" - }, - "engines": { - "node": ">= v0.10.32" - }, - "peerDependencies": { - "express": ">=4.0.0" - } - }, - "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==", - "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==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/touch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dependencies": { - "nopt": "~1.0.10" - }, - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "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==", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==" - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "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==" - }, - "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==", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/validator": { - "version": "13.7.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz", - "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==", - "dev": true, - "engines": { - "node": ">= 0.10" - } - }, - "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==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/wink-helpers": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/wink-helpers/-/wink-helpers-2.0.0.tgz", - "integrity": "sha512-I/ZzXrHcNRXuoeFJmp2vMVqDI6UCK02Tds1WP4kSGAmx520gjL1BObVzF7d2ps24tyHIly9ngdB2jwhlFUjPvg==" - }, - "node_modules/wink-lemmatizer": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/wink-lemmatizer/-/wink-lemmatizer-3.0.2.tgz", - "integrity": "sha512-0G572wdcujnRfpjSKs2lDXjA2+8APzkQu+gsREzzOjqg39C1ACE912veMwx2onlbYfUifsZRVaLZUOXjsHFVzA==", - "dependencies": { - "wink-lexicon": "^2.1.2", - "wink-porter2-stemmer": "^2.0.0" - } - }, - "node_modules/wink-lexicon": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/wink-lexicon/-/wink-lexicon-2.1.2.tgz", - "integrity": "sha512-LUIVIKNIURMHN38leZXWP+ZE0b1jWUdGDHfgV6kmPSHy2AqwHS/n8xGADRsfJxJamLb6BwQY713/w2XnWYk/HQ==" - }, - "node_modules/wink-porter2-stemmer": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/wink-porter2-stemmer/-/wink-porter2-stemmer-2.0.1.tgz", - "integrity": "sha512-0g+RkkqhRXFmSpJQStVXW5N/WsshWpJXsoDRW7DwVkGI2uDT6IBCoq3xdH5p6IHLaC6ygk7RWUsUx4alKxoagQ==" - }, - "node_modules/wink-pos-tagger": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/wink-pos-tagger/-/wink-pos-tagger-2.2.2.tgz", - "integrity": "sha512-+bhkwqwwChqWR75ksFKVJZQagwu404UmnvFjxr+OWZ02/ZJAv19N/iqDpMeYRQRxatk5N+W9pXIKEDJsVrzGyw==", - "dependencies": { - "wink-helpers": "^2.0.0", - "wink-lemmatizer": "^3.0.1", - "wink-lexicon": "^2.1.1", - "wink-porter2-stemmer": "^2.0.0", - "wink-tokenizer": "^5.2.1" - } - }, - "node_modules/wink-tokenizer": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/wink-tokenizer/-/wink-tokenizer-5.3.0.tgz", - "integrity": "sha512-O/yAw0g3FmSgeeQuYAJJfP7fVPB4A6ay0018qASh79aWmIOyPYy4j4r9EQT8xBjicja6lCLvgRVAybmEBaATQA==", - "dependencies": { - "emoji-regex": "^9.0.0" - } - }, - "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==", - "dev": true - }, - "node_modules/ws": { - "version": "8.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", - "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/yaml": { - "version": "2.0.0-1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.0-1.tgz", - "integrity": "sha512-W7h5dEhywMKenDJh2iX/LABkbFnBxasD27oyXWDS/feDsxiw0dD5ncXdYXgkvAsXIY2MpW/ZKkr9IU30DBdMNQ==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/z-schema": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-4.2.4.tgz", - "integrity": "sha512-YvBeW5RGNeNzKOUJs3rTL4+9rpcvHXt5I051FJbOcitV8bl40pEfcG0Q+dWSwS0/BIYrMZ/9HHoqLllMkFhD0w==", - "dev": true, - "dependencies": { - "lodash.get": "^4.4.2", - "lodash.isequal": "^4.5.0", - "validator": "^13.6.0" - }, - "bin": { - "z-schema": "bin/z-schema" - }, - "engines": { - "node": ">=6.0.0" - }, - "optionalDependencies": { - "commander": "^2.7.1" - } - }, - "node_modules/z-schema/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true, - "optional": true - } - }, "dependencies": { "@apidevtools/json-schema-ref-parser": { "version": "9.0.9", @@ -2808,8 +866,7 @@ "mongoose-legacy-pluralize": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", - "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==", - "requires": {} + "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" }, "mpath": { "version": "0.8.4", @@ -2934,13 +991,6 @@ "wrappy": "1" } }, - "openapi-types": { - "version": "12.0.2", - "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.0.2.tgz", - "integrity": "sha512-GuTo7FyZjOIWVhIhQSWJVaws6A82sWIGyQogxxYBYKZ0NBdyP2CYSIgOwFfSB+UVoPExk/YzFpyYitHS8KVZtA==", - "dev": true, - "peer": true - }, "optional-require": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz", @@ -3402,8 +1452,7 @@ "ws": { "version": "8.2.3", "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", - "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", - "requires": {} + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==" }, "yaml": { "version": "2.0.0-1", diff --git a/back-end/routes/userRoutes.js b/back-end/routes/userRoutes.js index d7f326f1..9487de20 100644 --- a/back-end/routes/userRoutes.js +++ b/back-end/routes/userRoutes.js @@ -11,7 +11,7 @@ const { protect, onlyAdmin } = require("../middleware/authMiddleware"); const router = express.Router(); -router.route("/").get(protect, allUsers);//protect, +router.route("/").get(allUsers);//protect, router.route("/").put(protect, updateUser); router.route("/pic").put(protect, updatePic); router.route("/add").post(onlyAdmin, addUser); diff --git a/back-end/server.js b/back-end/server.js index 435d2df2..93e8c3e2 100644 --- a/back-end/server.js +++ b/back-end/server.js @@ -5,6 +5,9 @@ const cors = require("cors"); const userRoutes = require("./routes/userRoutes"); const chatRoutes = require("./routes/chatRoutes"); const messageRoutes = require("./routes/messageRoutes"); +const unitRoutes = require("./routes/unitRoutes"); +const reportRoutes = require("./routes/reportRoutes"); +const commentRoutes = require("./routes/commentRoutes"); const { notFound, errorHandler } = require("./middleware/errorMiddleware"); const path = require("path"); From 9fcde597c0f70e1a9465890a98346ceb59c988c5 Mon Sep 17 00:00:00 2001 From: yhcho0405 Date: Mon, 17 Oct 2022 06:45:56 +0900 Subject: [PATCH 04/11] Fix: auth type handle --- back-end/controllers/userControllers.js | 7 +++---- back-end/routes/userRoutes.js | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/back-end/controllers/userControllers.js b/back-end/controllers/userControllers.js index 5d55cf4b..a1b3ea19 100644 --- a/back-end/controllers/userControllers.js +++ b/back-end/controllers/userControllers.js @@ -28,7 +28,6 @@ const allUsers = asyncHandler(async (req, res) => { }); const index = req.query.index; if (index) { - console.log("users"); res.send(users.slice(parseInt(index) * 4, parseInt(index) * 4 + 4)); } else if (keyword) { res.send(await User.find(keyword));//.find({ _id: { $ne: req.user._id } })); @@ -90,8 +89,8 @@ const addUser = asyncHandler(async (req, res) => { //@access Public const registerUser = asyncHandler(async (req, res) => { const { Rank, Name, DoDID, email, password, pic, Invcode } = req.body; - - if (!Rank || !Name || !email || !password || !DoDID) { + //049opo6a + if (!Rank || !Name || !email || !password || !DoDID || !Invcode) { res.status(400); throw new Error("모든 정보를 입력하세요."); } @@ -234,7 +233,7 @@ const updateUser = asyncHandler(async (req, res) => { const updatePic = asyncHandler(async (req, res) => { const { pic } = req.body; - if (!Rank) { + if (!pic) { res.status(400); throw new Error("수정할 사진 정보를 입력하세요."); } diff --git a/back-end/routes/userRoutes.js b/back-end/routes/userRoutes.js index 9487de20..6632cd68 100644 --- a/back-end/routes/userRoutes.js +++ b/back-end/routes/userRoutes.js @@ -11,9 +11,9 @@ const { protect, onlyAdmin } = require("../middleware/authMiddleware"); const router = express.Router(); -router.route("/").get(allUsers);//protect, +router.route("/").get(protect, allUsers);//protect, router.route("/").put(protect, updateUser); -router.route("/pic").put(protect, updatePic); +router.route("/pic").put(protect, updatePic);//protect, router.route("/add").post(onlyAdmin, addUser); router.route("/register").post(registerUser); router.post("/login", authUser); From 493067c043812f44d5e2162534461c93281df922 Mon Sep 17 00:00:00 2001 From: yhcho0405 Date: Mon, 17 Oct 2022 06:53:02 +0900 Subject: [PATCH 05/11] Feat: api add unit(testing) & some fix --- back-end/controllers/unitControllers.js | 3 ++- back-end/models/unitModel.js | 2 +- back-end/routes/unitRoutes.js | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/back-end/controllers/unitControllers.js b/back-end/controllers/unitControllers.js index f34a365a..4e367dbb 100644 --- a/back-end/controllers/unitControllers.js +++ b/back-end/controllers/unitControllers.js @@ -124,5 +124,6 @@ const updateLogo = asyncHandler(async (req, res) => { module.exports = { updateUnit, - updateLogo + updateLogo, + addUnit }; diff --git a/back-end/models/unitModel.js b/back-end/models/unitModel.js index f62049aa..f3f7302e 100644 --- a/back-end/models/unitModel.js +++ b/back-end/models/unitModel.js @@ -4,7 +4,7 @@ const unitModel = mongoose.Schema( { Unitname: { type: String, trim: true }, Unitslogan: { type: String, trim: true }, - Orgchartdata: { type: String, required: true }, + Orgchartdata: { type: String,}, Logo: { type: "String", required: false, diff --git a/back-end/routes/unitRoutes.js b/back-end/routes/unitRoutes.js index 34767934..83b2e814 100644 --- a/back-end/routes/unitRoutes.js +++ b/back-end/routes/unitRoutes.js @@ -1,13 +1,14 @@ const express = require("express"); const { updateUnit, - updateLogo + updateLogo, + addUnit } = require("../controllers/unitControllers"); const { protect, onlyAdmin } = require("../middleware/authMiddleware"); const router = express.Router(); -//router.route("/").post(protect, addUnit); +router.route("/").post(onlyAdmin, addUnit); router.route("/").put(onlyAdmin, updateUnit); router.route("/logo").put(onlyAdmin, updateLogo); From 1111c4aa0959a4de9f4573a34917d78c53a60e03 Mon Sep 17 00:00:00 2001 From: yhcho0405 Date: Mon, 17 Oct 2022 08:14:09 +0900 Subject: [PATCH 06/11] Add: reporting system model/controller --- back-end/controllers/reportsysControllers.js | 203 +++++++++++++++++++ back-end/models/reportsysModel.js | 19 ++ back-end/models/unitModel.js | 3 +- back-end/routes/reportsysRoutes.js | 21 ++ back-end/server.js | 2 + 5 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 back-end/controllers/reportsysControllers.js create mode 100644 back-end/models/reportsysModel.js create mode 100644 back-end/routes/reportsysRoutes.js diff --git a/back-end/controllers/reportsysControllers.js b/back-end/controllers/reportsysControllers.js new file mode 100644 index 00000000..85f9c160 --- /dev/null +++ b/back-end/controllers/reportsysControllers.js @@ -0,0 +1,203 @@ +const asyncHandler = require("express-async-handler"); +const Chat = require("../models/chatModel"); +const User = require("../models/userModel"); + +//@description Create or fetch One to One Chat +//@route POST /api/chat/ +//@access Protected +const accessChat = asyncHandler(async (req, res) => { + const { userId } = req.body; + + if (!userId) { + console.log("UserId param not sent with request"); + return res.sendStatus(400); + } + + var isChat = await Chat.find({ + isGroupChat: false, + $and: [ + { users: { $elemMatch: { $eq: req.user._id } } }, + { users: { $elemMatch: { $eq: userId } } }, + ], + }) + .populate("users", "-password") + .populate("latestMessage"); + + isChat = await User.populate(isChat, { + path: "latestMessage.sender", + select: "name pic email", + }); + + if (isChat.length > 0) { + res.send(isChat[0]); + } else { + var chatData = { + chatName: "sender", + isGroupChat: false, + users: [req.user._id, userId], + }; + + try { + const createdChat = await Chat.create(chatData); + const FullChat = await Chat.findOne({ _id: createdChat._id }).populate( + "users", + "-password" + ); + res.status(200).json(FullChat); + } catch (error) { + res.status(400); + throw new Error(error.message); + } + } +}); + +//@description Fetch all chats for a user +//@route GET /api/chat/ +//@access Protected +const fetchChats = asyncHandler(async (req, res) => { + try { + Chat.find({ users: { $elemMatch: { $eq: req.user._id } } }) + .populate("users", "-password") + .populate("groupAdmin", "-password") + .populate("latestMessage") + .sort({ updatedAt: -1 }) + .then(async (results) => { + results = await User.populate(results, { + path: "latestMessage.sender", + select: "name pic email", + }); + res.status(200).send(results); + }); + } catch (error) { + res.status(400); + throw new Error(error.message); + } +}); + +//@description Create New Group Chat +//@route POST /api/chat/group +//@access Protected +const createGroupChat = asyncHandler(async (req, res) => { + if (!req.body.users || !req.body.name) { + return res.status(400).send({ message: "Please Fill all the feilds" }); + } + + var users = JSON.parse(req.body.users); + + if (users.length < 2) { + return res + .status(400) + .send("More than 2 users are required to form a group chat"); + } + + users.push(req.user); + + try { + const groupChat = await Chat.create({ + chatName: req.body.name, + users: users, + isGroupChat: true, + groupAdmin: req.user, + }); + + const fullGroupChat = await Chat.findOne({ _id: groupChat._id }) + .populate("users", "-password") + .populate("groupAdmin", "-password"); + + res.status(200).json(fullGroupChat); + } catch (error) { + res.status(400); + throw new Error(error.message); + } +}); + +// @desc Rename Group +// @route PUT /api/chat/rename +// @access Protected +const renameGroup = asyncHandler(async (req, res) => { + const { chatId, chatName } = req.body; + + const updatedChat = await Chat.findByIdAndUpdate( + chatId, + { + chatName: chatName, + }, + { + new: true, + } + ) + .populate("users", "-password") + .populate("groupAdmin", "-password"); + + if (!updatedChat) { + res.status(404); + throw new Error("Chat Not Found"); + } else { + res.json(updatedChat); + } +}); + +// @desc Remove user from Group +// @route PUT /api/chat/groupremove +// @access Protected +const removeFromGroup = asyncHandler(async (req, res) => { + const { chatId, userId } = req.body; + + // check if the requester is admin + + const removed = await Chat.findByIdAndUpdate( + chatId, + { + $pull: { users: userId }, + }, + { + new: true, + } + ) + .populate("users", "-password") + .populate("groupAdmin", "-password"); + + if (!removed) { + res.status(404); + throw new Error("Chat Not Found"); + } else { + res.json(removed); + } +}); + +// @desc Add user to Group / Leave +// @route PUT /api/chat/groupadd +// @access Protected +const addToGroup = asyncHandler(async (req, res) => { + const { chatId, userId } = req.body; + + // check if the requester is admin + + const added = await Chat.findByIdAndUpdate( + chatId, + { + $push: { users: userId }, + }, + { + new: true, + } + ) + .populate("users", "-password") + .populate("groupAdmin", "-password"); + + if (!added) { + res.status(404); + throw new Error("Chat Not Found"); + } else { + res.json(added); + } +}); + +module.exports = { + accessChat, + fetchChats, + createGroupChat, + renameGroup, + addToGroup, + removeFromGroup, +}; diff --git a/back-end/models/reportsysModel.js b/back-end/models/reportsysModel.js new file mode 100644 index 00000000..a8b9ce8b --- /dev/null +++ b/back-end/models/reportsysModel.js @@ -0,0 +1,19 @@ +const mongoose = require("mongoose"); + +const reportModel = mongoose.Schema( + { + User: { type: mongoose.Schema.Types.ObjectId, ref: "User" }, + Type: { type: String }, + Status: { type: String }, + Invited: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], + ReportingSystem: { type: String }, + ReportName: { type: String, required: true, trim: true }, + Content: { type: String }, + Comment: [{ type: mongoose.Schema.Types.ObjectId, ref: "Comment" }], + }, + { timestamps: true } +); + +const Report = mongoose.model("Report", reportModel); + +module.exports = Reportsys; diff --git a/back-end/models/unitModel.js b/back-end/models/unitModel.js index f3f7302e..018299dd 100644 --- a/back-end/models/unitModel.js +++ b/back-end/models/unitModel.js @@ -13,7 +13,8 @@ const unitModel = mongoose.Schema( }, Members: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], ReportCard: [{ type: mongoose.Schema.Types.ObjectId, ref: "Report" }], - unitAdmins: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }] + unitAdmins: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], + reportSys: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }] }, { timestamps: true } ); diff --git a/back-end/routes/reportsysRoutes.js b/back-end/routes/reportsysRoutes.js new file mode 100644 index 00000000..6159ef7a --- /dev/null +++ b/back-end/routes/reportsysRoutes.js @@ -0,0 +1,21 @@ +const express = require("express"); +const { + accessChat, + fetchChats, + createGroupChat, + removeFromGroup, + addToGroup, + renameGroup, +} = require("../controllers/reportsysControllers"); +const { protect } = require("../middleware/authMiddleware"); + +const router = express.Router(); + +router.route("/").post(protect, accessChat); +router.route("/").get(protect, fetchChats); +router.route("/group").post(protect, createGroupChat); +router.route("/rename").put(protect, renameGroup); +router.route("/groupremove").put(protect, removeFromGroup); +router.route("/groupadd").put(protect, addToGroup); + +module.exports = router; diff --git a/back-end/server.js b/back-end/server.js index 93e8c3e2..c018ad7d 100644 --- a/back-end/server.js +++ b/back-end/server.js @@ -8,6 +8,7 @@ const messageRoutes = require("./routes/messageRoutes"); const unitRoutes = require("./routes/unitRoutes"); const reportRoutes = require("./routes/reportRoutes"); const commentRoutes = require("./routes/commentRoutes"); +const commentRoutes = require("./routes/reportsysRoutes"); const { notFound, errorHandler } = require("./middleware/errorMiddleware"); const path = require("path"); @@ -28,6 +29,7 @@ app.use("/api/message", messageRoutes); app.use("/api/unit", unitRoutes); app.use("/api/report", reportRoutes); app.use("/api/comment", commentRoutes); +app.use("/api/reportsys", reportsysRoutes); /*const __dirname1 = path.resolve(); From cc6ffc11373a310a201f7691ee7c5a7fea1a5427 Mon Sep 17 00:00:00 2001 From: yhcho0405 Date: Mon, 17 Oct 2022 14:29:36 +0900 Subject: [PATCH 07/11] Feat: reporting system api --- back-end/controllers/reportsysControllers.js | 232 +++---------------- back-end/controllers/userControllers.js | 6 +- back-end/models/reportsysModel.js | 15 +- back-end/routes/reportsysRoutes.js | 16 +- back-end/server.js | 2 +- 5 files changed, 47 insertions(+), 224 deletions(-) diff --git a/back-end/controllers/reportsysControllers.js b/back-end/controllers/reportsysControllers.js index 85f9c160..7cb50e29 100644 --- a/back-end/controllers/reportsysControllers.js +++ b/back-end/controllers/reportsysControllers.js @@ -1,203 +1,39 @@ const asyncHandler = require("express-async-handler"); -const Chat = require("../models/chatModel"); -const User = require("../models/userModel"); - -//@description Create or fetch One to One Chat -//@route POST /api/chat/ -//@access Protected -const accessChat = asyncHandler(async (req, res) => { - const { userId } = req.body; - - if (!userId) { - console.log("UserId param not sent with request"); - return res.sendStatus(400); - } - - var isChat = await Chat.find({ - isGroupChat: false, - $and: [ - { users: { $elemMatch: { $eq: req.user._id } } }, - { users: { $elemMatch: { $eq: userId } } }, - ], - }) - .populate("users", "-password") - .populate("latestMessage"); - - isChat = await User.populate(isChat, { - path: "latestMessage.sender", - select: "name pic email", +const Reportsys = require("../models/reportsysModel"); +const Unit = require("../models/unitModel"); + +//@description Create new reportsys +//@route POST /api/reportsys/ +//@access Protected(onlyadmin) +const addReportsys = asyncHandler(async (req, res) => { + const { Title, List } = req.body; + + if (!Title || !List) { + res.status(400); + throw new Error("모든 정보를 입력하세요."); + } + + Unit = req.user.Unit; + + const reportsys = await Reportsys.create({ + Title, + List, + Unit + }); + + if (reportsys) { + res.status(201).json({ + _id: reportsys._id, + Title: reportsys.Title, + List: reportsys.List, + Unit: reportsys.Unit + }); + } else { + res.status(400); + throw new Error("사용자를 찾을 수 없습니다."); + } }); - if (isChat.length > 0) { - res.send(isChat[0]); - } else { - var chatData = { - chatName: "sender", - isGroupChat: false, - users: [req.user._id, userId], - }; - - try { - const createdChat = await Chat.create(chatData); - const FullChat = await Chat.findOne({ _id: createdChat._id }).populate( - "users", - "-password" - ); - res.status(200).json(FullChat); - } catch (error) { - res.status(400); - throw new Error(error.message); - } - } -}); - -//@description Fetch all chats for a user -//@route GET /api/chat/ -//@access Protected -const fetchChats = asyncHandler(async (req, res) => { - try { - Chat.find({ users: { $elemMatch: { $eq: req.user._id } } }) - .populate("users", "-password") - .populate("groupAdmin", "-password") - .populate("latestMessage") - .sort({ updatedAt: -1 }) - .then(async (results) => { - results = await User.populate(results, { - path: "latestMessage.sender", - select: "name pic email", - }); - res.status(200).send(results); - }); - } catch (error) { - res.status(400); - throw new Error(error.message); - } -}); - -//@description Create New Group Chat -//@route POST /api/chat/group -//@access Protected -const createGroupChat = asyncHandler(async (req, res) => { - if (!req.body.users || !req.body.name) { - return res.status(400).send({ message: "Please Fill all the feilds" }); - } - - var users = JSON.parse(req.body.users); - - if (users.length < 2) { - return res - .status(400) - .send("More than 2 users are required to form a group chat"); - } - - users.push(req.user); - - try { - const groupChat = await Chat.create({ - chatName: req.body.name, - users: users, - isGroupChat: true, - groupAdmin: req.user, - }); - - const fullGroupChat = await Chat.findOne({ _id: groupChat._id }) - .populate("users", "-password") - .populate("groupAdmin", "-password"); - - res.status(200).json(fullGroupChat); - } catch (error) { - res.status(400); - throw new Error(error.message); - } -}); - -// @desc Rename Group -// @route PUT /api/chat/rename -// @access Protected -const renameGroup = asyncHandler(async (req, res) => { - const { chatId, chatName } = req.body; - - const updatedChat = await Chat.findByIdAndUpdate( - chatId, - { - chatName: chatName, - }, - { - new: true, - } - ) - .populate("users", "-password") - .populate("groupAdmin", "-password"); - - if (!updatedChat) { - res.status(404); - throw new Error("Chat Not Found"); - } else { - res.json(updatedChat); - } -}); - -// @desc Remove user from Group -// @route PUT /api/chat/groupremove -// @access Protected -const removeFromGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; - - // check if the requester is admin - - const removed = await Chat.findByIdAndUpdate( - chatId, - { - $pull: { users: userId }, - }, - { - new: true, - } - ) - .populate("users", "-password") - .populate("groupAdmin", "-password"); - - if (!removed) { - res.status(404); - throw new Error("Chat Not Found"); - } else { - res.json(removed); - } -}); - -// @desc Add user to Group / Leave -// @route PUT /api/chat/groupadd -// @access Protected -const addToGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; - - // check if the requester is admin - - const added = await Chat.findByIdAndUpdate( - chatId, - { - $push: { users: userId }, - }, - { - new: true, - } - ) - .populate("users", "-password") - .populate("groupAdmin", "-password"); - - if (!added) { - res.status(404); - throw new Error("Chat Not Found"); - } else { - res.json(added); - } -}); - module.exports = { - accessChat, - fetchChats, - createGroupChat, - renameGroup, - addToGroup, - removeFromGroup, + addReportsys }; diff --git a/back-end/controllers/userControllers.js b/back-end/controllers/userControllers.js index a1b3ea19..5ef17fc1 100644 --- a/back-end/controllers/userControllers.js +++ b/back-end/controllers/userControllers.js @@ -7,6 +7,7 @@ const bcrypt = require("bcryptjs"); //@route GET /api/user?search=?index= //@access Protected const allUsers = asyncHandler(async (req, res) => { + console.log(req.user._id) const ranks = ["CV9", "CV8", "CV7", "CV6", "CV5", "CV4", "CV3", "CV2", "CV1", "PVT", "PFC", "CPL", "SGT", @@ -16,7 +17,7 @@ const allUsers = asyncHandler(async (req, res) => { const keyword = req.query.search ? { $or: [ - //{ Name: { $regex: req.query.search, $options: "i" } }, + { Name: { $regex: req.query.search, $options: "i" } }, { DoDID: { $regex: req.query.search, $options: "i" } }, //{ email: { $regex: req.query.search, $options: "i" } }, ], @@ -24,8 +25,9 @@ const allUsers = asyncHandler(async (req, res) => { : 0 ; users = await User.find({}, {password:0}); users.sort(function(a,b) { - return (ranks.indexOf(b.Rank) + b.is_registered ? 0 : 100) - (ranks.indexOf(a.Rank) + a.is_registered ? 0 : 100); + return (ranks.indexOf(b.Rank) + (b.is_registered ? 0 : 100)) - (ranks.indexOf(a.Rank) + (a.is_registered ? 0 : 100)); }); + console.log(users) const index = req.query.index; if (index) { res.send(users.slice(parseInt(index) * 4, parseInt(index) * 4 + 4)); diff --git a/back-end/models/reportsysModel.js b/back-end/models/reportsysModel.js index a8b9ce8b..4f541065 100644 --- a/back-end/models/reportsysModel.js +++ b/back-end/models/reportsysModel.js @@ -1,19 +1,14 @@ const mongoose = require("mongoose"); -const reportModel = mongoose.Schema( +const reportsysModel = mongoose.Schema( { - User: { type: mongoose.Schema.Types.ObjectId, ref: "User" }, - Type: { type: String }, - Status: { type: String }, - Invited: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], - ReportingSystem: { type: String }, - ReportName: { type: String, required: true, trim: true }, - Content: { type: String }, - Comment: [{ type: mongoose.Schema.Types.ObjectId, ref: "Comment" }], + Title: { type: String }, + List: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], + Unit: { type: mongoose.Schema.Types.ObjectId, ref: "Unit" } }, { timestamps: true } ); -const Report = mongoose.model("Report", reportModel); +const Reportsys = mongoose.model("Reportsys", reportsysModel); module.exports = Reportsys; diff --git a/back-end/routes/reportsysRoutes.js b/back-end/routes/reportsysRoutes.js index 6159ef7a..342c35bb 100644 --- a/back-end/routes/reportsysRoutes.js +++ b/back-end/routes/reportsysRoutes.js @@ -1,21 +1,11 @@ const express = require("express"); const { - accessChat, - fetchChats, - createGroupChat, - removeFromGroup, - addToGroup, - renameGroup, + addReportsys } = require("../controllers/reportsysControllers"); -const { protect } = require("../middleware/authMiddleware"); +const { protect, onlyAdmin } = require("../middleware/authMiddleware"); const router = express.Router(); -router.route("/").post(protect, accessChat); -router.route("/").get(protect, fetchChats); -router.route("/group").post(protect, createGroupChat); -router.route("/rename").put(protect, renameGroup); -router.route("/groupremove").put(protect, removeFromGroup); -router.route("/groupadd").put(protect, addToGroup); +router.route("/").post(onlyAdmin, addReportsys); module.exports = router; diff --git a/back-end/server.js b/back-end/server.js index c018ad7d..2370dbc4 100644 --- a/back-end/server.js +++ b/back-end/server.js @@ -8,7 +8,7 @@ const messageRoutes = require("./routes/messageRoutes"); const unitRoutes = require("./routes/unitRoutes"); const reportRoutes = require("./routes/reportRoutes"); const commentRoutes = require("./routes/commentRoutes"); -const commentRoutes = require("./routes/reportsysRoutes"); +const reportsysRoutes = require("./routes/reportsysRoutes"); const { notFound, errorHandler } = require("./middleware/errorMiddleware"); const path = require("path"); From 40f01eb747f1827b335e6619c139a4cd358f9c86 Mon Sep 17 00:00:00 2001 From: yhcho0405 Date: Mon, 17 Oct 2022 14:39:16 +0900 Subject: [PATCH 08/11] Style: back-end code beautifying --- back-end/ai/classifier.js | 64 +++++---- back-end/config/generateToken.js | 4 +- back-end/controllers/chatControllers.js | 112 ++++++++++------ back-end/controllers/commentControllers.js | 112 ++++++++++------ back-end/controllers/messageControllers.js | 18 ++- back-end/controllers/reportControllers.js | 112 ++++++++++------ back-end/controllers/reportsysControllers.js | 33 ++--- back-end/controllers/unitControllers.js | 36 +++--- back-end/controllers/userControllers.js | 129 +++++++++++++------ back-end/middleware/authMiddleware.js | 5 +- back-end/middleware/errorMiddleware.js | 5 +- back-end/models/chatModel.js | 35 +++-- back-end/models/commentModel.js | 26 ++-- back-end/models/messageModel.js | 27 ++-- back-end/models/reportModel.js | 44 +++++-- back-end/models/reportsysModel.js | 23 ++-- back-end/models/unitModel.js | 52 +++++--- back-end/models/userModel.js | 87 +++++++++---- back-end/routes/chatRoutes.js | 4 +- back-end/routes/commentRoutes.js | 4 +- back-end/routes/messageRoutes.js | 4 +- back-end/routes/reportRoutes.js | 4 +- back-end/routes/reportsysRoutes.js | 5 +- back-end/routes/unitRoutes.js | 5 +- back-end/routes/userRoutes.js | 9 +- back-end/server.js | 6 +- 26 files changed, 635 insertions(+), 330 deletions(-) diff --git a/back-end/ai/classifier.js b/back-end/ai/classifier.js index 9d863eb3..e635b7cb 100644 --- a/back-end/ai/classifier.js +++ b/back-end/ai/classifier.js @@ -1,4 +1,3 @@ - const TheClassifier = require("classificator"); const Translator = require("nodepapago"); const posTagger = require("wink-pos-tagger"); @@ -21,38 +20,38 @@ let positive = [ `I am drooling over the awesome bean and cheese quesadillas.` ] var negative = [ - `Suicide`, - `urgent matter`, - 'emergency situation', - `dead`, - 'wire', - `secret`, - `classified`, - `attacked`, - `firearm`, - `unknown man has appeared`, - `in front of the guardhouse`, - `there are suspicious personnel`, - `in possession of a firearm`, - `A suspicious person has been found`, - `a landmine is in front of you`, - `My unit has been severly hurt`, - `hail weather snow advisory`, - `dangerous situation`, - '5 minute waiting group', - 'North Korean provocation', - 'Missle Launch', - 'ammunition distribution', - 'unusual occurrence', - `Gross, worst taco ever.`, - `The buritos gave me horrible diarrhea.`, - `I'm going to puke if I eat another bad nacho.`, - `I'd rather die than eat those nasty enchiladas.`, - 'special has happened in the dormitory' + `Suicide`, + `urgent matter`, + 'emergency situation', + `dead`, + 'wire', + `secret`, + `classified`, + `attacked`, + `firearm`, + `unknown man has appeared`, + `in front of the guardhouse`, + `there are suspicious personnel`, + `in possession of a firearm`, + `A suspicious person has been found`, + `a landmine is in front of you`, + `My unit has been severly hurt`, + `hail weather snow advisory`, + `dangerous situation`, + '5 minute waiting group', + 'North Korean provocation', + 'Missle Launch', + 'ammunition distribution', + 'unusual occurrence', + `Gross, worst taco ever.`, + `The buritos gave me horrible diarrhea.`, + `I'm going to puke if I eat another bad nacho.`, + `I'd rather die than eat those nasty enchiladas.`, + 'special has happened in the dormitory' ] // classifier.addDocuments(positive, 'positive') // classifier.addDocuments(negative, 'negative') - + // classifier.train() for (let i = 0; i < positive.length; i++) { @@ -82,7 +81,7 @@ module.exports = async function (text) { var taggedWord = words[i].value; var tag = words[i].pos; if (tag.includes('N') || tag.includes('V') || tag.includes('A')) - parsedtext = parsedtext + taggedWord + " " + parsedtext = parsedtext + taggedWord + " " } let classifieddata = classifier.categorize(parsedtext) let score = classifieddata['likelihoods'][0]['proba'] @@ -99,6 +98,3 @@ module.exports = async function (text) { } } //let { val } = await getScore('위병소 앞 총기를 든 거수자들이 나타났습니다. 자살하고싶어') - - - diff --git a/back-end/config/generateToken.js b/back-end/config/generateToken.js index a3276451..746aba2c 100644 --- a/back-end/config/generateToken.js +++ b/back-end/config/generateToken.js @@ -1,7 +1,9 @@ const jwt = require("jsonwebtoken"); const generateToken = (id) => { - return jwt.sign({ id }, process.env.JWT_SECRET, { + return jwt.sign({ + id + }, process.env.JWT_SECRET, { expiresIn: "30d", }); }; diff --git a/back-end/controllers/chatControllers.js b/back-end/controllers/chatControllers.js index 98a56752..63369708 100644 --- a/back-end/controllers/chatControllers.js +++ b/back-end/controllers/chatControllers.js @@ -6,7 +6,9 @@ const User = require("../models/userModel"); //@route POST /api/chat/ //@access Protected const accessChat = asyncHandler(async (req, res) => { - const { userId } = req.body; + const { + userId + } = req.body; if (!userId) { console.log("잘못된 요청입니다.(UserId param not sent with request)"); @@ -14,12 +16,23 @@ const accessChat = asyncHandler(async (req, res) => { } var isChat = await Chat.find({ - isGroupChat: false, - $and: [ - { users: { $elemMatch: { $eq: req.user._id } } }, - { users: { $elemMatch: { $eq: userId } } }, - ], - }) + isGroupChat: false, + $and: [{ + users: { + $elemMatch: { + $eq: req.user._id + } + } + }, + { + users: { + $elemMatch: { + $eq: userId + } + } + }, + ], + }) .populate("users", "-password") .populate("latestMessage"); @@ -39,7 +52,9 @@ const accessChat = asyncHandler(async (req, res) => { try { const createdChat = await Chat.create(chatData); - const FullChat = await Chat.findOne({ _id: createdChat._id }).populate( + const FullChat = await Chat.findOne({ + _id: createdChat._id + }).populate( "users", "-password" ); @@ -56,11 +71,19 @@ const accessChat = asyncHandler(async (req, res) => { //@access Protected const fetchChats = asyncHandler(async (req, res) => { try { - Chat.find({ users: { $elemMatch: { $eq: req.user._id } } }) + Chat.find({ + users: { + $elemMatch: { + $eq: req.user._id + } + } + }) .populate("users", "-password") .populate("groupAdmin", "-password") .populate("latestMessage") - .sort({ updatedAt: -1 }) + .sort({ + updatedAt: -1 + }) .then(async (results) => { results = await User.populate(results, { path: "latestMessage.sender", @@ -79,7 +102,9 @@ const fetchChats = asyncHandler(async (req, res) => { //@access Protected const createGroupChat = asyncHandler(async (req, res) => { if (!req.body.users || !req.body.name) { - return res.status(400).send({ message: "모든 정보를 입력하세요" }); + return res.status(400).send({ + message: "모든 정보를 입력하세요" + }); } var users = JSON.parse(req.body.users); @@ -100,7 +125,9 @@ const createGroupChat = asyncHandler(async (req, res) => { groupAdmin: req.user, }); - const fullGroupChat = await Chat.findOne({ _id: groupChat._id }) + const fullGroupChat = await Chat.findOne({ + _id: groupChat._id + }) .populate("users", "-password") .populate("groupAdmin", "-password"); @@ -115,17 +142,18 @@ const createGroupChat = asyncHandler(async (req, res) => { // @route PUT /api/chat/rename // @access Protected const renameGroup = asyncHandler(async (req, res) => { - const { chatId, chatName } = req.body; + const { + chatId, + chatName + } = req.body; const updatedChat = await Chat.findByIdAndUpdate( - chatId, - { - chatName: chatName, - }, - { - new: true, - } - ) + chatId, { + chatName: chatName, + }, { + new: true, + } + ) .populate("users", "-password") .populate("groupAdmin", "-password"); @@ -141,19 +169,22 @@ const renameGroup = asyncHandler(async (req, res) => { // @route PUT /api/chat/groupremove // @access Protected const removeFromGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; + const { + chatId, + userId + } = req.body; // check if the requester is admin const removed = await Chat.findByIdAndUpdate( - chatId, - { - $pull: { users: userId }, - }, - { - new: true, - } - ) + chatId, { + $pull: { + users: userId + }, + }, { + new: true, + } + ) .populate("users", "-password") .populate("groupAdmin", "-password"); @@ -169,19 +200,22 @@ const removeFromGroup = asyncHandler(async (req, res) => { // @route PUT /api/chat/groupadd // @access Protected const addToGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; + const { + chatId, + userId + } = req.body; // check if the requester is admin const added = await Chat.findByIdAndUpdate( - chatId, - { - $push: { users: userId }, - }, - { - new: true, - } - ) + chatId, { + $push: { + users: userId + }, + }, { + new: true, + } + ) .populate("users", "-password") .populate("groupAdmin", "-password"); diff --git a/back-end/controllers/commentControllers.js b/back-end/controllers/commentControllers.js index 85f9c160..da4eadb1 100644 --- a/back-end/controllers/commentControllers.js +++ b/back-end/controllers/commentControllers.js @@ -6,7 +6,9 @@ const User = require("../models/userModel"); //@route POST /api/chat/ //@access Protected const accessChat = asyncHandler(async (req, res) => { - const { userId } = req.body; + const { + userId + } = req.body; if (!userId) { console.log("UserId param not sent with request"); @@ -14,12 +16,23 @@ const accessChat = asyncHandler(async (req, res) => { } var isChat = await Chat.find({ - isGroupChat: false, - $and: [ - { users: { $elemMatch: { $eq: req.user._id } } }, - { users: { $elemMatch: { $eq: userId } } }, - ], - }) + isGroupChat: false, + $and: [{ + users: { + $elemMatch: { + $eq: req.user._id + } + } + }, + { + users: { + $elemMatch: { + $eq: userId + } + } + }, + ], + }) .populate("users", "-password") .populate("latestMessage"); @@ -39,7 +52,9 @@ const accessChat = asyncHandler(async (req, res) => { try { const createdChat = await Chat.create(chatData); - const FullChat = await Chat.findOne({ _id: createdChat._id }).populate( + const FullChat = await Chat.findOne({ + _id: createdChat._id + }).populate( "users", "-password" ); @@ -56,11 +71,19 @@ const accessChat = asyncHandler(async (req, res) => { //@access Protected const fetchChats = asyncHandler(async (req, res) => { try { - Chat.find({ users: { $elemMatch: { $eq: req.user._id } } }) + Chat.find({ + users: { + $elemMatch: { + $eq: req.user._id + } + } + }) .populate("users", "-password") .populate("groupAdmin", "-password") .populate("latestMessage") - .sort({ updatedAt: -1 }) + .sort({ + updatedAt: -1 + }) .then(async (results) => { results = await User.populate(results, { path: "latestMessage.sender", @@ -79,7 +102,9 @@ const fetchChats = asyncHandler(async (req, res) => { //@access Protected const createGroupChat = asyncHandler(async (req, res) => { if (!req.body.users || !req.body.name) { - return res.status(400).send({ message: "Please Fill all the feilds" }); + return res.status(400).send({ + message: "Please Fill all the feilds" + }); } var users = JSON.parse(req.body.users); @@ -100,7 +125,9 @@ const createGroupChat = asyncHandler(async (req, res) => { groupAdmin: req.user, }); - const fullGroupChat = await Chat.findOne({ _id: groupChat._id }) + const fullGroupChat = await Chat.findOne({ + _id: groupChat._id + }) .populate("users", "-password") .populate("groupAdmin", "-password"); @@ -115,17 +142,18 @@ const createGroupChat = asyncHandler(async (req, res) => { // @route PUT /api/chat/rename // @access Protected const renameGroup = asyncHandler(async (req, res) => { - const { chatId, chatName } = req.body; + const { + chatId, + chatName + } = req.body; const updatedChat = await Chat.findByIdAndUpdate( - chatId, - { - chatName: chatName, - }, - { - new: true, - } - ) + chatId, { + chatName: chatName, + }, { + new: true, + } + ) .populate("users", "-password") .populate("groupAdmin", "-password"); @@ -141,19 +169,22 @@ const renameGroup = asyncHandler(async (req, res) => { // @route PUT /api/chat/groupremove // @access Protected const removeFromGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; + const { + chatId, + userId + } = req.body; // check if the requester is admin const removed = await Chat.findByIdAndUpdate( - chatId, - { - $pull: { users: userId }, - }, - { - new: true, - } - ) + chatId, { + $pull: { + users: userId + }, + }, { + new: true, + } + ) .populate("users", "-password") .populate("groupAdmin", "-password"); @@ -169,19 +200,22 @@ const removeFromGroup = asyncHandler(async (req, res) => { // @route PUT /api/chat/groupadd // @access Protected const addToGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; + const { + chatId, + userId + } = req.body; // check if the requester is admin const added = await Chat.findByIdAndUpdate( - chatId, - { - $push: { users: userId }, - }, - { - new: true, - } - ) + chatId, { + $push: { + users: userId + }, + }, { + new: true, + } + ) .populate("users", "-password") .populate("groupAdmin", "-password"); diff --git a/back-end/controllers/messageControllers.js b/back-end/controllers/messageControllers.js index 7615af2c..1c0c0f2d 100644 --- a/back-end/controllers/messageControllers.js +++ b/back-end/controllers/messageControllers.js @@ -8,7 +8,9 @@ const Chat = require("../models/chatModel"); //@access Protected const allMessages = asyncHandler(async (req, res) => { try { - const messages = await Message.find({ chat: req.params.chatId }) + const messages = await Message.find({ + chat: req.params.chatId + }) .populate("sender", "rank name dodId pic") .populate("chat"); res.json(messages); @@ -22,7 +24,10 @@ const allMessages = asyncHandler(async (req, res) => { //@route POST /api/Message/ //@access Protected const sendMessage = asyncHandler(async (req, res) => { - const { content, chatId } = req.body; + const { + content, + chatId + } = req.body; if (!content || !chatId) { console.log("Invalid data passed into request"); @@ -45,7 +50,9 @@ const sendMessage = asyncHandler(async (req, res) => { select: "name pic dodId", }); - await Chat.findByIdAndUpdate(req.body.chatId, { latestMessage: message }); + await Chat.findByIdAndUpdate(req.body.chatId, { + latestMessage: message + }); res.json(message); } catch (error) { @@ -54,4 +61,7 @@ const sendMessage = asyncHandler(async (req, res) => { } }); -module.exports = { allMessages, sendMessage }; +module.exports = { + allMessages, + sendMessage +}; diff --git a/back-end/controllers/reportControllers.js b/back-end/controllers/reportControllers.js index 85f9c160..da4eadb1 100644 --- a/back-end/controllers/reportControllers.js +++ b/back-end/controllers/reportControllers.js @@ -6,7 +6,9 @@ const User = require("../models/userModel"); //@route POST /api/chat/ //@access Protected const accessChat = asyncHandler(async (req, res) => { - const { userId } = req.body; + const { + userId + } = req.body; if (!userId) { console.log("UserId param not sent with request"); @@ -14,12 +16,23 @@ const accessChat = asyncHandler(async (req, res) => { } var isChat = await Chat.find({ - isGroupChat: false, - $and: [ - { users: { $elemMatch: { $eq: req.user._id } } }, - { users: { $elemMatch: { $eq: userId } } }, - ], - }) + isGroupChat: false, + $and: [{ + users: { + $elemMatch: { + $eq: req.user._id + } + } + }, + { + users: { + $elemMatch: { + $eq: userId + } + } + }, + ], + }) .populate("users", "-password") .populate("latestMessage"); @@ -39,7 +52,9 @@ const accessChat = asyncHandler(async (req, res) => { try { const createdChat = await Chat.create(chatData); - const FullChat = await Chat.findOne({ _id: createdChat._id }).populate( + const FullChat = await Chat.findOne({ + _id: createdChat._id + }).populate( "users", "-password" ); @@ -56,11 +71,19 @@ const accessChat = asyncHandler(async (req, res) => { //@access Protected const fetchChats = asyncHandler(async (req, res) => { try { - Chat.find({ users: { $elemMatch: { $eq: req.user._id } } }) + Chat.find({ + users: { + $elemMatch: { + $eq: req.user._id + } + } + }) .populate("users", "-password") .populate("groupAdmin", "-password") .populate("latestMessage") - .sort({ updatedAt: -1 }) + .sort({ + updatedAt: -1 + }) .then(async (results) => { results = await User.populate(results, { path: "latestMessage.sender", @@ -79,7 +102,9 @@ const fetchChats = asyncHandler(async (req, res) => { //@access Protected const createGroupChat = asyncHandler(async (req, res) => { if (!req.body.users || !req.body.name) { - return res.status(400).send({ message: "Please Fill all the feilds" }); + return res.status(400).send({ + message: "Please Fill all the feilds" + }); } var users = JSON.parse(req.body.users); @@ -100,7 +125,9 @@ const createGroupChat = asyncHandler(async (req, res) => { groupAdmin: req.user, }); - const fullGroupChat = await Chat.findOne({ _id: groupChat._id }) + const fullGroupChat = await Chat.findOne({ + _id: groupChat._id + }) .populate("users", "-password") .populate("groupAdmin", "-password"); @@ -115,17 +142,18 @@ const createGroupChat = asyncHandler(async (req, res) => { // @route PUT /api/chat/rename // @access Protected const renameGroup = asyncHandler(async (req, res) => { - const { chatId, chatName } = req.body; + const { + chatId, + chatName + } = req.body; const updatedChat = await Chat.findByIdAndUpdate( - chatId, - { - chatName: chatName, - }, - { - new: true, - } - ) + chatId, { + chatName: chatName, + }, { + new: true, + } + ) .populate("users", "-password") .populate("groupAdmin", "-password"); @@ -141,19 +169,22 @@ const renameGroup = asyncHandler(async (req, res) => { // @route PUT /api/chat/groupremove // @access Protected const removeFromGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; + const { + chatId, + userId + } = req.body; // check if the requester is admin const removed = await Chat.findByIdAndUpdate( - chatId, - { - $pull: { users: userId }, - }, - { - new: true, - } - ) + chatId, { + $pull: { + users: userId + }, + }, { + new: true, + } + ) .populate("users", "-password") .populate("groupAdmin", "-password"); @@ -169,19 +200,22 @@ const removeFromGroup = asyncHandler(async (req, res) => { // @route PUT /api/chat/groupadd // @access Protected const addToGroup = asyncHandler(async (req, res) => { - const { chatId, userId } = req.body; + const { + chatId, + userId + } = req.body; // check if the requester is admin const added = await Chat.findByIdAndUpdate( - chatId, - { - $push: { users: userId }, - }, - { - new: true, - } - ) + chatId, { + $push: { + users: userId + }, + }, { + new: true, + } + ) .populate("users", "-password") .populate("groupAdmin", "-password"); diff --git a/back-end/controllers/reportsysControllers.js b/back-end/controllers/reportsysControllers.js index 7cb50e29..c01b3f4c 100644 --- a/back-end/controllers/reportsysControllers.js +++ b/back-end/controllers/reportsysControllers.js @@ -6,33 +6,36 @@ const Unit = require("../models/unitModel"); //@route POST /api/reportsys/ //@access Protected(onlyadmin) const addReportsys = asyncHandler(async (req, res) => { - const { Title, List } = req.body; + const { + Title, + List + } = req.body; if (!Title || !List) { - res.status(400); - throw new Error("모든 정보를 입력하세요."); + res.status(400); + throw new Error("모든 정보를 입력하세요."); } Unit = req.user.Unit; const reportsys = await Reportsys.create({ - Title, - List, - Unit + Title, + List, + Unit }); if (reportsys) { - res.status(201).json({ - _id: reportsys._id, - Title: reportsys.Title, - List: reportsys.List, - Unit: reportsys.Unit - }); + res.status(201).json({ + _id: reportsys._id, + Title: reportsys.Title, + List: reportsys.List, + Unit: reportsys.Unit + }); } else { - res.status(400); - throw new Error("사용자를 찾을 수 없습니다."); + res.status(400); + throw new Error("사용자를 찾을 수 없습니다."); } - }); +}); module.exports = { addReportsys diff --git a/back-end/controllers/unitControllers.js b/back-end/controllers/unitControllers.js index 4e367dbb..24c171ac 100644 --- a/back-end/controllers/unitControllers.js +++ b/back-end/controllers/unitControllers.js @@ -1,5 +1,4 @@ const asyncHandler = require("express-async-handler"); -const Chat = require("../models/chatModel"); const User = require("../models/userModel"); const Unit = require("../models/unitModel"); @@ -7,14 +6,20 @@ const Unit = require("../models/unitModel"); //@route POST /api/unit //@access Protected const addUnit = asyncHandler(async (req, res) => { - const { Unitname, Unitslogan, Logo } = req.body; + const { + Unitname, + Unitslogan, + Logo + } = req.body; - if (!Unitname || !Unitslogan || !Logo ) { + if (!Unitname || !Unitslogan || !Logo) { res.status(400); throw new Error("모든 정보를 입력하세요."); } - const unitExists = await User.findOne({ Unitname }); + const unitExists = await User.findOne({ + Unitname + }); if (unitExists) { res.status(400); @@ -49,9 +54,12 @@ const addUnit = asyncHandler(async (req, res) => { //@route POST /api/unit/ //@access Protected(only admin) const updateUnit = asyncHandler(async (req, res) => { - const { Unitname, Unitslogan} = req.body; + const { + Unitname, + Unitslogan + } = req.body; - if (!Unitname || !Unitslogan ) { + if (!Unitname || !Unitslogan) { res.status(400); throw new Error("모든 정보를 입력하세요."); } @@ -59,12 +67,10 @@ const updateUnit = asyncHandler(async (req, res) => { const unitId = req.user.Unit; const updatedUnit = await User.findByIdAndUpdate( - unitId, - { + unitId, { Unitname: Unitname, Unitslogan: Unitslogan - }, - { + }, { new: true, } ) @@ -88,7 +94,9 @@ const updateUnit = asyncHandler(async (req, res) => { //@route put /api/unit/logo //@access Protected(only admin) const updateLogo = asyncHandler(async (req, res) => { - const { Logo } = req.body; + const { + Logo + } = req.body; if (!Logo) { res.status(400); @@ -98,11 +106,9 @@ const updateLogo = asyncHandler(async (req, res) => { const unitId = req.user.Unit; const updatedUnit = await User.findByIdAndUpdate( - unitId, - { + unitId, { Logo: Logo - }, - { + }, { new: true, } ) diff --git a/back-end/controllers/userControllers.js b/back-end/controllers/userControllers.js index 5ef17fc1..e22395f8 100644 --- a/back-end/controllers/userControllers.js +++ b/back-end/controllers/userControllers.js @@ -9,22 +9,34 @@ const bcrypt = require("bcryptjs"); const allUsers = asyncHandler(async (req, res) => { console.log(req.user._id) const ranks = ["CV9", "CV8", "CV7", - "CV6", "CV5", "CV4", "CV3", "CV2", - "CV1", "PVT", "PFC", "CPL", "SGT", - "SST", "SFC", "MST", "SGM", "SEC", - "LIU", "LIU", "CPT", "MAJ", "LTC", - "COL", "BG", "MG", "LG", "GEN"]; - const keyword = req.query.search - ? { - $or: [ - { Name: { $regex: req.query.search, $options: "i" } }, - { DoDID: { $regex: req.query.search, $options: "i" } }, - //{ email: { $regex: req.query.search, $options: "i" } }, - ], - } - : 0 ; - users = await User.find({}, {password:0}); - users.sort(function(a,b) { + "CV6", "CV5", "CV4", "CV3", "CV2", + "CV1", "PVT", "PFC", "CPL", "SGT", + "SST", "SFC", "MST", "SGM", "SEC", + "LIU", "LIU", "CPT", "MAJ", "LTC", + "COL", "BG", "MG", "LG", "GEN" + ]; + const keyword = req.query.search ? + { + $or: [{ + Name: { + $regex: req.query.search, + $options: "i" + } + }, + { + DoDID: { + $regex: req.query.search, + $options: "i" + } + }, + //{ email: { $regex: req.query.search, $options: "i" } }, + ], + } : + 0; + users = await User.find({}, { + password: 0 + }); + users.sort(function (a, b) { return (ranks.indexOf(b.Rank) + (b.is_registered ? 0 : 100)) - (ranks.indexOf(a.Rank) + (a.is_registered ? 0 : 100)); }); console.log(users) @@ -32,7 +44,7 @@ const allUsers = asyncHandler(async (req, res) => { if (index) { res.send(users.slice(parseInt(index) * 4, parseInt(index) * 4 + 4)); } else if (keyword) { - res.send(await User.find(keyword));//.find({ _id: { $ne: req.user._id } })); + res.send(await User.find(keyword)); //.find({ _id: { $ne: req.user._id } })); } else { res.status(400); throw new Error("잘못된 요청입니다."); @@ -44,21 +56,28 @@ const allUsers = asyncHandler(async (req, res) => { //@route POST /api/user/add //@access Protected const addUser = asyncHandler(async (req, res) => { - const { Rank, Name, DoDID, Type } = req.body; + const { + Rank, + Name, + DoDID, + Type + } = req.body; if (!Rank || !Name || !DoDID || !Type) { res.status(400); throw new Error("모든 정보를 입력하세요."); } - const userExists = await User.findOne({ DoDID }); + const userExists = await User.findOne({ + DoDID + }); if (userExists) { res.status(400); throw new Error("이미 등록된 사용자입니다."); } - Invcode = Math.random().toString(36).substring(2,10); + Invcode = Math.random().toString(36).substring(2, 10); Unit = req.user.Unit; const user = await User.create({ @@ -90,14 +109,24 @@ const addUser = asyncHandler(async (req, res) => { //@route POST /api/user/register //@access Public const registerUser = asyncHandler(async (req, res) => { - const { Rank, Name, DoDID, email, password, pic, Invcode } = req.body; + const { + Rank, + Name, + DoDID, + email, + password, + pic, + Invcode + } = req.body; //049opo6a if (!Rank || !Name || !email || !password || !DoDID || !Invcode) { res.status(400); throw new Error("모든 정보를 입력하세요."); } - const userDb = await User.findOne({ DoDID }); + const userDb = await User.findOne({ + DoDID + }); if (!userDb) { res.status(400); @@ -115,14 +144,12 @@ const registerUser = asyncHandler(async (req, res) => { } const updatedUser = await User.findByIdAndUpdate( - userDb._id, - { + userDb._id, { email: email, password: await bcrypt.hash(password, await bcrypt.genSalt(10)), pic: pic, is_registered: true - }, - { + }, { new: true, } ) @@ -148,8 +175,13 @@ const registerUser = asyncHandler(async (req, res) => { //@route POST /api/users/login //@access public const authUser = asyncHandler(async (req, res) => { - const { DoDID, password } = req.body; - const user = await User.findOne({ DoDID }); + const { + DoDID, + password + } = req.body; + const user = await User.findOne({ + DoDID + }); if (user && !user.is_registered) { res.status(400); throw new Error("승인된 사용자이나 아직 등록되지 않았습니다. 계정 등록 후 이용해주세요."); @@ -176,7 +208,13 @@ const authUser = asyncHandler(async (req, res) => { //@route PUT /api/user //@access protect const updateUser = asyncHandler(async (req, res) => { - const { Rank, Name, email, milNumber, number } = req.body; + const { + Rank, + Name, + email, + milNumber, + number + } = req.body; if (!Rank && !Name && !email && !milNumber && !number) { res.status(400); @@ -184,7 +222,9 @@ const updateUser = asyncHandler(async (req, res) => { } const DoDID = req.user.DoDID; - const userDb = await User.findOne({ DoDID }); + const userDb = await User.findOne({ + DoDID + }); if (!userDb) { res.status(400); @@ -198,15 +238,13 @@ const updateUser = asyncHandler(async (req, res) => { const noData = ""; const updatedUser = await User.findByIdAndUpdate( - userDb._id, - { + userDb._id, { Rank: Rank != noData ? Rank : userDb.Rank, Name: Name != noData ? Name : userDb.Name, email: email != noData ? email : userDb.email, milNumber: milNumber != noData ? milNumber : userDb.milNumber, number: number != noData ? number : userDb.number - }, - { + }, { new: true, } ) @@ -233,7 +271,9 @@ const updateUser = asyncHandler(async (req, res) => { //@route PUT /api/user/pic //@access protect const updatePic = asyncHandler(async (req, res) => { - const { pic } = req.body; + const { + pic + } = req.body; if (!pic) { res.status(400); @@ -241,7 +281,9 @@ const updatePic = asyncHandler(async (req, res) => { } const DoDID = req.user.DoDID; - const userDb = await User.findOne({ DoDID }); + const userDb = await User.findOne({ + DoDID + }); if (!userDb) { res.status(400); @@ -254,11 +296,9 @@ const updatePic = asyncHandler(async (req, res) => { } const updatedUser = await User.findByIdAndUpdate( - userDb._id, - { + userDb._id, { pic: pic - }, - { + }, { new: true, } ) @@ -281,4 +321,11 @@ const updatePic = asyncHandler(async (req, res) => { } }); -module.exports = { allUsers, addUser, registerUser, authUser, updateUser, updatePic }; +module.exports = { + allUsers, + addUser, + registerUser, + authUser, + updateUser, + updatePic +}; diff --git a/back-end/middleware/authMiddleware.js b/back-end/middleware/authMiddleware.js index eb684ef7..b625fba9 100644 --- a/back-end/middleware/authMiddleware.js +++ b/back-end/middleware/authMiddleware.js @@ -61,4 +61,7 @@ const onlyAdmin = asyncHandler(async (req, res, next) => { // Todo: access handl } }); -module.exports = { protect, onlyAdmin }; +module.exports = { + protect, + onlyAdmin +}; diff --git a/back-end/middleware/errorMiddleware.js b/back-end/middleware/errorMiddleware.js index c0f1f28d..02929f92 100644 --- a/back-end/middleware/errorMiddleware.js +++ b/back-end/middleware/errorMiddleware.js @@ -13,4 +13,7 @@ const errorHandler = (err, req, res, next) => { }); }; -module.exports = { notFound, errorHandler }; +module.exports = { + notFound, + errorHandler +}; diff --git a/back-end/models/chatModel.js b/back-end/models/chatModel.js index 07f0d3d3..21c5890d 100644 --- a/back-end/models/chatModel.js +++ b/back-end/models/chatModel.js @@ -1,18 +1,29 @@ const mongoose = require("mongoose"); -const chatModel = mongoose.Schema( - { - chatName: { type: String, trim: true }, - isGroupChat: { type: Boolean, default: false }, - users: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], - latestMessage: { - type: mongoose.Schema.Types.ObjectId, - ref: "Message", - }, - groupAdmin: { type: mongoose.Schema.Types.ObjectId, ref: "User" }, +const chatModel = mongoose.Schema({ + chatName: { + type: String, + trim: true }, - { timestamps: true } -); + isGroupChat: { + type: Boolean, + default: false + }, + users: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "User" + }], + latestMessage: { + type: mongoose.Schema.Types.ObjectId, + ref: "Message", + }, + groupAdmin: { + type: mongoose.Schema.Types.ObjectId, + ref: "User" + }, +}, { + timestamps: true +}); const Chat = mongoose.model("Chat", chatModel); diff --git a/back-end/models/commentModel.js b/back-end/models/commentModel.js index 1d656d9d..d052532a 100644 --- a/back-end/models/commentModel.js +++ b/back-end/models/commentModel.js @@ -1,14 +1,24 @@ const mongoose = require("mongoose"); -const commentModel = mongoose.Schema( - { - user: { type: mongoose.Schema.Types.ObjectId, ref: "User" }, - report: { type: mongoose.Schema.Types.ObjectId, ref: "Report" }, - type: { type: String }, - content: {type: String, required: true } +const commentModel = mongoose.Schema({ + user: { + type: mongoose.Schema.Types.ObjectId, + ref: "User" }, - { timestamps: true } -); + report: { + type: mongoose.Schema.Types.ObjectId, + ref: "Report" + }, + type: { + type: String + }, + content: { + type: String, + required: true + } +}, { + timestamps: true +}); const Comment = mongoose.model("Comment", commentModel); diff --git a/back-end/models/messageModel.js b/back-end/models/messageModel.js index d0764f70..b5ea00cb 100644 --- a/back-end/models/messageModel.js +++ b/back-end/models/messageModel.js @@ -1,14 +1,25 @@ const mongoose = require("mongoose"); -const messageSchema = mongoose.Schema( - { - sender: { type: mongoose.Schema.Types.ObjectId, ref: "User" }, - content: { type: String, trim: true }, - chat: { type: mongoose.Schema.Types.ObjectId, ref: "Chat" }, - readBy: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], +const messageSchema = mongoose.Schema({ + sender: { + type: mongoose.Schema.Types.ObjectId, + ref: "User" }, - { timestamps: true } -); + content: { + type: String, + trim: true + }, + chat: { + type: mongoose.Schema.Types.ObjectId, + ref: "Chat" + }, + readBy: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "User" + }], +}, { + timestamps: true +}); const Message = mongoose.model("Message", messageSchema); module.exports = Message; diff --git a/back-end/models/reportModel.js b/back-end/models/reportModel.js index 67ae352a..24bd51ec 100644 --- a/back-end/models/reportModel.js +++ b/back-end/models/reportModel.js @@ -1,18 +1,38 @@ const mongoose = require("mongoose"); -const reportModel = mongoose.Schema( - { - User: { type: mongoose.Schema.Types.ObjectId, ref: "User" }, - Type: { type: String }, - Status: { type: String }, - Invited: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], - ReportingSystem: { type: String }, - ReportName: { type: String, required: true, trim: true }, - Content: { type: String }, - Comment: [{ type: mongoose.Schema.Types.ObjectId, ref: "Comment" }], +const reportModel = mongoose.Schema({ + User: { + type: mongoose.Schema.Types.ObjectId, + ref: "User" }, - { timestamps: true } -); + Type: { + type: String + }, + Status: { + type: String + }, + Invited: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "User" + }], + ReportingSystem: { + type: String + }, + ReportName: { + type: String, + required: true, + trim: true + }, + Content: { + type: String + }, + Comment: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "Comment" + }], +}, { + timestamps: true +}); const Report = mongoose.model("Report", reportModel); diff --git a/back-end/models/reportsysModel.js b/back-end/models/reportsysModel.js index 4f541065..c545eaaf 100644 --- a/back-end/models/reportsysModel.js +++ b/back-end/models/reportsysModel.js @@ -1,13 +1,20 @@ const mongoose = require("mongoose"); -const reportsysModel = mongoose.Schema( - { - Title: { type: String }, - List: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], - Unit: { type: mongoose.Schema.Types.ObjectId, ref: "Unit" } - }, - { timestamps: true } -); +const reportsysModel = mongoose.Schema({ + Title: { + type: String + }, + List: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "User" + }], + Unit: { + type: mongoose.Schema.Types.ObjectId, + ref: "Unit" + } +}, { + timestamps: true +}); const Reportsys = mongoose.model("Reportsys", reportsysModel); diff --git a/back-end/models/unitModel.js b/back-end/models/unitModel.js index 018299dd..bd073913 100644 --- a/back-end/models/unitModel.js +++ b/back-end/models/unitModel.js @@ -1,23 +1,41 @@ const mongoose = require("mongoose"); -const unitModel = mongoose.Schema( - { - Unitname: { type: String, trim: true }, - Unitslogan: { type: String, trim: true }, - Orgchartdata: { type: String,}, - Logo: { - type: "String", - required: false, - default: - "https://i.imgur.com/rnJLXCo.png", - }, - Members: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], - ReportCard: [{ type: mongoose.Schema.Types.ObjectId, ref: "Report" }], - unitAdmins: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }], - reportSys: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }] +const unitModel = mongoose.Schema({ + Unitname: { + type: String, + trim: true }, - { timestamps: true } -); + Unitslogan: { + type: String, + trim: true + }, + Orgchartdata: { + type: String, + }, + Logo: { + type: "String", + required: false, + default: "https://i.imgur.com/rnJLXCo.png", + }, + Members: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "User" + }], + ReportCard: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "Report" + }], + unitAdmins: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "User" + }], + reportSys: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "User" + }] +}, { + timestamps: true +}); const Unit = mongoose.model("Unit", unitModel); diff --git a/back-end/models/userModel.js b/back-end/models/userModel.js index d5b998b6..33cb2606 100644 --- a/back-end/models/userModel.js +++ b/back-end/models/userModel.js @@ -1,31 +1,68 @@ const mongoose = require("mongoose"); const bcrypt = require("bcryptjs"); - -const userSchema = mongoose.Schema( - { - Name: { type: String, required: true }, - DoDID: { type: String, unique: true, required: true }, - password: { type: String, required: false, default: " " }, - Rank: { type: String, required: true }, - Type: { type: String, required: true }, - Invcode: { type: String, required: true }, - is_activated: { type: Boolean }, - Position: { type: String, required: false }, - email: { type: String, required: false }, - milNumber: { type: String, required: false }, - number: { type: String , required: false }, - pic: { - type: String, - required: false, - default: - "https://cdn-icons-png.flaticon.com/512/6142/6142226.png" - }, - Unit: { type: mongoose.Schema.Types.ObjectId, ref: "Unit" }, - is_registered: {type : Boolean, default: false} - }, - { timestamps: true } -); +const userSchema = mongoose.Schema({ + Name: { + type: String, + required: true + }, + DoDID: { + type: String, + unique: true, + required: true + }, + password: { + type: String, + required: false, + default: " " + }, + Rank: { + type: String, + required: true + }, + Type: { + type: String, + required: true + }, + Invcode: { + type: String, + required: true + }, + is_activated: { + type: Boolean + }, + Position: { + type: String, + required: false + }, + email: { + type: String, + required: false + }, + milNumber: { + type: String, + required: false + }, + number: { + type: String, + required: false + }, + pic: { + type: String, + required: false, + default: "https://cdn-icons-png.flaticon.com/512/6142/6142226.png" + }, + Unit: { + type: mongoose.Schema.Types.ObjectId, + ref: "Unit" + }, + is_registered: { + type: Boolean, + default: false + } +}, { + timestamps: true +}); userSchema.methods.matchPassword = async function (enteredPassword) { return await bcrypt.compare(enteredPassword, this.password); diff --git a/back-end/routes/chatRoutes.js b/back-end/routes/chatRoutes.js index b7243815..059c3d03 100644 --- a/back-end/routes/chatRoutes.js +++ b/back-end/routes/chatRoutes.js @@ -7,7 +7,9 @@ const { addToGroup, renameGroup, } = require("../controllers/chatControllers"); -const { protect } = require("../middleware/authMiddleware"); +const { + protect +} = require("../middleware/authMiddleware"); const router = express.Router(); diff --git a/back-end/routes/commentRoutes.js b/back-end/routes/commentRoutes.js index b7243815..059c3d03 100644 --- a/back-end/routes/commentRoutes.js +++ b/back-end/routes/commentRoutes.js @@ -7,7 +7,9 @@ const { addToGroup, renameGroup, } = require("../controllers/chatControllers"); -const { protect } = require("../middleware/authMiddleware"); +const { + protect +} = require("../middleware/authMiddleware"); const router = express.Router(); diff --git a/back-end/routes/messageRoutes.js b/back-end/routes/messageRoutes.js index 70dafad5..3acd2a6c 100644 --- a/back-end/routes/messageRoutes.js +++ b/back-end/routes/messageRoutes.js @@ -3,7 +3,9 @@ const { allMessages, sendMessage, } = require("../controllers/messageControllers"); -const { protect } = require("../middleware/authMiddleware"); +const { + protect +} = require("../middleware/authMiddleware"); const router = express.Router(); diff --git a/back-end/routes/reportRoutes.js b/back-end/routes/reportRoutes.js index b7243815..059c3d03 100644 --- a/back-end/routes/reportRoutes.js +++ b/back-end/routes/reportRoutes.js @@ -7,7 +7,9 @@ const { addToGroup, renameGroup, } = require("../controllers/chatControllers"); -const { protect } = require("../middleware/authMiddleware"); +const { + protect +} = require("../middleware/authMiddleware"); const router = express.Router(); diff --git a/back-end/routes/reportsysRoutes.js b/back-end/routes/reportsysRoutes.js index 342c35bb..a44521b1 100644 --- a/back-end/routes/reportsysRoutes.js +++ b/back-end/routes/reportsysRoutes.js @@ -2,7 +2,10 @@ const express = require("express"); const { addReportsys } = require("../controllers/reportsysControllers"); -const { protect, onlyAdmin } = require("../middleware/authMiddleware"); +const { + protect, + onlyAdmin +} = require("../middleware/authMiddleware"); const router = express.Router(); diff --git a/back-end/routes/unitRoutes.js b/back-end/routes/unitRoutes.js index 83b2e814..605027a9 100644 --- a/back-end/routes/unitRoutes.js +++ b/back-end/routes/unitRoutes.js @@ -4,7 +4,10 @@ const { updateLogo, addUnit } = require("../controllers/unitControllers"); -const { protect, onlyAdmin } = require("../middleware/authMiddleware"); +const { + protect, + onlyAdmin +} = require("../middleware/authMiddleware"); const router = express.Router(); diff --git a/back-end/routes/userRoutes.js b/back-end/routes/userRoutes.js index 6632cd68..fc49d5f9 100644 --- a/back-end/routes/userRoutes.js +++ b/back-end/routes/userRoutes.js @@ -7,13 +7,16 @@ const { updateUser, updatePic } = require("../controllers/userControllers"); -const { protect, onlyAdmin } = require("../middleware/authMiddleware"); +const { + protect, + onlyAdmin +} = require("../middleware/authMiddleware"); const router = express.Router(); -router.route("/").get(protect, allUsers);//protect, +router.route("/").get(protect, allUsers); //protect, router.route("/").put(protect, updateUser); -router.route("/pic").put(protect, updatePic);//protect, +router.route("/pic").put(protect, updatePic); //protect, router.route("/add").post(onlyAdmin, addUser); router.route("/register").post(registerUser); router.post("/login", authUser); diff --git a/back-end/server.js b/back-end/server.js index 2370dbc4..4629c026 100644 --- a/back-end/server.js +++ b/back-end/server.js @@ -9,7 +9,10 @@ const unitRoutes = require("./routes/unitRoutes"); const reportRoutes = require("./routes/reportRoutes"); const commentRoutes = require("./routes/commentRoutes"); const reportsysRoutes = require("./routes/reportsysRoutes"); -const { notFound, errorHandler } = require("./middleware/errorMiddleware"); +const { + notFound, + errorHandler +} = require("./middleware/errorMiddleware"); const path = require("path"); dotenv.config(); @@ -99,4 +102,3 @@ io.on("connection", (socket) => { socket.leave(userData._id); }); }); - From d65b9b47d86792f7562ce8468318d095128684fa Mon Sep 17 00:00:00 2001 From: yhcho0405 Date: Mon, 17 Oct 2022 19:07:21 +0900 Subject: [PATCH 09/11] Fix: append user to unit members when user add --- back-end/controllers/reportsysControllers.js | 38 ++++++++++++++++++-- back-end/controllers/userControllers.js | 14 ++++++-- back-end/models/reportsysModel.js | 24 ++++++------- back-end/models/unitModel.js | 2 +- back-end/routes/reportsysRoutes.js | 8 +++-- 5 files changed, 65 insertions(+), 21 deletions(-) diff --git a/back-end/controllers/reportsysControllers.js b/back-end/controllers/reportsysControllers.js index c01b3f4c..4dcb6db3 100644 --- a/back-end/controllers/reportsysControllers.js +++ b/back-end/controllers/reportsysControllers.js @@ -1,6 +1,5 @@ const asyncHandler = require("express-async-handler"); const Reportsys = require("../models/reportsysModel"); -const Unit = require("../models/unitModel"); //@description Create new reportsys //@route POST /api/reportsys/ @@ -33,10 +32,43 @@ const addReportsys = asyncHandler(async (req, res) => { }); } else { res.status(400); - throw new Error("사용자를 찾을 수 없습니다."); + throw new Error("보고체계를 찾을 수 없습니다."); } }); +//@description Delete reportsys +//@route DELETE /api/reportsys/ +//@access Protected(onlyadmin) +const removeReportsys = asyncHandler(async (req, res) => { + const { + _id + } = req.body; + + if (!_id) { + res.status(400); + throw new Error("정보를 입력하세요."); + } + + Unit = req.user.Unit; + + try { + await Reportsys.findByIdAndRemove(_id).exec(); + } catch (e) { + res.status(400); + throw new Error("해당 보고체계가 없습니다."); + } + Unit.reportSys.findByIdAndRemove(_id); + + console.log(Unit.reportSys); + + res.status(201).json({ + message: "remove success", + _id: reportsys._id, + Title: reportsys.Title + }); +}); + module.exports = { - addReportsys + addReportsys, + removeReportsys }; diff --git a/back-end/controllers/userControllers.js b/back-end/controllers/userControllers.js index e22395f8..29a4e991 100644 --- a/back-end/controllers/userControllers.js +++ b/back-end/controllers/userControllers.js @@ -2,6 +2,7 @@ const asyncHandler = require("express-async-handler"); const User = require("../models/userModel"); const generateToken = require("../config/generateToken"); const bcrypt = require("bcryptjs"); +const UnitM = require("../models/unitModel"); //@description Get or Search all users //@route GET /api/user?search=?index= @@ -39,7 +40,6 @@ const allUsers = asyncHandler(async (req, res) => { users.sort(function (a, b) { return (ranks.indexOf(b.Rank) + (b.is_registered ? 0 : 100)) - (ranks.indexOf(a.Rank) + (a.is_registered ? 0 : 100)); }); - console.log(users) const index = req.query.index; if (index) { res.send(users.slice(parseInt(index) * 4, parseInt(index) * 4 + 4)); @@ -63,6 +63,7 @@ const addUser = asyncHandler(async (req, res) => { Type } = req.body; + if (!Rank || !Name || !DoDID || !Type) { res.status(400); throw new Error("모든 정보를 입력하세요."); @@ -79,7 +80,6 @@ const addUser = asyncHandler(async (req, res) => { Invcode = Math.random().toString(36).substring(2, 10); Unit = req.user.Unit; - const user = await User.create({ Name, DoDID, @@ -89,6 +89,16 @@ const addUser = asyncHandler(async (req, res) => { Unit }); + const added = await UnitM.findByIdAndUpdate( + Unit._id, { + $push: { + Members: user._id + }, + }, { + new: true, + } + ) + if (user) { res.status(201).json({ _id: user._id, diff --git a/back-end/models/reportsysModel.js b/back-end/models/reportsysModel.js index c545eaaf..b03a75ea 100644 --- a/back-end/models/reportsysModel.js +++ b/back-end/models/reportsysModel.js @@ -1,19 +1,19 @@ const mongoose = require("mongoose"); const reportsysModel = mongoose.Schema({ - Title: { - type: String - }, - List: [{ - type: mongoose.Schema.Types.ObjectId, - ref: "User" - }], - Unit: { - type: mongoose.Schema.Types.ObjectId, - ref: "Unit" - } + Title: { + type: String + }, + List: [{ + type: mongoose.Schema.Types.ObjectId, + ref: "User" + }], + Unit: { + type: mongoose.Schema.Types.ObjectId, + ref: "Unit" + } }, { - timestamps: true + timestamps: true }); const Reportsys = mongoose.model("Reportsys", reportsysModel); diff --git a/back-end/models/unitModel.js b/back-end/models/unitModel.js index bd073913..63a0986e 100644 --- a/back-end/models/unitModel.js +++ b/back-end/models/unitModel.js @@ -31,7 +31,7 @@ const unitModel = mongoose.Schema({ }], reportSys: [{ type: mongoose.Schema.Types.ObjectId, - ref: "User" + ref: "Reportsys" }] }, { timestamps: true diff --git a/back-end/routes/reportsysRoutes.js b/back-end/routes/reportsysRoutes.js index a44521b1..68070940 100644 --- a/back-end/routes/reportsysRoutes.js +++ b/back-end/routes/reportsysRoutes.js @@ -1,14 +1,16 @@ const express = require("express"); const { - addReportsys + addReportsys, + removeReportsys } = require("../controllers/reportsysControllers"); const { - protect, - onlyAdmin + protect, + onlyAdmin } = require("../middleware/authMiddleware"); const router = express.Router(); router.route("/").post(onlyAdmin, addReportsys); +router.route("/").delete(onlyAdmin, addReportsys); module.exports = router; From 792eafd9a077839c731c38af071c370210b81133 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Mon, 17 Oct 2022 10:13:28 +0000 Subject: [PATCH 10/11] [Feat]: #99 Added Page Headers for Home and Settings --- front-end/web-next/pages/settings.js | 19 ++++++++++++++--- .../web-next/pages/settings/reportsystem.js | 18 +++++++++++++--- front-end/web-next/pages/settings/unit.js | 21 +++++++++++++------ .../styles/settingsmenubar.module.css | 3 +++ 4 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 front-end/web-next/styles/settingsmenubar.module.css diff --git a/front-end/web-next/pages/settings.js b/front-end/web-next/pages/settings.js index 0b9e58f2..70a798ad 100644 --- a/front-end/web-next/pages/settings.js +++ b/front-end/web-next/pages/settings.js @@ -2,18 +2,31 @@ import Head from 'next/head' import Link from "next/link" import MenuBar from '../componenets/menubar' import RegisterHeader from '../componenets/registerheader'; -import { Dropdown, Menu, Space } from 'antd'; +import { Dropdown, Menu, Space, PageHeader, Breadcrumb } from 'antd'; +import styles from '../styles/settingsmenubar.module.css' import { DownOutlined } from '@ant-design/icons'; import { useRouter } from "next/router" - const Settings = () => { return <> - + + 계정설정 + + 부대설정 + + + 보고체계 설정 + + + hi + + } style={{backgroundColor: "white", boxShadow: 'inset 0 -3em 3em rgba(0, 0, 0, 0.1), 0 0 0 2px rgb(255, 255, 255), 0.3em 0.3em 1em rgba(0, 0, 0, 0.3)'}}/> diff --git a/front-end/web-next/pages/settings/reportsystem.js b/front-end/web-next/pages/settings/reportsystem.js index a4bf035b..84c61b84 100644 --- a/front-end/web-next/pages/settings/reportsystem.js +++ b/front-end/web-next/pages/settings/reportsystem.js @@ -1,13 +1,25 @@ import Head from 'next/head' import Link from "next/link" import RegisterHeader from '../../componenets/registerheader' +import {PageHeader, Breadcrumb } from 'antd'; const ReportSystem = () => { return <> - - 보고체계 재작, 수정, 삭제 - + + + 계정설정 + + + 부대설정 + + 보고체계 설정 + + Null + + } style={{backgroundColor: "white", boxShadow: 'inset 0 -3em 3em rgba(0, 0, 0, 0.1), 0 0 0 2px rgb(255, 255, 255), 0.3em 0.3em 1em rgba(0, 0, 0, 0.3)'}}/> } diff --git a/front-end/web-next/pages/settings/unit.js b/front-end/web-next/pages/settings/unit.js index 16af92be..0b40cc55 100644 --- a/front-end/web-next/pages/settings/unit.js +++ b/front-end/web-next/pages/settings/unit.js @@ -1,9 +1,6 @@ import Head from 'next/head' import Link from "next/link" -import { InfoCircleOutlined } from '@ant-design/icons'; -import MenuBar from '../../componenets/menubar' -import RegisterHeader from '../../componenets/registerheader'; -import { Avatar, Divider, List, Skeleton, Button, Input, Radio, message, Upload, Image, TreeSelect, Form } from 'antd'; +import { Avatar, Divider, List, Skeleton, Button, Input, Radio, message, Upload, Image, TreeSelect, Form, PageHeader, Breadcrumb } from 'antd'; import styles from '../../styles/unitsettings.module.css' import unitlogo from '../../img/unitlogo.png' import React, { useEffect, useState } from 'react'; @@ -197,8 +194,20 @@ const UnitSettings = () => { return <>
- -
+ + + 계정설정 + + 부대설정 + + 보고체계 설정 + + + hi + + } style={{backgroundColor: "white", boxShadow: 'inset 0 -3em 3em rgba(0, 0, 0, 0.1), 0 0 0 2px rgb(255, 255, 255), 0.3em 0.3em 1em rgba(0, 0, 0, 0.3)'}}/>

부대정보 번경

diff --git a/front-end/web-next/styles/settingsmenubar.module.css b/front-end/web-next/styles/settingsmenubar.module.css new file mode 100644 index 00000000..9327b99b --- /dev/null +++ b/front-end/web-next/styles/settingsmenubar.module.css @@ -0,0 +1,3 @@ +.lastitem { + color: grey; +} \ No newline at end of file From 79e898cc9012ebc6b7df2ef1935879e240d1f26f Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Mon, 17 Oct 2022 11:52:54 +0000 Subject: [PATCH 11/11] [Feat]: #100 built userinfo update form --- front-end/web-next/pages/settings.js | 138 +++++++++++++++--- .../styles/settingsmenubar.module.css | 3 - .../web-next/styles/usersettings.module.css | 61 ++++++++ 3 files changed, 180 insertions(+), 22 deletions(-) delete mode 100644 front-end/web-next/styles/settingsmenubar.module.css create mode 100644 front-end/web-next/styles/usersettings.module.css diff --git a/front-end/web-next/pages/settings.js b/front-end/web-next/pages/settings.js index 70a798ad..af1578e4 100644 --- a/front-end/web-next/pages/settings.js +++ b/front-end/web-next/pages/settings.js @@ -2,31 +2,131 @@ import Head from 'next/head' import Link from "next/link" import MenuBar from '../componenets/menubar' import RegisterHeader from '../componenets/registerheader'; -import { Dropdown, Menu, Space, PageHeader, Breadcrumb } from 'antd'; -import styles from '../styles/settingsmenubar.module.css' +import { Avatar, Divider, List, Skeleton, Button, Input, Radio, message, Upload, Image, TreeSelect, Form, PageHeader, Breadcrumb } from 'antd'; +import styles from '../styles/usersettings.module.css' +import React, { useEffect, useState } from 'react'; import { DownOutlined } from '@ant-design/icons'; import { useRouter } from "next/router" - - +const RankData = [ + { + title: '병사', + value: 'title1', + children: [{ title: '이병', value: 'PVT', }, { title: '일병', value: 'PFC', }, { title: '상병', value: 'CPL', }, { title: '병장', value: 'SGT', }] + }, + { + title: '부사관', + value: 'title2', + children: [{ title: '하사', value: 'SST', }, { title: '중사', value: 'SFC', }, { title: '상사', value: 'MST', }, { title: '원사', value: 'SGM', }] + }, + { + title: '장교', + value: 'title3', + children: [{ title: '소위', value: 'SECLIU', }, { title: '중위', value: 'LIU', }, { title: '대위', value: 'CPT', }, { title: '소령', value: 'MAJ', }, { title: '중령', value: 'LTC', }, { title: '대령', value: 'COL', }] + }, + { + title: '장군', + value: 'title4', + children: [{ title: '준장', value: 'BG', }, { title: '소장', value: 'MG', }, { title: '중장', value: 'LG', }, { title: '대장', value: 'GEN', }] + } +]; +let submitnewuser = async (event) => { + console.log('hi') +} const Settings = () => { - + //TreeData1 + const [DoDID, setDoDID] = useState(); + const [Rank, setRank] = useState(); + const [Position, setPosition] = useState(); + const [Armymail, setArmymail] = useState(); + const [Armyphone, setArmyphone] = useState(); + const [Phone, setPhone] = useState(); + const [error1, seterror1] = useState(); + const [success1, setsuccess1] = useState(); + + const onChange1 = (newValue) => { + if (newValue == 'title1' || newValue == 'title2' || newValue == 'title3' || newValue == 'title4') { + setRank(); + return + } else { + setRank(newValue); + } + }; return <> - - 계정설정 - - 부대설정 - - - 보고체계 설정 - - - hi - - } style={{backgroundColor: "white", boxShadow: 'inset 0 -3em 3em rgba(0, 0, 0, 0.1), 0 0 0 2px rgb(255, 255, 255), 0.3em 0.3em 1em rgba(0, 0, 0, 0.3)'}}/> + + 유저 설정 + + + 계정설정 + + 부대설정 + + + 보고체계 설정 + + + hi + + } style={{backgroundColor: "white", boxShadow: 'inset 0 -3em 3em rgba(0, 0, 0, 0.1), 0 0 0 2px rgb(255, 255, 255), 0.3em 0.3em 1em rgba(0, 0, 0, 0.3)'}}/> + +
+
+ +

군인정보 수정

+

군번

+ + { setDoDID(event.target.value) }} /> + +

계급

+ ({ + validator(_, value) { + if (value == 'title1' || value == 'title2' || value == 'title3' || value == 'title4') { + return Promise.reject('계급을 선택해 주세요') + } else { + return Promise.resolve() + } + } + })]}> + + +

직책

+ + { setPosition(event.target.value) }} /> + +

군메일

+ + { setArmymail(event.target.value) }} /> + +

(군)전화번호

+ + { setArmyphone(event.target.value) }} /> + +

휴대폰번호

+ + { setPhone(event.target.value) }} /> + + +
+ +

{error1}fds

+

{success1}

+ +
+
+ +
+ +
+ + +
+ + +
+ diff --git a/front-end/web-next/styles/settingsmenubar.module.css b/front-end/web-next/styles/settingsmenubar.module.css deleted file mode 100644 index 9327b99b..00000000 --- a/front-end/web-next/styles/settingsmenubar.module.css +++ /dev/null @@ -1,3 +0,0 @@ -.lastitem { - color: grey; -} \ No newline at end of file diff --git a/front-end/web-next/styles/usersettings.module.css b/front-end/web-next/styles/usersettings.module.css new file mode 100644 index 00000000..0bb016e0 --- /dev/null +++ b/front-end/web-next/styles/usersettings.module.css @@ -0,0 +1,61 @@ +.lastitem { + color: grey; +} + +.userdatachange { + width: 700px; + min-width: 650px; + height: 570px; + background-color: white; + border-radius: 10px; + margin-left: 30px; + margin-top: 40px; + display: flex; + justify-content: center; +} +.userimagechange { + + width: 300px; + height: 300px; + background-color: white; + border-radius: 10px; + margin-top: 40px; + margin-left: 20px; + display: flex; + justify-content: center; +} + +.userheader { + margin-bottom: 0px; +} + +.input { + margin-bottom: 10px; +} + + + +#error1 { + color: red; + font-size: 14px; + line-height: 30px; + margin-left: 15px; + margin-top: 3px; +} +#success1 { + color: green; + font-size: 14px; + line-height: 30px; + margin-left: 15px; + margin-top: 3px; +} +.submitbutton { + background-color: #008272; + border-radius: 20px; + width: 120px; + border: none; + display: block; + color: white; + height: 30px; + margin-top: 3px; +} \ No newline at end of file