fix: update dependencies to latest
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user