fix: update dependencies to latest
This commit is contained in:
		| @@ -1,9 +1,6 @@ | ||||
| .vscode | ||||
| .git | ||||
| .env | ||||
| .* | ||||
| !.npmrc | ||||
| !.swcrc | ||||
| build | ||||
| coverage | ||||
| .nyc_output | ||||
| node_modules | ||||
| tmp | ||||
| temp | ||||
|   | ||||
| @@ -10,7 +10,6 @@ | ||||
|   "rules": { | ||||
|     "prettier/prettier": "error", | ||||
|     "import/extensions": ["error", "always"], | ||||
|     "unicorn/prevent-abbreviations": "error", | ||||
|     "unicorn/prefer-node-protocol": "error" | ||||
|     "unicorn/prevent-abbreviations": "error" | ||||
|   } | ||||
| } | ||||
|   | ||||
							
								
								
									
										2
									
								
								.github/workflows/analyze.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/analyze.yml
									
									
									
									
										vendored
									
									
								
							| @@ -16,7 +16,7 @@ jobs: | ||||
|         language: ['javascript'] | ||||
|  | ||||
|     steps: | ||||
|       - uses: 'actions/checkout@v3.0.0' | ||||
|       - uses: 'actions/checkout@v3.3.0' | ||||
|  | ||||
|       - name: 'Initialize CodeQL' | ||||
|         uses: 'github/codeql-action/init@v2' | ||||
|   | ||||
							
								
								
									
										6
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @@ -10,10 +10,10 @@ jobs: | ||||
|   build: | ||||
|     runs-on: 'ubuntu-latest' | ||||
|     steps: | ||||
|       - uses: 'actions/checkout@v3.1.0' | ||||
|       - uses: 'actions/checkout@v3.3.0' | ||||
|  | ||||
|       - name: 'Use Node.js' | ||||
|         uses: 'actions/setup-node@v3.5.1' | ||||
|         uses: 'actions/setup-node@v3.6.0' | ||||
|         with: | ||||
|           node-version: '18.x' | ||||
|           cache: 'npm' | ||||
| @@ -23,3 +23,5 @@ jobs: | ||||
|  | ||||
|       - name: 'Build' | ||||
|         run: 'npm run build' | ||||
|  | ||||
|       - run: 'npm run build:typescript' | ||||
|   | ||||
							
								
								
									
										13
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
								
							| @@ -10,10 +10,10 @@ jobs: | ||||
|   lint: | ||||
|     runs-on: 'ubuntu-latest' | ||||
|     steps: | ||||
|       - uses: 'actions/checkout@v3.1.0' | ||||
|       - uses: 'actions/checkout@v3.3.0' | ||||
|  | ||||
|       - name: 'Use Node.js' | ||||
|         uses: 'actions/setup-node@v3.5.1' | ||||
|         uses: 'actions/setup-node@v3.6.0' | ||||
|         with: | ||||
|           node-version: '18.x' | ||||
|           cache: 'npm' | ||||
| @@ -30,8 +30,8 @@ jobs: | ||||
|       - name: 'lint:markdown' | ||||
|         run: 'npm run lint:markdown' | ||||
|  | ||||
|       - name: 'lint:typescript' | ||||
|         run: 'npm run lint:typescript' | ||||
|       - name: 'lint:eslint' | ||||
|         run: 'npm run lint:eslint' | ||||
|  | ||||
|       - name: 'lint:prettier' | ||||
|         run: 'npm run lint:prettier' | ||||
| @@ -41,10 +41,5 @@ jobs: | ||||
|         with: | ||||
|           github_token: ${{ secrets.github_token }} | ||||
|  | ||||
|       - name: 'lint:docker' | ||||
|         uses: 'hadolint/hadolint-action@v1.6.0' | ||||
|         with: | ||||
|           dockerfile: './Dockerfile' | ||||
|  | ||||
|       - name: 'prisma:validate' | ||||
|         run: 'cp .env.example .env && npm run prisma:validate' | ||||
|   | ||||
							
								
								
									
										6
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| @@ -8,7 +8,7 @@ jobs: | ||||
|   release: | ||||
|     runs-on: 'ubuntu-latest' | ||||
|     steps: | ||||
|       - uses: 'actions/checkout@v3.1.0' | ||||
|       - uses: 'actions/checkout@v3.3.0' | ||||
|         with: | ||||
|           fetch-depth: 0 | ||||
|           persist-credentials: false | ||||
| @@ -21,7 +21,7 @@ jobs: | ||||
|           git-commit-gpgsign: true | ||||
|  | ||||
|       - name: 'Use Node.js' | ||||
|         uses: 'actions/setup-node@v3.5.1' | ||||
|         uses: 'actions/setup-node@v3.6.0' | ||||
|         with: | ||||
|           node-version: '18.x' | ||||
|           cache: 'npm' | ||||
| @@ -32,6 +32,8 @@ jobs: | ||||
|       - name: 'Build' | ||||
|         run: 'npm run build' | ||||
|  | ||||
|       - run: 'npm run build:typescript' | ||||
|  | ||||
|       - name: 'Release' | ||||
|         run: 'npm run release' | ||||
|         env: | ||||
|   | ||||
							
								
								
									
										4
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							| @@ -10,10 +10,10 @@ jobs: | ||||
|   test: | ||||
|     runs-on: 'ubuntu-latest' | ||||
|     steps: | ||||
|       - uses: 'actions/checkout@v3.1.0' | ||||
|       - uses: 'actions/checkout@v3.3.0' | ||||
|  | ||||
|       - name: 'Use Node.js' | ||||
|         uses: 'actions/setup-node@v3.5.1' | ||||
|         uses: 'actions/setup-node@v3.6.0' | ||||
|         with: | ||||
|           node-version: '18.x' | ||||
|           cache: 'npm' | ||||
|   | ||||
| @@ -3,3 +3,4 @@ | ||||
|  | ||||
| npm run lint:staged | ||||
| npm run build | ||||
| npm run build:typescript | ||||
|   | ||||
| @@ -1,10 +1,5 @@ | ||||
| { | ||||
|   "config": { | ||||
|     "default": true, | ||||
|     "MD013": false, | ||||
|     "MD033": false, | ||||
|     "MD041": false | ||||
|   }, | ||||
|   "globs": ["**/*.{md,mdx}"], | ||||
|   "ignores": ["**/node_modules"] | ||||
|   "ignores": ["**/node_modules"], | ||||
|   "customRules": ["markdownlint-rule-relative-links"] | ||||
| } | ||||
|   | ||||
							
								
								
									
										7
									
								
								.markdownlint.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								.markdownlint.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| { | ||||
|   "default": true, | ||||
|   "relative-links": true, | ||||
|   "extends": "markdownlint/style/prettier", | ||||
|   "MD033": false, | ||||
|   "MD041": false | ||||
| } | ||||
| @@ -1,15 +1,15 @@ | ||||
| FROM node:18.12.1 AS dependencies | ||||
| FROM node:18.13.0 AS dependencies | ||||
| WORKDIR /usr/src/app | ||||
| COPY ./package*.json ./ | ||||
| RUN npm install | ||||
|  | ||||
| FROM node:18.12.1 AS builder | ||||
| FROM node:18.13.0 AS builder | ||||
| WORKDIR /usr/src/app | ||||
| COPY --from=dependencies /usr/src/app/node_modules ./node_modules | ||||
| COPY ./ ./ | ||||
| RUN npm run prisma:generate && npm run build | ||||
|  | ||||
| FROM node:18.12.1 AS runner | ||||
| FROM node:18.13.0 AS runner | ||||
| WORKDIR /usr/src/app | ||||
| ENV NODE_ENV=production | ||||
| COPY --from=builder /usr/src/app/node_modules ./node_modules | ||||
|   | ||||
| @@ -18,7 +18,7 @@ | ||||
|  | ||||
| Thream's Application Programming Interface (API) to stay close with your friends and communities. | ||||
|  | ||||
| It uses [Thream/file-uploads-api](https://github.com/Thream/file-uploads-api) [v1.1.0](https://github.com/Thream/file-uploads-api/releases/tag/v1.1.0). | ||||
| It uses [Thream/file-uploads-api](https://github.com/Thream/file-uploads-api) [v1.1.2](https://github.com/Thream/file-uploads-api/releases/tag/v1.1.2). | ||||
|  | ||||
| ## ⚙️ Getting Started | ||||
|  | ||||
|   | ||||
							
								
								
									
										13372
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										13372
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										51
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								package.json
									
									
									
									
									
								
							| @@ -13,8 +13,9 @@ | ||||
|     "npm": ">=8.0.0" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "build": "rimraf ./build && swc ./src --out-dir ./build && tsc", | ||||
|     "build": "rimraf ./build && swc ./src --out-dir ./build", | ||||
|     "build:dev": "swc ./src --out-dir ./build --watch", | ||||
|     "build:typescript": "tsc", | ||||
|     "start": "node build/index.js", | ||||
|     "dev": "concurrently -k -n \"TypeScript,Node\" -p \"[{name}]\" -c \"blue,green\" \"npm run build:dev\" \"cross-env NODE_ENV=development nodemon build/index.js\"", | ||||
|     "generate": "plop", | ||||
| @@ -22,7 +23,7 @@ | ||||
|     "lint:commit": "commitlint", | ||||
|     "lint:editorconfig": "editorconfig-checker", | ||||
|     "lint:markdown": "markdownlint-cli2", | ||||
|     "lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"", | ||||
|     "lint:eslint": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"", | ||||
|     "lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"", | ||||
|     "lint:staged": "lint-staged", | ||||
|     "test": "cross-env NODE_ENV=test c8 tap", | ||||
| @@ -42,64 +43,66 @@ | ||||
|     "@fastify/sensible": "5.2.0", | ||||
|     "@fastify/swagger": "8.2.1", | ||||
|     "@fastify/swagger-ui": "1.3.0", | ||||
|     "@prisma/client": "4.5.0", | ||||
|     "@sinclair/typebox": "0.25.13", | ||||
|     "@thream/socketio-jwt": "3.0.1", | ||||
|     "axios": "1.2.1", | ||||
|     "@prisma/client": "4.8.1", | ||||
|     "@sinclair/typebox": "0.25.20", | ||||
|     "@thream/socketio-jwt": "3.0.2", | ||||
|     "axios": "1.2.2", | ||||
|     "bcryptjs": "2.4.3", | ||||
|     "dotenv": "16.0.3", | ||||
|     "ejs": "3.1.8", | ||||
|     "fastify": "4.10.2", | ||||
|     "fastify": "4.11.0", | ||||
|     "fastify-plugin": "4.4.0", | ||||
|     "form-data": "4.0.0", | ||||
|     "http-errors": "2.0.0", | ||||
|     "jsonwebtoken": "8.5.1", | ||||
|     "jsonwebtoken": "9.0.0", | ||||
|     "ms": "2.1.3", | ||||
|     "nodemailer": "6.8.0", | ||||
|     "read-pkg": "7.1.0", | ||||
|     "socket.io": "4.5.4" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@commitlint/cli": "17.2.0", | ||||
|     "@commitlint/config-conventional": "17.2.0", | ||||
|     "@commitlint/cli": "17.4.1", | ||||
|     "@commitlint/config-conventional": "17.4.0", | ||||
|     "@saithodev/semantic-release-backmerge": "2.1.2", | ||||
|     "@semantic-release/git": "10.0.1", | ||||
|     "@swc/cli": "0.1.57", | ||||
|     "@swc/core": "1.3.14", | ||||
|     "@swc/core": "1.3.25", | ||||
|     "@tsconfig/strictest": "1.0.2", | ||||
|     "@types/bcryptjs": "2.4.2", | ||||
|     "@types/busboy": "1.5.0", | ||||
|     "@types/ejs": "3.1.1", | ||||
|     "@types/http-errors": "1.8.2", | ||||
|     "@types/jsonwebtoken": "8.5.9", | ||||
|     "@types/jsonwebtoken": "9.0.0", | ||||
|     "@types/ms": "0.7.31", | ||||
|     "@types/node": "18.11.14", | ||||
|     "@types/nodemailer": "6.4.6", | ||||
|     "@types/node": "18.11.18", | ||||
|     "@types/nodemailer": "6.4.7", | ||||
|     "@types/sinon": "10.0.13", | ||||
|     "@types/tap": "15.0.7", | ||||
|     "@typescript-eslint/eslint-plugin": "5.46.1", | ||||
|     "@typescript-eslint/parser": "5.46.1", | ||||
|     "@typescript-eslint/eslint-plugin": "5.48.1", | ||||
|     "@typescript-eslint/parser": "5.48.1", | ||||
|     "c8": "7.12.0", | ||||
|     "concurrently": "7.6.0", | ||||
|     "cross-env": "7.0.3", | ||||
|     "editorconfig-checker": "4.0.2", | ||||
|     "eslint": "8.29.0", | ||||
|     "eslint": "8.31.0", | ||||
|     "eslint-config-conventions": "6.0.0", | ||||
|     "eslint-config-prettier": "8.5.0", | ||||
|     "eslint-config-prettier": "8.6.0", | ||||
|     "eslint-plugin-import": "2.26.0", | ||||
|     "eslint-plugin-prettier": "4.2.1", | ||||
|     "eslint-plugin-promise": "6.1.1", | ||||
|     "eslint-plugin-unicorn": "45.0.2", | ||||
|     "husky": "8.0.2", | ||||
|     "husky": "8.0.3", | ||||
|     "lint-staged": "13.1.0", | ||||
|     "markdownlint-cli2": "0.5.1", | ||||
|     "markdownlint-cli2": "0.6.0", | ||||
|     "markdownlint-rule-relative-links": "1.1.1", | ||||
|     "nodemon": "2.0.20", | ||||
|     "plop": "3.1.1", | ||||
|     "prettier": "2.8.1", | ||||
|     "prisma": "4.5.0", | ||||
|     "prettier": "2.8.2", | ||||
|     "prisma": "4.8.1", | ||||
|     "rimraf": "3.0.2", | ||||
|     "semantic-release": "19.0.5", | ||||
|     "sinon": "14.0.2", | ||||
|     "tap": "16.3.2", | ||||
|     "sinon": "15.0.1", | ||||
|     "tap": "16.3.3", | ||||
|     "typescript": "4.9.4" | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import fastifySocketIo from './tools/plugins/socket-io.js' | ||||
| dotenv.config() | ||||
| const packageJSON = await readPackage() | ||||
| export const application = fastify({ | ||||
|   logger: process.env.NODE_ENV === 'development', | ||||
|   logger: process.env['NODE_ENV'] === 'development', | ||||
|   ajv: { | ||||
|     customOptions: { | ||||
|       strict: 'log', | ||||
|   | ||||
| @@ -12,8 +12,8 @@ export const providersTypebox = providers.map((provider) => { | ||||
|   return Type.Literal(provider) | ||||
| }) | ||||
|  | ||||
| export type ProviderOAuth = typeof providers[number] | ||||
| export type AuthenticationStrategy = typeof strategies[number] | ||||
| export type ProviderOAuth = (typeof providers)[number] | ||||
| export type AuthenticationStrategy = (typeof strategies)[number] | ||||
|  | ||||
| export const oauthSchema = { | ||||
|   id, | ||||
|   | ||||
| @@ -54,7 +54,7 @@ export const getConfirmEmail: FastifyPluginAsync = async (fastify) => { | ||||
|         reply.statusCode = 200 | ||||
|         return 'Success, your email has been confirmed, you can now signin!' | ||||
|       } | ||||
|       await reply.redirect(redirectURI) | ||||
|       return await reply.redirect(redirectURI) | ||||
|     } | ||||
|   }) | ||||
| } | ||||
|   | ||||
| @@ -7,9 +7,9 @@ import { OAuthStrategy } from '../../../../../tools/utils/OAuthStrategy.js' | ||||
| export const DISCORD_PROVIDER = 'Discord' | ||||
| export const DISCORD_BASE_URL = 'https://discord.com/api/v10' | ||||
| export const DISCORD_CLIENT_ID = | ||||
|   process.env.DISCORD_CLIENT_ID ?? 'DISCORD_CLIENT_ID' | ||||
|   process.env['DISCORD_CLIENT_ID'] ?? 'DISCORD_CLIENT_ID' | ||||
| export const DISCORD_CLIENT_SECRET = | ||||
|   process.env.DISCORD_CLIENT_SECRET ?? 'DISCORD_CLIENT_SECRET' | ||||
|   process.env['DISCORD_CLIENT_SECRET'] ?? 'DISCORD_CLIENT_SECRET' | ||||
| export const discordStrategy = new OAuthStrategy(DISCORD_PROVIDER) | ||||
|  | ||||
| export interface DiscordUser { | ||||
|   | ||||
| @@ -8,9 +8,9 @@ export const GITHUB_PROVIDER = 'GitHub' | ||||
| export const GITHUB_BASE_URL = 'https://github.com' | ||||
| export const GITHUB_API_BASE_URL = 'https://api.github.com' | ||||
| export const GITHUB_CLIENT_ID = | ||||
|   process.env.GITHUB_CLIENT_ID ?? 'GITHUB_CLIENT_ID' | ||||
|   process.env['GITHUB_CLIENT_ID'] ?? 'GITHUB_CLIENT_ID' | ||||
| export const GITHUB_CLIENT_SECRET = | ||||
|   process.env.GITHUB_CLIENT_SECRET ?? 'GITHUB_CLIENT_SECRET' | ||||
|   process.env['GITHUB_CLIENT_SECRET'] ?? 'GITHUB_CLIENT_SECRET' | ||||
| export const githubStrategy = new OAuthStrategy(GITHUB_PROVIDER) | ||||
|  | ||||
| export interface GitHubUser { | ||||
|   | ||||
| @@ -10,9 +10,9 @@ export const GOOGLE_OAUTH2_TOKEN = 'https://oauth2.googleapis.com/token' | ||||
| export const GOOGLE_USERINFO = | ||||
|   'https://www.googleapis.com/oauth2/v1/userinfo?alt=json' | ||||
| export const GOOGLE_CLIENT_ID = | ||||
|   process.env.GOOGLE_CLIENT_ID ?? 'GOOGLE_CLIENT_ID' | ||||
|   process.env['GOOGLE_CLIENT_ID'] ?? 'GOOGLE_CLIENT_ID' | ||||
| export const GOOGLE_CLIENT_SECRET = | ||||
|   process.env.GOOGLE_CLIENT_SECRET ?? 'GOOGLE_CLIENT_SECRET' | ||||
|   process.env['GOOGLE_CLIENT_SECRET'] ?? 'GOOGLE_CLIENT_SECRET' | ||||
| export const googleStrategy = new OAuthStrategy(GOOGLE_PROVIDER) | ||||
|  | ||||
| export interface GoogleUser { | ||||
|   | ||||
| @@ -4,19 +4,19 @@ import dotenv from 'dotenv' | ||||
|  | ||||
| dotenv.config() | ||||
|  | ||||
| export const PORT = parseInt(process.env.PORT ?? '8080', 10) | ||||
| export const HOST = process.env.HOST ?? '0.0.0.0' | ||||
| export const API_URL = process.env.API_URL ?? `http://${HOST}:${PORT}` | ||||
| export const PORT = parseInt(process.env['PORT'] ?? '8080', 10) | ||||
| export const HOST = process.env['HOST'] ?? '0.0.0.0' | ||||
| export const API_URL = process.env['API_URL'] ?? `http://${HOST}:${PORT}` | ||||
| export const FILE_UPLOADS_API_URL = | ||||
|   process.env.FILE_UPLOADS_API_URL ?? 'http://localhost:8000' | ||||
|   process.env['FILE_UPLOADS_API_URL'] ?? 'http://localhost:8000' | ||||
| export const FILE_UPLOADS_API_KEY = | ||||
|   process.env.FILE_UPLOADS_API_KEY ?? 'apiKeySecret' | ||||
|   process.env['FILE_UPLOADS_API_KEY'] ?? 'apiKeySecret' | ||||
| export const JWT_ACCESS_SECRET = | ||||
|   process.env.JWT_ACCESS_SECRET ?? 'accessTokenSecret' | ||||
|   process.env['JWT_ACCESS_SECRET'] ?? 'accessTokenSecret' | ||||
| export const JWT_REFRESH_SECRET = | ||||
|   process.env.JWT_REFRESH_SECRET ?? 'refreshTokenSecret' | ||||
|   process.env['JWT_REFRESH_SECRET'] ?? 'refreshTokenSecret' | ||||
| export const JWT_ACCESS_EXPIRES_IN = | ||||
|   process.env.JWT_ACCESS_EXPIRES_IN ?? '15 minutes' | ||||
|   process.env['JWT_ACCESS_EXPIRES_IN'] ?? '15 minutes' | ||||
|  | ||||
| export const SRC_URL = new URL('../', import.meta.url) | ||||
| export const ROOT_URL = new URL('../', SRC_URL) | ||||
|   | ||||
| @@ -4,7 +4,7 @@ const { PrismaClient } = Prisma | ||||
|  | ||||
| const prisma = new PrismaClient({ | ||||
|   log: | ||||
|     process.env.NODE_ENV === 'development' | ||||
|     process.env['NODE_ENV'] === 'development' | ||||
|       ? ['query', 'info', 'warn', 'error'] | ||||
|       : ['error'] | ||||
| }) | ||||
|   | ||||
| @@ -3,17 +3,17 @@ import nodemailer from 'nodemailer' | ||||
| import type SMTPTransport from 'nodemailer/lib/smtp-transport/index.js' | ||||
|  | ||||
| dotenv.config() | ||||
| const EMAIL_PORT = parseInt(process.env.EMAIL_PORT ?? '465', 10) | ||||
| const EMAIL_PORT = parseInt(process.env['EMAIL_PORT'] ?? '465', 10) | ||||
|  | ||||
| export const EMAIL_INFO: SMTPTransport.Options = { | ||||
|   host: process.env.EMAIL_HOST, | ||||
|   host: process.env['EMAIL_HOST'], | ||||
|   port: EMAIL_PORT, | ||||
|   secure: EMAIL_PORT === 465, | ||||
|   auth: { | ||||
|     user: process.env.EMAIL_USER, | ||||
|     pass: process.env.EMAIL_PASSWORD | ||||
|     user: process.env['EMAIL_USER'], | ||||
|     pass: process.env['EMAIL_PASSWORD'] | ||||
|   }, | ||||
|   ignoreTLS: process.env.NODE_ENV !== 'production' | ||||
|   ignoreTLS: process.env['NODE_ENV'] !== 'production' | ||||
| } | ||||
|  | ||||
| export const emailTransporter = nodemailer.createTransport(EMAIL_INFO) | ||||
|   | ||||
| @@ -20,10 +20,10 @@ export const getUserWithBearerToken = async ( | ||||
|     throw new Unauthorized() | ||||
|   } | ||||
|  | ||||
|   const token = tokenSplitted[1] | ||||
|   const token = tokenSplitted[1] ?? 'token' | ||||
|   let payload: UserJWT | ||||
|   try { | ||||
|     payload = jwt.verify(token, JWT_ACCESS_SECRET) as UserJWT | ||||
|     payload = jwt.verify(token, JWT_ACCESS_SECRET) as unknown as UserJWT | ||||
|   } catch { | ||||
|     throw new Forbidden() | ||||
|   } | ||||
|   | ||||
| @@ -48,10 +48,10 @@ export const uploadFile = async ( | ||||
|       `File should be less than ${MAXIMUM_FILE_SIZE}mb.` | ||||
|     ) | ||||
|   } | ||||
|   if (files.length !== 1) { | ||||
|   const file = files[0] | ||||
|   if (files.length !== 1 || file == null) { | ||||
|     throw fastify.httpErrors.badRequest('You must upload at most one file.') | ||||
|   } | ||||
|   const file = files[0] | ||||
|   const formData = new FormData() | ||||
|   formData.append('file', fs.createReadStream(file.filepath)) | ||||
|   try { | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| { | ||||
|   "extends": "@tsconfig/strictest/tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "target": "ESNext", | ||||
|     "module": "ESNext", | ||||
| @@ -7,8 +8,7 @@ | ||||
|     "outDir": "./build", | ||||
|     "rootDir": "./src", | ||||
|     "noEmit": true, | ||||
|     "strict": true, | ||||
|     "skipLibCheck": true, | ||||
|     "esModuleInterop": true | ||||
|     "exactOptionalPropertyTypes": false, | ||||
|     "checkJs": false | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user