mirror of
https://github.com/hknsh/project-knedita.git
synced 2024-11-28 17:41:15 +00:00
Created logout route. Update eslint config file
This commit is contained in:
parent
eef8d9c5dc
commit
a2d4af45a3
71 changed files with 1038 additions and 316 deletions
|
@ -3,13 +3,12 @@
|
|||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "standard-with-typescript",
|
||||
"plugins": ["prettier"],
|
||||
"extends": ["plugin:prettier/recommended"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module",
|
||||
"project": [
|
||||
"./tsconfig.json"
|
||||
]
|
||||
"project": ["./tsconfig.json"]
|
||||
},
|
||||
"rules": {
|
||||
"@typescript-eslint/no-misused-promises": "off",
|
||||
|
|
672
package-lock.json
generated
672
package-lock.json
generated
|
@ -53,6 +53,7 @@
|
|||
"eslint-config-standard-with-typescript": "^37.0.0",
|
||||
"eslint-plugin-import": "^2.28.0",
|
||||
"eslint-plugin-n": "^16.0.1",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"nodemon": "^3.0.1",
|
||||
"pm2": "^4.2.3",
|
||||
|
@ -1451,6 +1452,32 @@
|
|||
"semver": "bin/semver"
|
||||
}
|
||||
},
|
||||
"node_modules/@pkgr/utils": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz",
|
||||
"integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"fast-glob": "^3.3.0",
|
||||
"is-glob": "^4.0.3",
|
||||
"open": "^9.1.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/unts"
|
||||
}
|
||||
},
|
||||
"node_modules/@pkgr/utils/node_modules/tslib": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
||||
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@pm2/agent": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@pm2/agent/-/agent-1.0.8.tgz",
|
||||
|
@ -3507,6 +3534,15 @@
|
|||
"node": ">= 10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/big-integer": {
|
||||
"version": "1.6.51",
|
||||
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",
|
||||
"integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/bin-check": {
|
||||
"version": "4.1.0",
|
||||
"dev": true,
|
||||
|
@ -3759,6 +3795,18 @@
|
|||
"resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz",
|
||||
"integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA=="
|
||||
},
|
||||
"node_modules/bplist-parser": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz",
|
||||
"integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"big-integer": "^1.6.44"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 5.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"license": "MIT",
|
||||
|
@ -3810,6 +3858,21 @@
|
|||
"semver": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bundle-name": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz",
|
||||
"integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"run-applescript": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/busboy": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
|
||||
|
@ -4370,6 +4433,150 @@
|
|||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/default-browser": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz",
|
||||
"integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"bundle-name": "^3.0.0",
|
||||
"default-browser-id": "^3.0.0",
|
||||
"execa": "^7.1.1",
|
||||
"titleize": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser-id": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz",
|
||||
"integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"bplist-parser": "^0.2.0",
|
||||
"untildify": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser/node_modules/execa": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz",
|
||||
"integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"get-stream": "^6.0.1",
|
||||
"human-signals": "^4.3.0",
|
||||
"is-stream": "^3.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^5.1.0",
|
||||
"onetime": "^6.0.0",
|
||||
"signal-exit": "^3.0.7",
|
||||
"strip-final-newline": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.18.0 || ^16.14.0 || >=18.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser/node_modules/human-signals": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz",
|
||||
"integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=14.18.0"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser/node_modules/is-stream": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
|
||||
"integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser/node_modules/mimic-fn": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
|
||||
"integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser/node_modules/npm-run-path": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
|
||||
"integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"path-key": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser/node_modules/onetime": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
|
||||
"integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mimic-fn": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser/node_modules/path-key": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
|
||||
"integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser/node_modules/strip-final-newline": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
|
||||
"integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/defer-to-connect": {
|
||||
"version": "2.0.1",
|
||||
"dev": true,
|
||||
|
@ -4378,6 +4585,18 @@
|
|||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/define-lazy-prop": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",
|
||||
"integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/define-properties": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz",
|
||||
|
@ -5097,6 +5316,35 @@
|
|||
"eslint": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-prettier": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz",
|
||||
"integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"prettier-linter-helpers": "^1.0.0",
|
||||
"synckit": "^0.8.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.18.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/prettier"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/eslint": ">=8.0.0",
|
||||
"eslint": ">=8.0.0",
|
||||
"prettier": ">=3.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/eslint": {
|
||||
"optional": true
|
||||
},
|
||||
"eslint-config-prettier": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-promise": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz",
|
||||
|
@ -5410,15 +5658,22 @@
|
|||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fast-diff": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz",
|
||||
"integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fast-fifo": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.0.tgz",
|
||||
"integrity": "sha512-IgfweLvEpwyA4WgiQe9Nx6VV2QkML2NkvZnk1oKnIzXgXdWxuhF7zw4DvLTPZJn6PIUneiAXPF24QmoEqHTjyw=="
|
||||
},
|
||||
"node_modules/fast-glob": {
|
||||
"version": "3.2.12",
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz",
|
||||
"integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@nodelib/fs.stat": "^2.0.2",
|
||||
"@nodelib/fs.walk": "^1.2.3",
|
||||
|
@ -6451,6 +6706,21 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/is-docker": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
|
||||
"integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"is-docker": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-extglob": {
|
||||
"version": "2.1.1",
|
||||
"dev": true,
|
||||
|
@ -6491,6 +6761,24 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-inside-container": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
|
||||
"integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-docker": "^3.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"is-inside-container": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-negative-zero": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz",
|
||||
|
@ -6639,6 +6927,33 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/is-wsl": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-docker": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/is-wsl/node_modules/is-docker": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
|
||||
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"is-docker": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
|
@ -7507,6 +7822,24 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/open": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz",
|
||||
"integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"default-browser": "^4.0.0",
|
||||
"define-lazy-prop": "^3.0.0",
|
||||
"is-inside-container": "^1.0.0",
|
||||
"is-wsl": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/optionator": {
|
||||
"version": "0.9.3",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz",
|
||||
|
@ -7691,6 +8024,12 @@
|
|||
"url": "https://github.com/sponsors/Borewit"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "2.3.1",
|
||||
"dev": true,
|
||||
|
@ -7931,6 +8270,18 @@
|
|||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier-linter-helpers": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
|
||||
"integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fast-diff": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prisma": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.0.0.tgz",
|
||||
|
@ -8324,6 +8675,21 @@
|
|||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/run-applescript": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz",
|
||||
"integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"execa": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/run-parallel": {
|
||||
"version": "1.2.0",
|
||||
"funding": [
|
||||
|
@ -9091,6 +9457,28 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/synckit": {
|
||||
"version": "0.8.5",
|
||||
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz",
|
||||
"integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@pkgr/utils": "^2.3.1",
|
||||
"tslib": "^2.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.18.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/unts"
|
||||
}
|
||||
},
|
||||
"node_modules/synckit/node_modules/tslib": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
||||
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/tar": {
|
||||
"version": "6.1.15",
|
||||
"license": "ISC",
|
||||
|
@ -9140,6 +9528,18 @@
|
|||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/titleize": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz",
|
||||
"integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/to-regex-range": {
|
||||
"version": "5.0.1",
|
||||
"dev": true,
|
||||
|
@ -9568,6 +9968,15 @@
|
|||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/untildify": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
||||
"integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
|
@ -11156,6 +11565,28 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@pkgr/utils": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz",
|
||||
"integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"fast-glob": "^3.3.0",
|
||||
"is-glob": "^4.0.3",
|
||||
"open": "^9.1.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
||||
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@pm2/agent": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@pm2/agent/-/agent-1.0.8.tgz",
|
||||
|
@ -12811,6 +13242,12 @@
|
|||
"node-addon-api": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"big-integer": {
|
||||
"version": "1.6.51",
|
||||
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",
|
||||
"integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==",
|
||||
"dev": true
|
||||
},
|
||||
"bin-check": {
|
||||
"version": "4.1.0",
|
||||
"dev": true,
|
||||
|
@ -12980,6 +13417,15 @@
|
|||
"resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz",
|
||||
"integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA=="
|
||||
},
|
||||
"bplist-parser": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz",
|
||||
"integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"big-integer": "^1.6.44"
|
||||
}
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"requires": {
|
||||
|
@ -13026,6 +13472,15 @@
|
|||
"semver": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"bundle-name": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz",
|
||||
"integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"run-applescript": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"busboy": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
|
||||
|
@ -13426,10 +13881,105 @@
|
|||
"version": "0.1.4",
|
||||
"dev": true
|
||||
},
|
||||
"default-browser": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz",
|
||||
"integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bundle-name": "^3.0.0",
|
||||
"default-browser-id": "^3.0.0",
|
||||
"execa": "^7.1.1",
|
||||
"titleize": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"execa": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz",
|
||||
"integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"get-stream": "^6.0.1",
|
||||
"human-signals": "^4.3.0",
|
||||
"is-stream": "^3.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^5.1.0",
|
||||
"onetime": "^6.0.0",
|
||||
"signal-exit": "^3.0.7",
|
||||
"strip-final-newline": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"human-signals": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz",
|
||||
"integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==",
|
||||
"dev": true
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
|
||||
"integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
|
||||
"dev": true
|
||||
},
|
||||
"mimic-fn": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
|
||||
"integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
|
||||
"dev": true
|
||||
},
|
||||
"npm-run-path": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
|
||||
"integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"onetime": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
|
||||
"integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mimic-fn": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"path-key": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
|
||||
"integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
|
||||
"dev": true
|
||||
},
|
||||
"strip-final-newline": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
|
||||
"integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"default-browser-id": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz",
|
||||
"integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bplist-parser": "^0.2.0",
|
||||
"untildify": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"defer-to-connect": {
|
||||
"version": "2.0.1",
|
||||
"dev": true
|
||||
},
|
||||
"define-lazy-prop": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",
|
||||
"integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
|
||||
"dev": true
|
||||
},
|
||||
"define-properties": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz",
|
||||
|
@ -13942,6 +14492,16 @@
|
|||
"semver": "^7.5.3"
|
||||
}
|
||||
},
|
||||
"eslint-plugin-prettier": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz",
|
||||
"integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"prettier-linter-helpers": "^1.0.0",
|
||||
"synckit": "^0.8.5"
|
||||
}
|
||||
},
|
||||
"eslint-plugin-promise": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz",
|
||||
|
@ -14150,13 +14710,21 @@
|
|||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"dev": true
|
||||
},
|
||||
"fast-diff": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz",
|
||||
"integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==",
|
||||
"dev": true
|
||||
},
|
||||
"fast-fifo": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.0.tgz",
|
||||
"integrity": "sha512-IgfweLvEpwyA4WgiQe9Nx6VV2QkML2NkvZnk1oKnIzXgXdWxuhF7zw4DvLTPZJn6PIUneiAXPF24QmoEqHTjyw=="
|
||||
},
|
||||
"fast-glob": {
|
||||
"version": "3.2.12",
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz",
|
||||
"integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@nodelib/fs.stat": "^2.0.2",
|
||||
|
@ -14835,6 +15403,12 @@
|
|||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-docker": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
|
||||
"integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",
|
||||
"dev": true
|
||||
},
|
||||
"is-extglob": {
|
||||
"version": "2.1.1",
|
||||
"dev": true
|
||||
|
@ -14857,6 +15431,15 @@
|
|||
"is-extglob": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"is-inside-container": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
|
||||
"integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-docker": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"is-negative-zero": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz",
|
||||
|
@ -14943,6 +15526,23 @@
|
|||
"call-bind": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"is-wsl": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-docker": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-docker": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
|
||||
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
|
@ -15548,6 +16148,18 @@
|
|||
"mimic-fn": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"open": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz",
|
||||
"integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"default-browser": "^4.0.0",
|
||||
"define-lazy-prop": "^3.0.0",
|
||||
"is-inside-container": "^1.0.0",
|
||||
"is-wsl": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"optionator": {
|
||||
"version": "0.9.3",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz",
|
||||
|
@ -15665,6 +16277,12 @@
|
|||
"version": "5.0.0",
|
||||
"dev": true
|
||||
},
|
||||
"picocolors": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
|
||||
"dev": true
|
||||
},
|
||||
"picomatch": {
|
||||
"version": "2.3.1",
|
||||
"dev": true
|
||||
|
@ -15843,6 +16461,15 @@
|
|||
"integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier-linter-helpers": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
|
||||
"integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fast-diff": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"prisma": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.0.0.tgz",
|
||||
|
@ -16099,6 +16726,15 @@
|
|||
"glob": "^7.1.3"
|
||||
}
|
||||
},
|
||||
"run-applescript": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz",
|
||||
"integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"execa": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"run-parallel": {
|
||||
"version": "1.2.0",
|
||||
"requires": {
|
||||
|
@ -16604,6 +17240,24 @@
|
|||
"version": "1.0.0",
|
||||
"dev": true
|
||||
},
|
||||
"synckit": {
|
||||
"version": "0.8.5",
|
||||
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz",
|
||||
"integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pkgr/utils": "^2.3.1",
|
||||
"tslib": "^2.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
||||
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"tar": {
|
||||
"version": "6.1.15",
|
||||
"requires": {
|
||||
|
@ -16649,6 +17303,12 @@
|
|||
"version": "0.2.0",
|
||||
"dev": true
|
||||
},
|
||||
"titleize": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz",
|
||||
"integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==",
|
||||
"dev": true
|
||||
},
|
||||
"to-regex-range": {
|
||||
"version": "5.0.1",
|
||||
"dev": true,
|
||||
|
@ -16923,6 +17583,12 @@
|
|||
"unpipe": {
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"untildify": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
||||
"integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==",
|
||||
"dev": true
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
"eslint-config-standard-with-typescript": "^37.0.0",
|
||||
"eslint-plugin-import": "^2.28.0",
|
||||
"eslint-plugin-n": "^16.0.1",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"nodemon": "^3.0.1",
|
||||
"pm2": "^4.2.3",
|
||||
|
|
10
src/app.ts
10
src/app.ts
|
@ -20,15 +20,17 @@ app.use(morganMiddleware)
|
|||
app.use(limiter)
|
||||
app.use(router)
|
||||
app.use(compression({ level: 9 }))
|
||||
app.use(cors({
|
||||
app.use(
|
||||
cors({
|
||||
credentials: true,
|
||||
origin: '*', // TODO: Add client development (and production too) url
|
||||
optionsSuccessStatus: 200
|
||||
}))
|
||||
optionsSuccessStatus: 200,
|
||||
}),
|
||||
)
|
||||
|
||||
app.use((_req, res) => {
|
||||
res.status(404).json({
|
||||
error: 'Endpoint not found'
|
||||
error: 'Endpoint not found',
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -6,14 +6,17 @@ const redisHost = process.env.REDIS_HOST ?? '127.0.0.1'
|
|||
const redisPassword = process.env.REDIS_PASSWORD ?? ''
|
||||
|
||||
const redisConfig: RedisClientOptions = {
|
||||
url: `redis://:${redisPassword}@${redisHost}:${redisPort}/0`
|
||||
url: `redis://:${redisPassword}@${redisHost}:${redisPort}/0`,
|
||||
}
|
||||
|
||||
const redis = createClient(redisConfig)
|
||||
|
||||
redis.connect().then(() => {
|
||||
redis
|
||||
.connect()
|
||||
.then(() => {
|
||||
logger.info('Successfully connected to Redis')
|
||||
}).catch((e: Error) => {
|
||||
})
|
||||
.catch((e: Error) => {
|
||||
logger.error(`Error while connecting to Redis: ${e.message}`)
|
||||
})
|
||||
|
||||
|
|
|
@ -8,16 +8,16 @@ if (process.env.NODE_ENV === 'development') {
|
|||
s3 = new S3Client({
|
||||
credentials: {
|
||||
accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '',
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? ''
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? '',
|
||||
},
|
||||
endpoint: 'http://127.0.0.1:4566' // Uses localstack instead of aws, make sure to create the bucket first with public-read acl
|
||||
endpoint: 'http://127.0.0.1:4566', // Uses localstack instead of aws, make sure to create the bucket first with public-read acl
|
||||
})
|
||||
} else {
|
||||
s3 = new S3Client({
|
||||
credentials: {
|
||||
accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '',
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? ''
|
||||
}
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? '',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -5,17 +5,19 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function commentCreateController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const { content, postId } = req.body
|
||||
const id = res.locals.user.id
|
||||
|
||||
if (postId === undefined) {
|
||||
badRequest(res, 'Expected post id'); return
|
||||
badRequest(res, 'Expected post id')
|
||||
return
|
||||
}
|
||||
|
||||
if (content === undefined) {
|
||||
badRequest(res, 'Expected comment content'); return
|
||||
badRequest(res, 'Expected comment content')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await comment.create(postId, content, id)
|
||||
|
|
|
@ -5,13 +5,14 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function commentDeleteController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const { commentId } = req.body
|
||||
const id = res.locals.user.id
|
||||
|
||||
if (commentId === undefined) {
|
||||
badRequest(res, 'Expected comment id'); return
|
||||
badRequest(res, 'Expected comment id')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await comment.delete(commentId, id)
|
||||
|
|
|
@ -5,12 +5,13 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function commentFetchController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const commentId = req.query.id as string
|
||||
|
||||
if (commentId === undefined) {
|
||||
badRequest(res, 'Expected comment id'); return
|
||||
badRequest(res, 'Expected comment id')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await comment.fetch(commentId)
|
||||
|
|
|
@ -5,12 +5,13 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function commentFetchLikesController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const commentId = req.query.id as string
|
||||
|
||||
if (commentId === undefined) {
|
||||
badRequest(res, 'Expected comment id'); return
|
||||
badRequest(res, 'Expected comment id')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await comment.fetchLikes(commentId)
|
||||
|
|
|
@ -9,7 +9,7 @@ const comments = {
|
|||
delete: commentDeleteController,
|
||||
fetch: commentFetchController,
|
||||
fetchLikes: commentFetchLikesController,
|
||||
update: commentUpdateController
|
||||
update: commentUpdateController,
|
||||
} as const
|
||||
|
||||
export default comments
|
||||
|
|
|
@ -5,17 +5,19 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function commentUpdateController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const { commentId, content } = req.body
|
||||
const id = res.locals.user.id
|
||||
|
||||
if (commentId === undefined) {
|
||||
badRequest(res, 'Expected comment content'); return
|
||||
badRequest(res, 'Expected comment content')
|
||||
return
|
||||
}
|
||||
|
||||
if (content === undefined) {
|
||||
badRequest(res, 'Expected content to update'); return
|
||||
badRequest(res, 'Expected content to update')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await comment.update(content, id, commentId)
|
||||
|
|
|
@ -5,13 +5,14 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function postCreateController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const { content } = req.body
|
||||
const id = res.locals.user.id
|
||||
|
||||
if (content === undefined) {
|
||||
badRequest(res, 'Expected post content'); return
|
||||
badRequest(res, 'Expected post content')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await post.create(content, id)
|
||||
|
|
|
@ -5,13 +5,14 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function postDeleteController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const userId = res.locals.user.id
|
||||
const postId = req.body.postId
|
||||
|
||||
if (postId === undefined) {
|
||||
badRequest(res, 'Missing post id'); return
|
||||
badRequest(res, 'Missing post id')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await post.delete(postId, userId)
|
||||
|
|
|
@ -5,12 +5,13 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function postFetchInfoController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const id = req.query.id as string
|
||||
|
||||
if (id === undefined) {
|
||||
badRequest(res, 'Missing post id'); return
|
||||
badRequest(res, 'Missing post id')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await post.fetch(id)
|
||||
|
|
|
@ -5,12 +5,13 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function postFetchLikesController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const id = req.query.id as string
|
||||
|
||||
if (id === undefined) {
|
||||
badRequest(res, 'Missing post id'); return
|
||||
badRequest(res, 'Missing post id')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await post.fetchLikes(id)
|
||||
|
|
|
@ -9,7 +9,7 @@ const post = {
|
|||
delete: postDeleteController,
|
||||
fetch: postFetchInfoController,
|
||||
fetchLikes: postFetchLikesController,
|
||||
update: postUpdateController
|
||||
update: postUpdateController,
|
||||
} as const
|
||||
|
||||
export default post
|
||||
|
|
|
@ -4,7 +4,7 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function postUpdateController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const { postId, content } = req.body
|
||||
const userId = res.locals.user.id
|
||||
|
|
|
@ -13,6 +13,7 @@ const usersRouter = Router()
|
|||
usersRouter.get('/fetch-posts', user.fetchPosts)
|
||||
usersRouter.get('/info', user.fetchInfo)
|
||||
usersRouter.get('/search', user.searchUser)
|
||||
usersRouter.get('/logout', authenticated, user.logout)
|
||||
|
||||
// POST
|
||||
usersRouter.post('/auth', user.auth)
|
||||
|
@ -27,7 +28,7 @@ usersRouter.put(
|
|||
'/profile-picture/upload',
|
||||
authenticated,
|
||||
uploadFile,
|
||||
user.uploadPicture
|
||||
user.uploadPicture,
|
||||
)
|
||||
usersRouter.put('/update-email', authenticated, user.updateEmail)
|
||||
usersRouter.put('/update-name', authenticated, user.updateName)
|
||||
|
|
|
@ -10,10 +10,12 @@ async function userAuthController (req: Request, res: Response): Promise<void> {
|
|||
if (result instanceof Error) {
|
||||
badRequest(res, result.message)
|
||||
} else {
|
||||
res.cookie('token', result.token, {
|
||||
res
|
||||
.cookie('token', result.token, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === 'production'
|
||||
}).status(200)
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
})
|
||||
.status(200)
|
||||
.json({ message: 'Logged in successfully' })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userDeleteController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const userId = res.locals.user.id
|
||||
const result = await user.delete(userId)
|
||||
|
|
|
@ -5,12 +5,13 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userFetchInfoController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const username = req.query.u as string
|
||||
|
||||
if (username === undefined) {
|
||||
badRequest(res, 'Missing username'); return
|
||||
badRequest(res, 'Missing username')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await user.fetchInfo(username.toLowerCase())
|
||||
|
|
|
@ -5,12 +5,13 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userFetchPostsController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const username = req.query.u as string
|
||||
|
||||
if (username === undefined) {
|
||||
badRequest(res, 'Missing username'); return
|
||||
badRequest(res, 'Missing username')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await user.fetchPosts(username)
|
||||
|
|
|
@ -4,7 +4,7 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userFollowController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const userId = res.locals.user.id
|
||||
const { userToFollow } = req.body
|
||||
|
|
|
@ -5,6 +5,7 @@ import userFetchInfoController from './fetch-info'
|
|||
import userFetchPostsController from './fetch-posts'
|
||||
import userLikeCommentController from './like-comment'
|
||||
import userLikePostController from './like-post'
|
||||
import userLogoutController from './logout'
|
||||
import userSearchController from './search-user'
|
||||
import userSignupController from './signup'
|
||||
import userUpdateEmailController from './update-email'
|
||||
|
@ -20,12 +21,13 @@ const user = {
|
|||
follow: userFollowController,
|
||||
likeComment: userLikeCommentController,
|
||||
likePost: userLikePostController,
|
||||
logout: userLogoutController,
|
||||
searchUser: userSearchController,
|
||||
signup: userSignupController,
|
||||
updateEmail: userUpdateEmailController,
|
||||
updateName: userUpdateNameController,
|
||||
updatePassword: userUpdatePasswordController,
|
||||
uploadPicture: userUploadPictureController
|
||||
uploadPicture: userUploadPictureController,
|
||||
} as const
|
||||
|
||||
export default user
|
||||
|
|
|
@ -4,7 +4,7 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userLikeCommentController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const userId = res.locals.user.id
|
||||
const { commentId } = req.body
|
||||
|
|
|
@ -4,7 +4,7 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userLikePostController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const userId = res.locals.user.id
|
||||
const { postId } = req.body
|
||||
|
|
14
src/controllers/users/logout.ts
Normal file
14
src/controllers/users/logout.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
async function userLogoutController(
|
||||
req: Request,
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
// @ts-expect-error clearCookie interface does not exists in Response.
|
||||
return res
|
||||
.clearCookie('token')
|
||||
.status(200)
|
||||
.json({ message: 'Successfully logged out' })
|
||||
}
|
||||
|
||||
export default userLogoutController
|
|
@ -4,12 +4,13 @@ import { badRequest } from 'helpers/http-errors'
|
|||
|
||||
async function userSearchController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const username = req.query.u as string
|
||||
|
||||
if (username === undefined) {
|
||||
badRequest(res, 'Missing username'); return
|
||||
badRequest(res, 'Missing username')
|
||||
return
|
||||
}
|
||||
|
||||
const result = await user.searchUser(username)
|
||||
|
|
|
@ -4,7 +4,7 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userSignupController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const { username, email, password } = req.body
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userUpdateEmailController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const { email } = req.body
|
||||
const id = res.locals.user.id
|
||||
|
|
|
@ -4,7 +4,7 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userUpdateNameController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const { displayName, username } = req.body
|
||||
const id = res.locals.user.id
|
||||
|
|
|
@ -4,7 +4,7 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userUpdatePasswordController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const { currentPassword, newPassword } = req.body
|
||||
const id = res.locals.user.id
|
||||
|
|
|
@ -6,10 +6,11 @@ import handleResponse from 'helpers/handle-response'
|
|||
|
||||
async function userUploadPictureController(
|
||||
req: Request,
|
||||
res: Response
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
if (req.file === undefined) {
|
||||
badRequest(res, 'Expected a JPG or PNG file'); return
|
||||
badRequest(res, 'Expected a JPG or PNG file')
|
||||
return
|
||||
}
|
||||
|
||||
const userId = res.locals.user.id
|
||||
|
@ -17,7 +18,9 @@ async function userUploadPictureController (
|
|||
let url: string
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
url = `http://${process.env.AWS_BUCKET ?? ''}.s3.localhost.localstack.cloud:4566/${req.file.key}`
|
||||
url = `http://${
|
||||
process.env.AWS_BUCKET ?? ''
|
||||
}.s3.localhost.localstack.cloud:4566/${req.file.key}`
|
||||
} else {
|
||||
url = req.file.location
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@ import { GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'
|
|||
|
||||
export default async function compressImage(
|
||||
imageName: string,
|
||||
isProfilePicture: string
|
||||
isProfilePicture: string,
|
||||
): Promise<Error | Record<never, never>> {
|
||||
// Get file from s3
|
||||
const { Body } = await s3.send(
|
||||
new GetObjectCommand({
|
||||
Bucket: process.env.AWS_BUCKET ?? '',
|
||||
Key: imageName
|
||||
})
|
||||
Key: imageName,
|
||||
}),
|
||||
)
|
||||
|
||||
const imageBuffer = await Body?.transformToByteArray()
|
||||
|
@ -19,7 +19,7 @@ export default async function compressImage (
|
|||
const compressedImageBuffer = await sharp(imageBuffer)
|
||||
.resize(
|
||||
isProfilePicture === 'true' ? 200 : undefined,
|
||||
isProfilePicture === 'true' ? 200 : undefined
|
||||
isProfilePicture === 'true' ? 200 : undefined,
|
||||
)
|
||||
.jpeg({ quality: 65 })
|
||||
.toBuffer()
|
||||
|
@ -30,7 +30,7 @@ export default async function compressImage (
|
|||
Key: imageName,
|
||||
Body: compressedImageBuffer,
|
||||
ContentType: 'image/jpeg',
|
||||
ContentDisposition: 'inline'
|
||||
ContentDisposition: 'inline',
|
||||
}
|
||||
|
||||
const { ETag } = await s3.send(new PutObjectCommand(params))
|
||||
|
|
|
@ -3,7 +3,7 @@ import { type Response } from 'express'
|
|||
const sendErrorResponse = (
|
||||
res: Response,
|
||||
status: number,
|
||||
message: string
|
||||
message: string,
|
||||
): void => {
|
||||
res.status(status).json({ error: message })
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export const forbidden = (res: Response, message = 'Forbidden'): void => {
|
|||
|
||||
export const internalServerError = (
|
||||
res: Response,
|
||||
message = 'Internal Server Error'
|
||||
message = 'Internal Server Error',
|
||||
): void => {
|
||||
sendErrorResponse(res, 500, message)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ const levels = {
|
|||
warn: 1,
|
||||
info: 2,
|
||||
http: 3,
|
||||
debug: 4
|
||||
debug: 4,
|
||||
}
|
||||
|
||||
const level = (): string => {
|
||||
|
@ -20,7 +20,7 @@ const colors = {
|
|||
warn: 'yellow',
|
||||
info: 'green',
|
||||
http: 'magenta',
|
||||
debug: 'white'
|
||||
debug: 'white',
|
||||
}
|
||||
|
||||
winston.addColors(colors)
|
||||
|
@ -30,23 +30,23 @@ const format = winston.format.combine(
|
|||
winston.format.colorize({ all: true }),
|
||||
winston.format.printf(
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
(info) => `${info.timestamp} ${info.level}: ${info.message}`
|
||||
)
|
||||
info => `${info.timestamp} ${info.level}: ${info.message}`,
|
||||
),
|
||||
)
|
||||
|
||||
const transports = [
|
||||
new winston.transports.Console(),
|
||||
new winston.transports.File({
|
||||
filename: 'logs/error.log',
|
||||
level: 'error'
|
||||
})
|
||||
level: 'error',
|
||||
}),
|
||||
]
|
||||
|
||||
const logger = winston.createLogger({
|
||||
level: level(),
|
||||
levels,
|
||||
format,
|
||||
transports
|
||||
transports,
|
||||
})
|
||||
|
||||
export default logger
|
||||
|
|
|
@ -5,7 +5,7 @@ export async function createNotification (
|
|||
fromUserId: string,
|
||||
toUserId: string,
|
||||
content: string,
|
||||
type: NotificationType
|
||||
type: NotificationType,
|
||||
): Promise<Record<never, never> | Error> {
|
||||
try {
|
||||
await prisma.notifications.create({
|
||||
|
@ -13,7 +13,7 @@ export async function createNotification (
|
|||
type,
|
||||
fromUserId,
|
||||
toUserId,
|
||||
content
|
||||
content,
|
||||
},
|
||||
include: {
|
||||
fromUser: {
|
||||
|
@ -21,10 +21,10 @@ export async function createNotification (
|
|||
id: true,
|
||||
displayName: true,
|
||||
username: true,
|
||||
profileImage: true
|
||||
}
|
||||
}
|
||||
}
|
||||
profileImage: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
return {}
|
||||
} catch (_) {
|
||||
|
@ -32,12 +32,14 @@ export async function createNotification (
|
|||
}
|
||||
}
|
||||
|
||||
export async function countNotifications (toUserId: string): Promise<number | Error> {
|
||||
export async function countNotifications(
|
||||
toUserId: string,
|
||||
): Promise<number | Error> {
|
||||
try {
|
||||
const count = await prisma.notifications.count({
|
||||
where: {
|
||||
toUserId
|
||||
}
|
||||
toUserId,
|
||||
},
|
||||
})
|
||||
|
||||
return count
|
||||
|
|
|
@ -7,29 +7,35 @@ import type jwtPayload from 'interfaces/jwt'
|
|||
async function authenticated(
|
||||
req: Request,
|
||||
res: Response,
|
||||
next: NextFunction
|
||||
next: NextFunction,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const token = req.cookies.token
|
||||
|
||||
if (token === undefined) {
|
||||
unauthorized(res, 'Missing token'); return
|
||||
unauthorized(res, 'Missing token')
|
||||
return
|
||||
}
|
||||
|
||||
const { id } = verify(token, process.env.JWT_ACCESS_SECRET ?? '') as jwtPayload
|
||||
const { id } = verify(
|
||||
token,
|
||||
process.env.JWT_ACCESS_SECRET ?? '',
|
||||
) as jwtPayload
|
||||
|
||||
if (id === undefined) {
|
||||
unauthorized(res, 'Invalid token'); return
|
||||
unauthorized(res, 'Invalid token')
|
||||
return
|
||||
}
|
||||
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
id
|
||||
}
|
||||
id,
|
||||
},
|
||||
})
|
||||
|
||||
if (user === undefined) {
|
||||
unauthorized(res, 'User does not exists'); return
|
||||
unauthorized(res, 'User does not exists')
|
||||
return
|
||||
}
|
||||
|
||||
res.locals.user = user
|
||||
|
|
|
@ -2,12 +2,11 @@ import morgan, { type StreamOptions } from 'morgan'
|
|||
import logger from 'helpers/logger'
|
||||
|
||||
const stream: StreamOptions = {
|
||||
write: (message) => logger.http(message)
|
||||
write: message => logger.http(message),
|
||||
}
|
||||
|
||||
const morganMiddleware = morgan(
|
||||
':method :url :status - :response-time ms',
|
||||
{ stream }
|
||||
)
|
||||
const morganMiddleware = morgan(':method :url :status - :response-time ms', {
|
||||
stream,
|
||||
})
|
||||
|
||||
export default morganMiddleware
|
||||
|
|
|
@ -20,8 +20,8 @@ const limiter = rateLimit({
|
|||
|
||||
// Store configuration
|
||||
store: new RedisStore({
|
||||
sendCommand: async (...args: string[]) => await redis.sendCommand(args)
|
||||
})
|
||||
sendCommand: async (...args: string[]) => await redis.sendCommand(args),
|
||||
}),
|
||||
})
|
||||
|
||||
export default limiter
|
||||
|
|
|
@ -9,18 +9,18 @@ function uploadImage (req: Request, res: Response, next: NextFunction): void {
|
|||
|
||||
upload(req, res, async (cb: multer.MulterError | Error | any) => {
|
||||
if (req.res?.locals.user == null) {
|
||||
badRequest(
|
||||
res,
|
||||
'You must be logged in to upload a profile picture'
|
||||
); return
|
||||
badRequest(res, 'You must be logged in to upload a profile picture')
|
||||
return
|
||||
}
|
||||
|
||||
if (cb instanceof multer.MulterError || cb instanceof Error) {
|
||||
badRequest(res, cb.message); return
|
||||
badRequest(res, cb.message)
|
||||
return
|
||||
}
|
||||
|
||||
if (req.file === undefined) {
|
||||
badRequest(res, 'Expected file'); return
|
||||
badRequest(res, 'Expected file')
|
||||
return
|
||||
}
|
||||
|
||||
await compressImage(req.file?.key, req.body.isProfilePicture)
|
||||
|
|
|
@ -3,12 +3,12 @@ import prisma from 'clients/prisma-client'
|
|||
async function commentCreateService(
|
||||
postId: string,
|
||||
content: string,
|
||||
authorId: string
|
||||
authorId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const post = await prisma.post.findFirst({
|
||||
where: {
|
||||
id: postId
|
||||
}
|
||||
id: postId,
|
||||
},
|
||||
})
|
||||
|
||||
if (post === null) {
|
||||
|
@ -17,8 +17,8 @@ async function commentCreateService (
|
|||
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
id: authorId
|
||||
}
|
||||
id: authorId,
|
||||
},
|
||||
})
|
||||
|
||||
if (user === null) {
|
||||
|
@ -29,8 +29,8 @@ async function commentCreateService (
|
|||
data: {
|
||||
content,
|
||||
postId,
|
||||
userId: authorId
|
||||
}
|
||||
userId: authorId,
|
||||
},
|
||||
})
|
||||
|
||||
return comment
|
||||
|
|
|
@ -2,12 +2,12 @@ import prisma from 'clients/prisma-client'
|
|||
|
||||
async function commentDeleteService(
|
||||
commentId: string,
|
||||
authorId: string
|
||||
authorId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
id: authorId
|
||||
}
|
||||
id: authorId,
|
||||
},
|
||||
})
|
||||
|
||||
if (user === null) {
|
||||
|
@ -17,8 +17,8 @@ async function commentDeleteService (
|
|||
const comment = await prisma.comments.findFirst({
|
||||
where: {
|
||||
id: commentId,
|
||||
userId: user.id
|
||||
}
|
||||
userId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
if (comment === null) {
|
||||
|
@ -28,8 +28,8 @@ async function commentDeleteService (
|
|||
await prisma.comments.deleteMany({
|
||||
where: {
|
||||
id: comment.id,
|
||||
userId: user.id
|
||||
}
|
||||
userId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
return {}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import prisma from 'clients/prisma-client'
|
||||
|
||||
async function commentFetchService (commentId: string): Promise<Record<string, unknown> | Error> {
|
||||
async function commentFetchService(
|
||||
commentId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const comment = await prisma.comments.findFirst({
|
||||
where: {
|
||||
id: commentId
|
||||
id: commentId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
@ -15,10 +17,10 @@ async function commentFetchService (commentId: string): Promise<Record<string, u
|
|||
id: true,
|
||||
displayName: true,
|
||||
username: true,
|
||||
profileImage: true
|
||||
}
|
||||
}
|
||||
}
|
||||
profileImage: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (comment === null) {
|
||||
|
|
|
@ -3,17 +3,17 @@ import prisma from 'clients/prisma-client'
|
|||
async function commentFetchLikesService(id: string): Promise<unknown | Error> {
|
||||
const post = await prisma.commentLike.findMany({
|
||||
where: {
|
||||
commentId: id
|
||||
commentId: id,
|
||||
},
|
||||
select: {
|
||||
user: {
|
||||
select: {
|
||||
displayName: true,
|
||||
username: true,
|
||||
profileImage: true
|
||||
}
|
||||
}
|
||||
}
|
||||
profileImage: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (post === null) {
|
||||
|
|
|
@ -9,7 +9,7 @@ const comment = {
|
|||
delete: commentDeleteService,
|
||||
fetch: commentFetchService,
|
||||
fetchLikes: commentFetchLikesService,
|
||||
update: commentUpdateService
|
||||
update: commentUpdateService,
|
||||
} as const
|
||||
|
||||
export default comment
|
||||
|
|
|
@ -3,13 +3,13 @@ import prisma from 'clients/prisma-client'
|
|||
async function commentUpdateService(
|
||||
content: string,
|
||||
authorId: string,
|
||||
commentId: string
|
||||
commentId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const comment = await prisma.comments.findFirst({
|
||||
where: {
|
||||
id: commentId,
|
||||
userId: authorId
|
||||
}
|
||||
userId: authorId,
|
||||
},
|
||||
})
|
||||
|
||||
if (comment === null) {
|
||||
|
@ -19,10 +19,10 @@ async function commentUpdateService (
|
|||
const updatedComment = await prisma.comments.update({
|
||||
where: {
|
||||
id: comment.id,
|
||||
userId: authorId
|
||||
userId: authorId,
|
||||
},
|
||||
data: {
|
||||
content
|
||||
content,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
@ -33,10 +33,10 @@ async function commentUpdateService (
|
|||
select: {
|
||||
displayName: true,
|
||||
username: true,
|
||||
profileImage: true
|
||||
}
|
||||
}
|
||||
}
|
||||
profileImage: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
return updatedComment
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import prisma from 'clients/prisma-client'
|
|||
|
||||
async function postCreateService(
|
||||
content: string,
|
||||
authorId: string
|
||||
authorId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const user = await prisma.user.findFirst({ where: { id: authorId } })
|
||||
|
||||
|
@ -13,8 +13,8 @@ async function postCreateService (
|
|||
const post = await prisma.post.create({
|
||||
data: {
|
||||
content,
|
||||
authorId
|
||||
}
|
||||
authorId,
|
||||
},
|
||||
})
|
||||
|
||||
return post
|
||||
|
|
|
@ -2,7 +2,7 @@ import prisma from 'clients/prisma-client'
|
|||
|
||||
async function postDeleteService(
|
||||
postId: string,
|
||||
userId: string
|
||||
userId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const post = await prisma.post.findFirst({ where: { id: postId } })
|
||||
|
||||
|
@ -20,8 +20,8 @@ async function postDeleteService (
|
|||
|
||||
await prisma.post.deleteMany({
|
||||
where: {
|
||||
id: postId
|
||||
}
|
||||
id: postId,
|
||||
},
|
||||
})
|
||||
|
||||
return {}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import prisma from 'clients/prisma-client'
|
||||
|
||||
async function postFetchInfoService (id: string): Promise<Record<string, unknown> | Error> {
|
||||
async function postFetchInfoService(
|
||||
id: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const post = await prisma.post.findFirst({
|
||||
where: {
|
||||
id
|
||||
id,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
@ -14,10 +16,10 @@ async function postFetchInfoService (id: string): Promise<Record<string, unknown
|
|||
author: {
|
||||
select: {
|
||||
displayName: true,
|
||||
username: true
|
||||
}
|
||||
}
|
||||
}
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (post === null) {
|
||||
|
|
|
@ -3,17 +3,17 @@ import prisma from 'clients/prisma-client'
|
|||
async function postFetchLikesService(id: string): Promise<unknown | Error> {
|
||||
const post = await prisma.postLike.findMany({
|
||||
where: {
|
||||
postId: id
|
||||
postId: id,
|
||||
},
|
||||
select: {
|
||||
user: {
|
||||
select: {
|
||||
displayName: true,
|
||||
username: true,
|
||||
profileImage: true
|
||||
}
|
||||
}
|
||||
}
|
||||
profileImage: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (post === null) {
|
||||
|
|
|
@ -9,7 +9,7 @@ const post = {
|
|||
delete: postDeleteService,
|
||||
fetch: postFetchInfoService,
|
||||
fetchLikes: postFetchLikesService,
|
||||
update: postUpdateService
|
||||
update: postUpdateService,
|
||||
} as const
|
||||
|
||||
export default post
|
||||
|
|
|
@ -3,7 +3,7 @@ import prisma from 'clients/prisma-client'
|
|||
async function postUpdateService(
|
||||
postId: string,
|
||||
content: string,
|
||||
userId: string
|
||||
userId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const post = await prisma.post.findFirst({ where: { id: postId } })
|
||||
|
||||
|
@ -25,10 +25,10 @@ async function postUpdateService (
|
|||
|
||||
const updatedPost = await prisma.post.update({
|
||||
where: {
|
||||
id: postId
|
||||
id: postId,
|
||||
},
|
||||
data: {
|
||||
content
|
||||
content,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
@ -38,10 +38,10 @@ async function postUpdateService (
|
|||
author: {
|
||||
select: {
|
||||
displayName: true,
|
||||
username: true
|
||||
}
|
||||
}
|
||||
}
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return updatedPost
|
||||
|
|
|
@ -5,12 +5,12 @@ import type User from 'interfaces/user'
|
|||
|
||||
async function userAuthService({
|
||||
email,
|
||||
password
|
||||
password,
|
||||
}: User): Promise<Record<string, unknown> | Error> {
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
email
|
||||
}
|
||||
email,
|
||||
},
|
||||
})
|
||||
|
||||
if (user == null) {
|
||||
|
@ -23,7 +23,7 @@ async function userAuthService ({
|
|||
|
||||
const validPassword = await bcrypt.compare(
|
||||
password.replace(/ /g, ''),
|
||||
user.password
|
||||
user.password,
|
||||
)
|
||||
|
||||
if (!validPassword) {
|
||||
|
@ -35,11 +35,11 @@ async function userAuthService ({
|
|||
const bearer = jsonwebtoken.sign(
|
||||
{ id },
|
||||
process.env.JWT_ACCESS_SECRET ?? '',
|
||||
{ expiresIn: '1d' }
|
||||
{ expiresIn: '1d' },
|
||||
)
|
||||
|
||||
return {
|
||||
token: bearer
|
||||
token: bearer,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import prisma from 'clients/prisma-client'
|
||||
|
||||
async function userDeleteService (userId: string): Promise<Record<string, unknown> | Error> {
|
||||
async function userDeleteService(
|
||||
userId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const user = await prisma.user.findFirst({ where: { id: userId } })
|
||||
|
||||
if (user === null) {
|
||||
|
@ -13,8 +15,8 @@ async function userDeleteService (userId: string): Promise<Record<string, unknow
|
|||
|
||||
await prisma.user.deleteMany({
|
||||
where: {
|
||||
id: userId
|
||||
}
|
||||
id: userId,
|
||||
},
|
||||
})
|
||||
|
||||
return {}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import prisma from 'clients/prisma-client'
|
||||
|
||||
async function userFetchInfoService (username: string): Promise<Record<string, unknown> | Error> {
|
||||
async function userFetchInfoService(
|
||||
username: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
username
|
||||
username,
|
||||
},
|
||||
select: {
|
||||
profileImage: true,
|
||||
|
@ -15,15 +17,15 @@ async function userFetchInfoService (username: string): Promise<Record<string, u
|
|||
id: true,
|
||||
content: true,
|
||||
createdAt: true,
|
||||
updatedAt: true
|
||||
}
|
||||
updatedAt: true,
|
||||
},
|
||||
},
|
||||
likedPosts: {
|
||||
select: {
|
||||
postId: true
|
||||
}
|
||||
}
|
||||
}
|
||||
postId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (user === null) {
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import prisma from 'clients/prisma-client'
|
||||
|
||||
async function userFetchPostsService(
|
||||
username: string
|
||||
username: string,
|
||||
): Promise<unknown | Error> {
|
||||
const posts = await prisma.post.findMany({
|
||||
where: {
|
||||
author: {
|
||||
username
|
||||
}
|
||||
username,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
_count: true,
|
||||
id: true,
|
||||
content: true,
|
||||
createdAt: true,
|
||||
updatedAt: true
|
||||
}
|
||||
updatedAt: true,
|
||||
},
|
||||
})
|
||||
return posts
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import prisma from 'clients/prisma-client'
|
|||
|
||||
async function userFollowService(
|
||||
userId: string,
|
||||
followingUsername: string
|
||||
followingUsername: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
if (userId === undefined || followingUsername === undefined) {
|
||||
return new Error('Missing fields')
|
||||
|
@ -10,8 +10,8 @@ async function userFollowService (
|
|||
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
username: followingUsername
|
||||
}
|
||||
username: followingUsername,
|
||||
},
|
||||
})
|
||||
|
||||
if (user === null) {
|
||||
|
@ -20,8 +20,8 @@ async function userFollowService (
|
|||
|
||||
const userToFollow = await prisma.user.findFirst({
|
||||
where: {
|
||||
id: userId
|
||||
}
|
||||
id: userId,
|
||||
},
|
||||
})
|
||||
|
||||
if (userToFollow === null) {
|
||||
|
@ -31,16 +31,16 @@ async function userFollowService (
|
|||
const alreadyFollow = await prisma.follows.findFirst({
|
||||
where: {
|
||||
followerId: user.id,
|
||||
followingId: userToFollow.id
|
||||
}
|
||||
followingId: userToFollow.id,
|
||||
},
|
||||
})
|
||||
|
||||
if (alreadyFollow !== null) {
|
||||
await prisma.follows.deleteMany({
|
||||
where: {
|
||||
followerId: user.id,
|
||||
followingId: userToFollow.id
|
||||
}
|
||||
followingId: userToFollow.id,
|
||||
},
|
||||
})
|
||||
return {}
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ async function userFollowService (
|
|||
const follow = await prisma.follows.create({
|
||||
data: {
|
||||
followerId: user.id,
|
||||
followingId: userToFollow.id
|
||||
}
|
||||
followingId: userToFollow.id,
|
||||
},
|
||||
})
|
||||
|
||||
return follow
|
||||
|
|
|
@ -25,7 +25,7 @@ const user = {
|
|||
updateEmail: userUpdateEmailService,
|
||||
updateName: userUpdateNameService,
|
||||
updatePassword: userUpdatePasswordService,
|
||||
uploadPicture: userUploadPictureService
|
||||
uploadPicture: userUploadPictureService,
|
||||
} as const
|
||||
|
||||
export default user
|
||||
|
|
|
@ -2,7 +2,7 @@ import prisma from 'clients/prisma-client'
|
|||
|
||||
async function userLikeCommentService(
|
||||
commentId: string,
|
||||
userId: string
|
||||
userId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
if (commentId === undefined || userId === undefined) {
|
||||
return new Error('Missing fields')
|
||||
|
@ -10,8 +10,8 @@ async function userLikeCommentService (
|
|||
|
||||
const comment = await prisma.comments.findFirst({
|
||||
where: {
|
||||
id: commentId
|
||||
}
|
||||
id: commentId,
|
||||
},
|
||||
})
|
||||
|
||||
if (comment === null) {
|
||||
|
@ -20,8 +20,8 @@ async function userLikeCommentService (
|
|||
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
id: userId
|
||||
}
|
||||
id: userId,
|
||||
},
|
||||
})
|
||||
|
||||
if (user === null) {
|
||||
|
@ -31,16 +31,16 @@ async function userLikeCommentService (
|
|||
const alreadyLiked = await prisma.commentLike.findFirst({
|
||||
where: {
|
||||
commentId: comment.id,
|
||||
userId: user.id
|
||||
}
|
||||
userId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
if (alreadyLiked !== null) {
|
||||
await prisma.commentLike.deleteMany({
|
||||
where: {
|
||||
commentId: comment.id,
|
||||
userId: user.id
|
||||
}
|
||||
userId: user.id,
|
||||
},
|
||||
})
|
||||
return {}
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ async function userLikeCommentService (
|
|||
const like = await prisma.commentLike.create({
|
||||
data: {
|
||||
commentId: comment.id,
|
||||
userId: user.id
|
||||
}
|
||||
userId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
return like
|
||||
|
|
|
@ -2,7 +2,7 @@ import prisma from 'clients/prisma-client'
|
|||
|
||||
async function userLikePostService(
|
||||
postId: string,
|
||||
userId: string
|
||||
userId: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
if (postId === undefined || userId === undefined) {
|
||||
return new Error('Missing fields')
|
||||
|
@ -10,8 +10,8 @@ async function userLikePostService (
|
|||
|
||||
const post = await prisma.post.findFirst({
|
||||
where: {
|
||||
id: postId
|
||||
}
|
||||
id: postId,
|
||||
},
|
||||
})
|
||||
|
||||
if (post === null) {
|
||||
|
@ -20,8 +20,8 @@ async function userLikePostService (
|
|||
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
id: userId
|
||||
}
|
||||
id: userId,
|
||||
},
|
||||
})
|
||||
|
||||
if (user === null) {
|
||||
|
@ -31,16 +31,16 @@ async function userLikePostService (
|
|||
const alreadyLiked = await prisma.postLike.findFirst({
|
||||
where: {
|
||||
postId: post.id,
|
||||
userId: user.id
|
||||
}
|
||||
userId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
if (alreadyLiked !== null) {
|
||||
await prisma.postLike.deleteMany({
|
||||
where: {
|
||||
postId: post.id,
|
||||
userId: user.id
|
||||
}
|
||||
userId: user.id,
|
||||
},
|
||||
})
|
||||
return {}
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ async function userLikePostService (
|
|||
const like = await prisma.postLike.create({
|
||||
data: {
|
||||
postId: post.id,
|
||||
userId: user.id
|
||||
}
|
||||
userId: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
return like
|
||||
|
|
|
@ -4,15 +4,15 @@ async function userSearchService (username: string): Promise<unknown | Error> {
|
|||
const users = await prisma.user.findMany({
|
||||
where: {
|
||||
username: {
|
||||
contains: username
|
||||
}
|
||||
contains: username,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
displayName: true,
|
||||
username: true,
|
||||
profileImage: true
|
||||
profileImage: true,
|
||||
},
|
||||
take: 10
|
||||
take: 10,
|
||||
})
|
||||
return users
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ const usernameRegex = /^[a-zA-Z0-9_.]{5,15}$/
|
|||
async function userSignupService({
|
||||
username,
|
||||
email,
|
||||
password
|
||||
password,
|
||||
}: User): Promise<Record<string, unknown> | Error> {
|
||||
if (username === undefined || email === undefined || password === undefined) {
|
||||
return new Error('Missing fields')
|
||||
|
@ -17,13 +17,13 @@ async function userSignupService ({
|
|||
|
||||
if (!passwordRegex.test(password)) {
|
||||
return new Error(
|
||||
'Password must have at least 8 characters, one number and one special character.'
|
||||
'Password must have at least 8 characters, one number and one special character.',
|
||||
)
|
||||
}
|
||||
|
||||
if (!usernameRegex.test(username)) {
|
||||
return new Error(
|
||||
'Username not allowed. Only alphanumerics characters (uppercase and lowercase words), underscore, dots and it must be between 5 and 15 characters'
|
||||
'Username not allowed. Only alphanumerics characters (uppercase and lowercase words), underscore, dots and it must be between 5 and 15 characters',
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -46,13 +46,13 @@ async function userSignupService ({
|
|||
data: {
|
||||
username: username.toLowerCase(),
|
||||
email,
|
||||
password: hashedPassword
|
||||
password: hashedPassword,
|
||||
},
|
||||
select: {
|
||||
displayName: true,
|
||||
username: true,
|
||||
createdAt: true
|
||||
}
|
||||
createdAt: true,
|
||||
},
|
||||
})
|
||||
|
||||
return user
|
||||
|
|
|
@ -3,7 +3,7 @@ import prisma from 'clients/prisma-client'
|
|||
|
||||
async function userUpdateEmailService({
|
||||
id,
|
||||
email
|
||||
email,
|
||||
}: User): Promise<Record<string, unknown> | Error> {
|
||||
const user = await prisma.user.findFirst({ where: { id } })
|
||||
|
||||
|
@ -24,16 +24,16 @@ async function userUpdateEmailService ({
|
|||
|
||||
await prisma.user.update({
|
||||
where: {
|
||||
id
|
||||
id,
|
||||
},
|
||||
data: {
|
||||
email: email ?? user.email
|
||||
email: email ?? user.email,
|
||||
},
|
||||
select: {
|
||||
displayName: true,
|
||||
username: true,
|
||||
createdAt: true
|
||||
}
|
||||
createdAt: true,
|
||||
},
|
||||
})
|
||||
|
||||
return { message: 'Successfully updated user email' }
|
||||
|
|
|
@ -4,7 +4,7 @@ import prisma from 'clients/prisma-client'
|
|||
async function userUpdateNameService({
|
||||
id,
|
||||
displayName,
|
||||
username
|
||||
username,
|
||||
}: User): Promise<Record<string, unknown> | Error> {
|
||||
const user = await prisma.user.findFirst({ where: { id } })
|
||||
|
||||
|
@ -28,17 +28,17 @@ async function userUpdateNameService ({
|
|||
|
||||
const updatedUser = await prisma.user.update({
|
||||
where: {
|
||||
id
|
||||
id,
|
||||
},
|
||||
data: {
|
||||
displayName: displayName ?? user.displayName,
|
||||
username: username ?? user.username
|
||||
username: username ?? user.username,
|
||||
},
|
||||
select: {
|
||||
displayName: true,
|
||||
username: true,
|
||||
createdAt: true
|
||||
}
|
||||
createdAt: true,
|
||||
},
|
||||
})
|
||||
|
||||
return updatedUser
|
||||
|
|
|
@ -6,11 +6,11 @@ const passwordRegex = /^(?=.*[0-9])(?=.*[!@#$%^&*_])[a-zA-Z0-9!@#$%^&*_]{8,}$/
|
|||
async function userUpdatePasswordService(
|
||||
id: string,
|
||||
currentPassword: string,
|
||||
newPassword: string
|
||||
newPassword: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
if (!passwordRegex.test(newPassword)) {
|
||||
return new Error(
|
||||
'New password must have at least 8 characters, one number and one special character.'
|
||||
'New password must have at least 8 characters, one number and one special character.',
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ async function userUpdatePasswordService (
|
|||
|
||||
const validPassword = await bcrypt.compare(
|
||||
currentPassword.replace(/ /g, ''),
|
||||
user.password
|
||||
user.password,
|
||||
)
|
||||
|
||||
if (!validPassword) {
|
||||
|
@ -38,16 +38,16 @@ async function userUpdatePasswordService (
|
|||
|
||||
await prisma.user.update({
|
||||
where: {
|
||||
id
|
||||
id,
|
||||
},
|
||||
data: {
|
||||
password: hashedPassword
|
||||
password: hashedPassword,
|
||||
},
|
||||
select: {
|
||||
displayName: true,
|
||||
username: true,
|
||||
createdAt: true
|
||||
}
|
||||
createdAt: true,
|
||||
},
|
||||
})
|
||||
|
||||
return { message: 'Successfully updated user password' }
|
||||
|
|
|
@ -2,7 +2,7 @@ import prisma from 'clients/prisma-client'
|
|||
|
||||
async function userUploadPictureService(
|
||||
authorId: string,
|
||||
url: string
|
||||
url: string,
|
||||
): Promise<Record<string, unknown> | Error> {
|
||||
const user = await prisma.user.findFirst({ where: { id: authorId } })
|
||||
|
||||
|
@ -12,14 +12,14 @@ async function userUploadPictureService (
|
|||
|
||||
const updatedUser = await prisma.user.update({
|
||||
where: {
|
||||
id: authorId
|
||||
id: authorId,
|
||||
},
|
||||
data: {
|
||||
profileImage: url
|
||||
profileImage: url,
|
||||
},
|
||||
select: {
|
||||
profileImage: true
|
||||
}
|
||||
profileImage: true,
|
||||
},
|
||||
})
|
||||
|
||||
return updatedUser
|
||||
|
|
|
@ -6,8 +6,8 @@ import { Server } from 'socket.io'
|
|||
export default function createSocketIOInstance(httpServer: any) {
|
||||
const io = new Server(httpServer, {
|
||||
cors: {
|
||||
origin: process.env.CORS_ORIGIN ?? '*'
|
||||
}
|
||||
origin: process.env.CORS_ORIGIN ?? '*',
|
||||
},
|
||||
})
|
||||
|
||||
io.use(async (socket, next) => {
|
||||
|
@ -20,11 +20,11 @@ export default function createSocketIOInstance (httpServer: any) {
|
|||
|
||||
await prisma.user.update({
|
||||
where: {
|
||||
id: socket.handshake.auth.id
|
||||
id: socket.handshake.auth.id,
|
||||
},
|
||||
data: {
|
||||
socketId: socket.id
|
||||
}
|
||||
socketId: socket.id,
|
||||
},
|
||||
})
|
||||
|
||||
next()
|
||||
|
@ -36,7 +36,7 @@ export default function createSocketIOInstance (httpServer: any) {
|
|||
}
|
||||
*/
|
||||
|
||||
io.on('connection', (_) => {
|
||||
io.on('connection', _ => {
|
||||
logger.info('Placeholder')
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue