Changeset 55ed171
- Timestamp:
- 10/15/22 15:28:57 (2 years ago)
- Branches:
- master
- Children:
- 113029b
- Parents:
- ee05663
- Files:
-
- 39 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
backend/models/orderModel.js
ree05663 r55ed171 35 35 totalPrice: { type: Number, required: true }, 36 36 user: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: true }, 37 isConfirmed: { type: Boolean, default: false }, 37 38 isPaid: { type: Boolean, default: false }, 39 contactNumber: { type: String }, 38 40 paidAt: { type: Date }, 39 41 paidAtFormat: { type: String }, 42 shippedAt: { type: Date }, 43 isShipped: { type: Boolean, default: false }, 40 44 isDelivered: { type: Boolean, default: false }, 41 45 deliveredAt: { type: Date }, -
backend/models/productModel.js
ree05663 r55ed171 7 7 image: { type: String, required: true }, 8 8 sideImage: { type: String, required: true }, 9 sideImage2: { type: String, required: true }, 9 10 dimension: { type: String, required: true }, 10 11 scheme: { type: String, required: true }, -
backend/package-lock.json
ree05663 r55ed171 15 15 "express-async-handler": "^1.2.0", 16 16 "jsonwebtoken": "^8.5.1", 17 "mongoose": "^6.5.3" 17 "mongoose": "^6.5.3", 18 "multer": "^1.4.5-lts.1" 18 19 }, 19 20 "devDependencies": { … … 70 71 "node": ">= 8" 71 72 } 73 }, 74 "node_modules/append-field": { 75 "version": "1.0.0", 76 "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", 77 "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==" 72 78 }, 73 79 "node_modules/array-flatten": { … … 199 205 "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" 200 206 }, 207 "node_modules/buffer-from": { 208 "version": "1.1.2", 209 "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", 210 "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" 211 }, 212 "node_modules/busboy": { 213 "version": "1.6.0", 214 "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", 215 "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", 216 "dependencies": { 217 "streamsearch": "^1.1.0" 218 }, 219 "engines": { 220 "node": ">=10.16.0" 221 } 222 }, 201 223 "node_modules/bytes": { 202 224 "version": "3.1.2", … … 252 274 "dev": true 253 275 }, 276 "node_modules/concat-stream": { 277 "version": "1.6.2", 278 "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", 279 "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", 280 "engines": [ 281 "node >= 0.8" 282 ], 283 "dependencies": { 284 "buffer-from": "^1.0.0", 285 "inherits": "^2.0.3", 286 "readable-stream": "^2.2.2", 287 "typedarray": "^0.0.6" 288 } 289 }, 254 290 "node_modules/content-disposition": { 255 291 "version": "0.5.4", … … 283 319 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 284 320 "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" 321 }, 322 "node_modules/core-util-is": { 323 "version": "1.0.3", 324 "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", 325 "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" 285 326 }, 286 327 "node_modules/debug": { … … 636 677 } 637 678 }, 679 "node_modules/isarray": { 680 "version": "1.0.0", 681 "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 682 "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" 683 }, 638 684 "node_modules/jsonwebtoken": { 639 685 "version": "8.5.1", … … 790 836 } 791 837 }, 838 "node_modules/minimist": { 839 "version": "1.2.6", 840 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", 841 "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" 842 }, 843 "node_modules/mkdirp": { 844 "version": "0.5.6", 845 "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", 846 "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", 847 "dependencies": { 848 "minimist": "^1.2.6" 849 }, 850 "bin": { 851 "mkdirp": "bin/cmd.js" 852 } 853 }, 792 854 "node_modules/mongodb": { 793 855 "version": "4.8.1", … … 886 948 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 887 949 "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" 950 }, 951 "node_modules/multer": { 952 "version": "1.4.5-lts.1", 953 "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.1.tgz", 954 "integrity": "sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ==", 955 "dependencies": { 956 "append-field": "^1.0.0", 957 "busboy": "^1.0.0", 958 "concat-stream": "^1.5.2", 959 "mkdirp": "^0.5.4", 960 "object-assign": "^4.1.1", 961 "type-is": "^1.6.4", 962 "xtend": "^4.0.0" 963 }, 964 "engines": { 965 "node": ">= 6.0.0" 966 } 888 967 }, 889 968 "node_modules/negotiator": { … … 963 1042 } 964 1043 }, 1044 "node_modules/object-assign": { 1045 "version": "4.1.1", 1046 "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 1047 "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", 1048 "engines": { 1049 "node": ">=0.10.0" 1050 } 1051 }, 965 1052 "node_modules/object-inspect": { 966 1053 "version": "1.12.2", … … 1007 1094 } 1008 1095 }, 1096 "node_modules/process-nextick-args": { 1097 "version": "2.0.1", 1098 "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 1099 "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 1100 }, 1009 1101 "node_modules/proxy-addr": { 1010 1102 "version": "2.0.7", … … 1068 1160 "node": ">= 0.8" 1069 1161 } 1162 }, 1163 "node_modules/readable-stream": { 1164 "version": "2.3.7", 1165 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 1166 "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 1167 "dependencies": { 1168 "core-util-is": "~1.0.0", 1169 "inherits": "~2.0.3", 1170 "isarray": "~1.0.0", 1171 "process-nextick-args": "~2.0.0", 1172 "safe-buffer": "~5.1.1", 1173 "string_decoder": "~1.1.1", 1174 "util-deprecate": "~1.0.1" 1175 } 1176 }, 1177 "node_modules/readable-stream/node_modules/safe-buffer": { 1178 "version": "5.1.2", 1179 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 1180 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 1070 1181 }, 1071 1182 "node_modules/readdirp": { … … 1250 1361 } 1251 1362 }, 1363 "node_modules/streamsearch": { 1364 "version": "1.1.0", 1365 "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", 1366 "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", 1367 "engines": { 1368 "node": ">=10.0.0" 1369 } 1370 }, 1371 "node_modules/string_decoder": { 1372 "version": "1.1.1", 1373 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 1374 "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 1375 "dependencies": { 1376 "safe-buffer": "~5.1.0" 1377 } 1378 }, 1379 "node_modules/string_decoder/node_modules/safe-buffer": { 1380 "version": "5.1.2", 1381 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 1382 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 1383 }, 1252 1384 "node_modules/supports-color": { 1253 1385 "version": "5.5.0", … … 1316 1448 "node": ">= 0.6" 1317 1449 } 1450 }, 1451 "node_modules/typedarray": { 1452 "version": "0.0.6", 1453 "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", 1454 "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" 1318 1455 }, 1319 1456 "node_modules/undefsafe": { … … 1331 1468 } 1332 1469 }, 1470 "node_modules/util-deprecate": { 1471 "version": "1.0.2", 1472 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 1473 "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" 1474 }, 1333 1475 "node_modules/utils-merge": { 1334 1476 "version": "1.0.1", … … 1365 1507 "engines": { 1366 1508 "node": ">=12" 1509 } 1510 }, 1511 "node_modules/xtend": { 1512 "version": "4.0.2", 1513 "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", 1514 "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", 1515 "engines": { 1516 "node": ">=0.4" 1367 1517 } 1368 1518 } … … 1412 1562 "picomatch": "^2.0.4" 1413 1563 } 1564 }, 1565 "append-field": { 1566 "version": "1.0.0", 1567 "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", 1568 "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==" 1414 1569 }, 1415 1570 "array-flatten": { … … 1500 1655 "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" 1501 1656 }, 1657 "buffer-from": { 1658 "version": "1.1.2", 1659 "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", 1660 "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" 1661 }, 1662 "busboy": { 1663 "version": "1.6.0", 1664 "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", 1665 "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", 1666 "requires": { 1667 "streamsearch": "^1.1.0" 1668 } 1669 }, 1502 1670 "bytes": { 1503 1671 "version": "3.1.2", … … 1536 1704 "dev": true 1537 1705 }, 1706 "concat-stream": { 1707 "version": "1.6.2", 1708 "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", 1709 "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", 1710 "requires": { 1711 "buffer-from": "^1.0.0", 1712 "inherits": "^2.0.3", 1713 "readable-stream": "^2.2.2", 1714 "typedarray": "^0.0.6" 1715 } 1716 }, 1538 1717 "content-disposition": { 1539 1718 "version": "0.5.4", … … 1558 1737 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 1559 1738 "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" 1739 }, 1740 "core-util-is": { 1741 "version": "1.0.3", 1742 "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", 1743 "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" 1560 1744 }, 1561 1745 "debug": { … … 1817 2001 "dev": true 1818 2002 }, 2003 "isarray": { 2004 "version": "1.0.0", 2005 "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 2006 "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" 2007 }, 1819 2008 "jsonwebtoken": { 1820 2009 "version": "8.5.1", … … 1946 2135 "requires": { 1947 2136 "brace-expansion": "^1.1.7" 2137 } 2138 }, 2139 "minimist": { 2140 "version": "1.2.6", 2141 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", 2142 "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" 2143 }, 2144 "mkdirp": { 2145 "version": "0.5.6", 2146 "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", 2147 "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", 2148 "requires": { 2149 "minimist": "^1.2.6" 1948 2150 } 1949 2151 }, … … 2022 2224 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 2023 2225 "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" 2226 }, 2227 "multer": { 2228 "version": "1.4.5-lts.1", 2229 "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.1.tgz", 2230 "integrity": "sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ==", 2231 "requires": { 2232 "append-field": "^1.0.0", 2233 "busboy": "^1.0.0", 2234 "concat-stream": "^1.5.2", 2235 "mkdirp": "^0.5.4", 2236 "object-assign": "^4.1.1", 2237 "type-is": "^1.6.4", 2238 "xtend": "^4.0.0" 2239 } 2024 2240 }, 2025 2241 "negotiator": { … … 2078 2294 "dev": true 2079 2295 }, 2296 "object-assign": { 2297 "version": "4.1.1", 2298 "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 2299 "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" 2300 }, 2080 2301 "object-inspect": { 2081 2302 "version": "1.12.2", … … 2107 2328 "dev": true 2108 2329 }, 2330 "process-nextick-args": { 2331 "version": "2.0.1", 2332 "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 2333 "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 2334 }, 2109 2335 "proxy-addr": { 2110 2336 "version": "2.0.7", … … 2149 2375 "iconv-lite": "0.4.24", 2150 2376 "unpipe": "1.0.0" 2377 } 2378 }, 2379 "readable-stream": { 2380 "version": "2.3.7", 2381 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 2382 "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 2383 "requires": { 2384 "core-util-is": "~1.0.0", 2385 "inherits": "~2.0.3", 2386 "isarray": "~1.0.0", 2387 "process-nextick-args": "~2.0.0", 2388 "safe-buffer": "~5.1.1", 2389 "string_decoder": "~1.1.1", 2390 "util-deprecate": "~1.0.1" 2391 }, 2392 "dependencies": { 2393 "safe-buffer": { 2394 "version": "5.1.2", 2395 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 2396 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 2397 } 2151 2398 } 2152 2399 }, … … 2287 2534 "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" 2288 2535 }, 2536 "streamsearch": { 2537 "version": "1.1.0", 2538 "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", 2539 "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" 2540 }, 2541 "string_decoder": { 2542 "version": "1.1.1", 2543 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 2544 "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 2545 "requires": { 2546 "safe-buffer": "~5.1.0" 2547 }, 2548 "dependencies": { 2549 "safe-buffer": { 2550 "version": "5.1.2", 2551 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 2552 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 2553 } 2554 } 2555 }, 2289 2556 "supports-color": { 2290 2557 "version": "5.5.0", … … 2335 2602 "mime-types": "~2.1.24" 2336 2603 } 2604 }, 2605 "typedarray": { 2606 "version": "0.0.6", 2607 "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", 2608 "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" 2337 2609 }, 2338 2610 "undefsafe": { … … 2347 2619 "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" 2348 2620 }, 2621 "util-deprecate": { 2622 "version": "1.0.2", 2623 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 2624 "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" 2625 }, 2349 2626 "utils-merge": { 2350 2627 "version": "1.0.1", … … 2370 2647 "webidl-conversions": "^7.0.0" 2371 2648 } 2649 }, 2650 "xtend": { 2651 "version": "4.0.2", 2652 "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", 2653 "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" 2372 2654 } 2373 2655 } -
backend/package.json
ree05663 r55ed171 17 17 "express-async-handler": "^1.2.0", 18 18 "jsonwebtoken": "^8.5.1", 19 "mongoose": "^6.5.3" 19 "mongoose": "^6.5.3", 20 "multer": "^1.4.5-lts.1" 20 21 }, 21 22 "devDependencies": { -
backend/routes/orderRoutes.js
ree05663 r55ed171 21 21 isPaid: req.body.isPaid, 22 22 paidAt: req.body.paidAt, 23 isConfirmed: req.body.isConfirmed, 24 contactNumber: req.body.contactNumber, 23 25 }); 24 26 const order = await newOrder.save(); … … 33 35 const orders = await Order.find({ user: req.user._id }); 34 36 res.send(orders); 37 }) 38 ); 39 const PAGE_SIZE = 10; 40 orderRouter.get( 41 "/", 42 expressAsyncHandler(async (req, res) => { 43 const { query } = req; 44 const pageSize = query.pageSize || PAGE_SIZE; 45 const page = query.page || 1; 46 const isConfirmed = query.isConfirmed || ""; 47 const isShipped = query.isShipped || ""; 48 const searchQuery = query.query || ""; 49 const isDelivered = false; 50 const queryFilter = 51 searchQuery && searchQuery !== "all" 52 ? { _: { $regex: searchQuery, $options: "i" } } 53 : {}; 54 const isConfirmedFilter = 55 isConfirmed && isConfirmed !== "all" ? { isConfirmed } : {}; 56 const isShippedFilter = 57 isShipped && isShipped !== "all" ? { isShipped } : {}; 58 59 const orders = await Order.find({ 60 ...queryFilter, 61 ...isConfirmedFilter, 62 ...isShippedFilter, 63 ...isDelivered, 64 }) 65 .skip(pageSize * (page - 1)) 66 .limit(pageSize); 67 const countOrders = await Order.countDocuments({ 68 ...isConfirmedFilter, 69 ...isShippedFilter, 70 }); 71 res.send({ 72 orders, 73 countOrders, 74 page, 75 pages: Math.ceil(countOrders / pageSize), 76 }); 77 //const orders = await Order.find(); 78 //res.send(orders); 35 79 }) 36 80 ); … … 49 93 ); 50 94 95 orderRouter.put( 96 "/action", 97 expressAsyncHandler(async (req, res) => { 98 if (req.body.isConfirmed) { 99 const order = await Order.updateOne( 100 { _id: req.body._id }, 101 { 102 $set: { 103 isConfirmed: req.body.isConfirmed, 104 }, 105 } 106 ); 107 } else if (req.body.isShipped) { 108 const order = await Order.updateOne( 109 { _id: req.body._id }, 110 { 111 $set: { 112 isShipped: req.body.isShipped, 113 shippedAt: req.body.shippedAt, 114 }, 115 } 116 ); 117 } else if (req.body.isDelivered && req.body.isPaid) { 118 const order = await Order.updateOne( 119 { _id: req.body._id }, 120 { 121 $set: { 122 isDelivered: req.body.isDelivered, 123 deliveredAt: req.body.deliveredAt, 124 isPaid: req.body.isPaid, 125 paidAt: req.body.paidAt, 126 }, 127 } 128 ); 129 } else { 130 const order = await Order.updateOne( 131 { _id: req.body._id }, 132 { 133 $set: { 134 isDelivered: req.body.isDelivered, 135 deliveredAt: req.body.deliveredAt, 136 }, 137 } 138 ); 139 } 140 141 res.status(200).send({ message: "Succesful" }); 142 }) 143 ); 144 51 145 export default orderRouter; -
backend/routes/productRoutes.js
ree05663 r55ed171 1 import express from "express";1 import express, { query } from "express"; 2 2 import Product from "../models/productModel.js"; 3 import multer from "multer"; 4 import expressAsyncHandler from "express-async-handler"; 5 import userRouter from "./userRoutes.js"; 3 6 4 7 const productRouter = express.Router(); 5 8 9 const storage = multer.diskStorage({ 10 destination: (req, file, callback) => { 11 callback(null, "../frontend/public/uploads/"); 12 }, 13 filename: (req, file, callback) => { 14 callback(null, file.originalname); 15 }, 16 }); 17 18 const upload = multer({ storage: storage }); 19 const multipleUpload = upload.fields([ 20 { name: "image", maxCount: 1 }, 21 { name: "sideImage", maxCount: 1 }, 22 { name: "sideImage2", maxCount: 1 }, 23 { name: "dimension", maxCount: 1 }, 24 { name: "scheme", maxCount: 1 }, 25 ]); 26 productRouter.post( 27 "/add", 28 multipleUpload, 29 expressAsyncHandler(async (req, res) => { 30 const newProduct = new Product({ 31 name: req.body.name, 32 slug: req.body.slug, 33 image: `/uploads/${req.files.image[0].originalname}`, 34 sideImage: `/uploads/${req.files.sideImage[0].originalname}`, 35 sideImage2: `/uploads/${req.files.sideImage2[0].originalname}`, 36 dimension: `/uploads/${req.files.dimension[0].originalname}`, 37 scheme: `/uploads/${req.files.scheme[0].originalname}`, 38 category: req.body.category, 39 subCategory: req.body.subCategory, 40 description: req.body.description, 41 price: req.body.price, 42 priceMontaza: req.body.priceMontaza, 43 countInStock: req.body.countInStock, 44 }); 45 46 const product = await newProduct.save(); 47 if (product) 48 res.status(201).send({ message: "New Product Created", product }); 49 else res.status(404).send({ message: "Error creating product" }); 50 }) 51 ); 52 53 const PAGE_SIZE = 20; 54 productRouter.get( 55 "/", 56 expressAsyncHandler(async (req, res) => { 57 const { query } = req; 58 const pageSize = query.pageSize || PAGE_SIZE; 59 const page = query.page || 1; 60 const category = query.category || ""; 61 const subCategory = query.subCategory || ""; 62 const order = query.order || ""; 63 const searchQuery = query.query || ""; 64 65 const queryFilter = 66 searchQuery && searchQuery !== "all" 67 ? { name: { $regex: searchQuery, $options: "i" } } 68 : {}; 69 const categoryFilter = category && category !== "all" ? { category } : {}; 70 const subCategoryFilter = 71 subCategory && subCategory !== "all" ? { subCategory } : {}; 72 const sortOrder = 73 order === "lowFirst" 74 ? { price: 1 } 75 : order === "highFirst" 76 ? { price: -1 } 77 : { createdAt: -1 }; 78 const products = await Product.find({ 79 ...queryFilter, 80 ...categoryFilter, 81 ...subCategoryFilter, 82 }) 83 .sort(sortOrder) 84 .skip(pageSize * (page - 1)) 85 .limit(pageSize); 86 87 const countProducts = await Product.countDocuments({ 88 ...queryFilter, 89 ...categoryFilter, 90 ...subCategoryFilter, 91 }); 92 res.send({ 93 products, 94 countProducts, 95 page, 96 pages: Math.ceil(countProducts / pageSize), 97 }); 98 }) 99 ); 100 /* 6 101 productRouter.get("/", async (req, res) => { 7 102 const products = await Product.find(); 8 103 res.send(products); 9 104 }); 10 105 */ 11 106 productRouter.get("/slug/:slug", async (req, res) => { 12 107 const product = await Product.findOne({ slug: req.params.slug }); … … 27 122 }); 28 123 124 productRouter.put( 125 "/edit", 126 expressAsyncHandler(async (req, res) => { 127 const product = await Product.updateOne( 128 { slug: req.body.slug }, 129 { 130 $set: { 131 name: req.body.name, 132 category: req.body.category, 133 slug: req.body.slug, 134 subCategory: req.body.subCategory, 135 description: req.body.description, 136 price: req.body.price, 137 priceMontaza: req.body.priceMontaza, 138 countInStock: req.body.countInStock, 139 }, 140 } 141 ); 142 /* 143 if (product) { 144 product.name = req.body.name || product.name; 145 product.slug = req.body.slug || product.slug; 146 product.price = req.body.price || product.price; 147 product.category = req.body.category || product.category; 148 product.subCategory = req.body.subCategory || product.subCategory; 149 product.description = req.body.description || product.description; 150 product.priceMontaza = req.body.priceMontaza || product.priceMontaza; 151 product.countInStock = req.body.countInStock || product.countInStock; 152 product.image = product.image; 153 product.sideImage = product.sideImage2; 154 product.sideImage2 = product.sideImage2; 155 156 const updatedProduct = await product.save();*/ 157 res.status(200).send({ message: "Succesful" }); 158 //else { 159 //res.status(404).send({ message: "Product Not Found" }); 160 }) 161 ); 29 162 export default productRouter; -
frontend/package-lock.json
ree05663 r55ed171 22 22 "bootstrap": "^5.2.0", 23 23 "font-awesome": "^4.7.0", 24 "jquery": "^3.6.1", 24 25 "react": "^18.2.0", 25 26 "react-bootstrap": "^2.5.0", 26 27 "react-dom": "^18.2.0", 27 28 "react-helmet-async": "^1.3.0", 29 "react-router-bootstrap": "^0.26.2", 28 30 "react-router-dom": "^6.3.0", 29 31 "react-scripts": "5.0.1", 30 32 "react-toastify": "^9.0.8", 33 "slugify": "^1.6.5", 31 34 "web-vitals": "^2.1.4" 32 35 } … … 11728 11731 } 11729 11732 }, 11733 "node_modules/jquery": { 11734 "version": "3.6.1", 11735 "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", 11736 "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==" 11737 }, 11730 11738 "node_modules/js-tokens": { 11731 11739 "version": "4.0.0", … … 14575 14583 } 14576 14584 }, 14585 "node_modules/react-router-bootstrap": { 14586 "version": "0.26.2", 14587 "resolved": "https://registry.npmjs.org/react-router-bootstrap/-/react-router-bootstrap-0.26.2.tgz", 14588 "integrity": "sha512-YlpI9Xi+Uqp6zFAUO8D/wu6P8mr1ujqq+0V5MhJG1kx9dr/95fAMoGk4J+/CsysOkwtR3tYSac4DDWmHwXvC8w==", 14589 "dependencies": { 14590 "prop-types": "^15.7.2" 14591 }, 14592 "peerDependencies": { 14593 "react": ">=16.13.1", 14594 "react-router-dom": ">=6.0.0" 14595 } 14596 }, 14577 14597 "node_modules/react-router-dom": { 14578 14598 "version": "6.3.0", … … 15434 15454 "engines": { 15435 15455 "node": ">=8" 15456 } 15457 }, 15458 "node_modules/slugify": { 15459 "version": "1.6.5", 15460 "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.5.tgz", 15461 "integrity": "sha512-8mo9bslnBO3tr5PEVFzMPIWwWnipGS0xVbYf65zxDqfNwmzYn1LpiKNrR6DlClusuvo+hDHd1zKpmfAe83NQSQ==", 15462 "engines": { 15463 "node": ">=8.0.0" 15436 15464 } 15437 15465 }, … … 25737 25765 } 25738 25766 }, 25767 "jquery": { 25768 "version": "3.6.1", 25769 "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", 25770 "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==" 25771 }, 25739 25772 "js-tokens": { 25740 25773 "version": "4.0.0", … … 27620 27653 "requires": { 27621 27654 "history": "^5.2.0" 27655 } 27656 }, 27657 "react-router-bootstrap": { 27658 "version": "0.26.2", 27659 "resolved": "https://registry.npmjs.org/react-router-bootstrap/-/react-router-bootstrap-0.26.2.tgz", 27660 "integrity": "sha512-YlpI9Xi+Uqp6zFAUO8D/wu6P8mr1ujqq+0V5MhJG1kx9dr/95fAMoGk4J+/CsysOkwtR3tYSac4DDWmHwXvC8w==", 27661 "requires": { 27662 "prop-types": "^15.7.2" 27622 27663 } 27623 27664 }, … … 28258 28299 "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" 28259 28300 }, 28301 "slugify": { 28302 "version": "1.6.5", 28303 "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.5.tgz", 28304 "integrity": "sha512-8mo9bslnBO3tr5PEVFzMPIWwWnipGS0xVbYf65zxDqfNwmzYn1LpiKNrR6DlClusuvo+hDHd1zKpmfAe83NQSQ==" 28305 }, 28260 28306 "sockjs": { 28261 28307 "version": "0.3.24", -
frontend/package.json
ree05663 r55ed171 18 18 "bootstrap": "^5.2.0", 19 19 "font-awesome": "^4.7.0", 20 "jquery": "^3.6.1", 20 21 "react": "^18.2.0", 21 22 "react-bootstrap": "^2.5.0", 22 23 "react-dom": "^18.2.0", 23 24 "react-helmet-async": "^1.3.0", 25 "react-router-bootstrap": "^0.26.2", 24 26 "react-router-dom": "^6.3.0", 25 27 "react-scripts": "5.0.1", 26 28 "react-toastify": "^9.0.8", 29 "slugify": "^1.6.5", 27 30 "web-vitals": "^2.1.4" 28 31 }, -
frontend/src/App.css
ree05663 r55ed171 1 body { 2 overflow-x: hidden; 3 } -
frontend/src/App.js
ree05663 r55ed171 21 21 import OrderHistoryScreen from "./screens/OrderHistoryScreen"; 22 22 import ProfileScreen from "./screens/ProfileScreen"; 23 23 import AdminDashboardScreen from "./screens/AdminDashboardScreen"; 24 import ListProducts from "./components/ListProducts"; 25 import AdminAddProductScreen from "./screens/AdminAddProductScreen"; 26 import AdminProductsScreen from "./screens/AdminProductsScreen"; 27 import AdminEditProductScreen from "./screens/AdminEditProductScreen"; 28 import AdminOrdersScreen from "./screens/AdminOrdersScreen"; 29 import AdminOrderScreen from "./screens/AdminOrderScreen"; 24 30 function App() { 25 31 const { state } = useContext(Store); 26 32 const { cart } = state; 33 //<Route path="/search" element={<AdminProductsScreen />} /> 27 34 return ( 28 35 <BrowserRouter> … … 44 51 <Route path="/order/:id" element={<OrderScreen />} /> 45 52 <Route path="/products" element={<CategoryScreen />} /> 53 <Route path="/admin/dashboard" element={<AdminDashboardScreen />} /> 54 <Route path="/admin/addProduct" element={<AdminAddProductScreen />} /> 55 <Route path="/admin/products" element={<AdminProductsScreen />} /> 56 <Route path="/admin/orders" element={<AdminOrdersScreen />} /> 57 <Route path="/admin/order/:id" element={<AdminOrderScreen />} /> 58 <Route 59 path="/admin/product/:slug" 60 element={<AdminEditProductScreen />} 61 /> 46 62 </Routes> 47 63 -
frontend/src/components/Header.js
ree05663 r55ed171 518 518 <div className="header__right"> 519 519 <div className="header__buttons"> 520 {userInfo ?(520 {userInfo && userInfo.isAdmin && ( 521 521 <NavDropdown 522 522 title={ … … 541 541 <NavDropdown.Item 542 542 onClick={() => { 543 navigate("/ orderhistory");543 navigate("/admin/dashboard"); 544 544 }} 545 545 > 546 Нарачки546 Dashboard 547 547 </NavDropdown.Item> 548 548 … … 556 556 </NavDropdown.Item> 557 557 </NavDropdown> 558 ) : ( 558 )} 559 {userInfo && !userInfo.isAdmin && ( 560 <NavDropdown 561 title={ 562 <span> 563 <AccountCircleIcon 564 className="header__login" 565 fontSize="large" 566 /> 567 <p>{userInfo.name}</p> 568 </span> 569 } 570 id="basic-nav-dropdown" 571 > 572 <NavDropdown.Item 573 onClick={() => { 574 navigate("/profile"); 575 }} 576 > 577 Профил 578 </NavDropdown.Item> 579 580 <NavDropdown.Item 581 onClick={() => { 582 navigate("/orderhistory"); 583 }} 584 > 585 Нарачки 586 </NavDropdown.Item> 587 588 <NavDropdown.Divider /> 589 <NavDropdown.Item 590 className="drowdown-item" 591 to="#signout" 592 onClick={signoutHandler} 593 > 594 Одјави се 595 </NavDropdown.Item> 596 </NavDropdown> 597 )} 598 {!userInfo && ( 559 599 <Link 560 600 to={"/signin"} -
frontend/src/components/Product.js
ree05663 r55ed171 15 15 return ( 16 16 <div className="product__container"> 17 <Link to={`/product/${product.slug}`}> 18 <div className="product__img"> 19 <img src={product.image} alt="product"></img> 17 <Link to={`/product/${product.slug}`} style={{ height: "165.91px" }}> 18 <div className="product__img" style={{ height: "100%" }}> 19 <img 20 src={product.image} 21 alt="product" 22 style={{ height: "100%" }} 23 ></img> 20 24 </div> 21 25 </Link> -
frontend/src/screens/CardPaymentScreen.js
ree05663 r55ed171 41 41 cart.totalPrice = cart.itemsPrice + cart.shippingPrice; 42 42 43 const [cardNumber, setCardNumber] = useState(""); 44 const handleChange = (event) => { 45 const result = event.target.value.replace(/[^0-9]/gi, ""); 46 setCardNumber(result); 47 }; 48 const [ccvNumber, setCcvNumber] = useState(""); 49 const handleChangeCCV = (event) => { 50 const result = event.target.value.replace(/[^0-9]/gi, ""); 51 console.log(event.currentTarget.validity.valid); 52 53 setCcvNumber(result); 54 }; 43 55 const paymentHandler = async (event) => { 44 56 event.preventDefault(); 45 57 const form = event.currentTarget; 46 58 if (form.checkValidity() === false) { 59 event.preventDefault(); 60 event.stopPropagation(); 61 } 62 if (cardNumber.length !== 16) { 47 63 event.preventDefault(); 48 64 event.stopPropagation(); … … 63 79 isPaid: true, 64 80 paidAt: Date.now(), 81 isConfirmed: true, 82 contactNumber: userInfo.contact, 65 83 }, 66 84 { … … 95 113 <Form.Group id="nameInput"> 96 114 <Form.Label>Име и Презиме</Form.Label> 97 <Form.Control 98 type="text" 99 //value={holderName} 100 // onChange={(e) => setHolderName(e.target.value)} 101 required 102 ></Form.Control> 115 <Form.Control type="text" required></Form.Control> 103 116 </Form.Group> 104 117 <Form.Group> … … 106 119 <Form.Control 107 120 type="text" 108 //value={cardNumber} 109 //onChange={(e) => setCardNumber(e.target.value)} 121 minLength="16" 122 maxLength="16" 123 value={cardNumber} 124 onChange={handleChange} 110 125 required 111 126 ></Form.Control> … … 115 130 <Form.Control 116 131 type="text" 117 //value={cvv} 118 //onChange={(e) => setCvv(e.target.value)} 132 minLength={3} 133 maxLength={3} 134 value={ccvNumber} 135 onChange={handleChangeCCV} 119 136 required 120 137 ></Form.Control> -
frontend/src/screens/OrderHistoryScreen.js
ree05663 r55ed171 10 10 import CheckIcon from "@mui/icons-material/Check"; 11 11 import ClearIcon from "@mui/icons-material/Clear"; 12 import PhonePausedIcon from "@mui/icons-material/PhonePaused"; 13 import LocalShippingIcon from "@mui/icons-material/LocalShipping"; 12 14 const reducer = (state, action) => { 13 15 switch (action.type) { … … 49 51 50 52 return ( 51 <div className="pageContainer shipPC" >53 <div className="pageContainer shipPC" style={{ justifyContent: "normal" }}> 52 54 <Helmet> 53 55 <title>Историја на нарачки</title> … … 82 84 {order.isDelivered ? ( 83 85 <CheckIcon></CheckIcon> 86 ) : order.isShipped ? ( 87 <LocalShippingIcon></LocalShippingIcon> 84 88 ) : ( 85 < ClearIcon></ClearIcon>89 <PhonePausedIcon></PhonePausedIcon> 86 90 )} 87 91 </td> -
frontend/src/screens/OrderScreen.js
ree05663 r55ed171 84 84 Доставено на {order.deliveredAt} 85 85 </MessageBox> 86 ) : order.isShipped ? ( 87 <MessageBox variant="primary"> 88 Вашата нарачка е испратена. 89 </MessageBox> 90 ) : order.isConfirmed ? ( 91 <MessageBox variant="primary"> 92 Вашата нарачка се процесира. 93 </MessageBox> 86 94 ) : ( 87 <MessageBox variant="danger">Не е доставено</MessageBox> 95 <MessageBox variant="danger"> 96 Потребно е да ја потврдите нарачката. Ќе бидете контактирани 97 преку телефонскиот број оставен за контакт. 98 </MessageBox> 88 99 )} 89 100 </Card.Body> -
frontend/src/screens/PlaceOrderScreen.js
ree05663 r55ed171 60 60 shippingPrice: cart.shippingPrice, 61 61 totalPrice: cart.totalPrice, 62 isConfirmed: false, 63 contactNumber: userInfo.contact, 62 64 }, 63 65 { -
frontend/src/screens/ProductScreen.js
ree05663 r55ed171 72 72 <img src={product.sideImage} alt={product.name}></img> 73 73 </div> 74 <div className="sideImg"> 75 <img src={product.sideImage2} alt={product.name}></img> 76 </div> 74 77 </div> 75 78 </div> -
frontend/src/screens/ProductScreenBootstrap.js
ree05663 r55ed171 165 165 onClick={changePhoto} 166 166 ></img> 167 168 <img 169 id="sec" 170 src={product.sideImage2} 171 alt={product.name} 172 onClick={changePhoto} 173 ></img> 167 174 </Row> 168 175 -
frontend/src/screens/SigninScreen.js
ree05663 r55ed171 32 32 ctxDispatch({ type: "USER_SIGNIN", payload: data }); 33 33 localStorage.setItem("userInfo", JSON.stringify(data)); 34 navigate(redirect || "/"); 34 if (data.isAdmin) navigate("/admin/dashboard"); 35 else navigate(redirect || "/"); 35 36 } catch (err) { 36 37 toast.error(getError(err));
Note:
See TracChangeset
for help on using the changeset viewer.