fix: file upload and OAuth2 (#10)

This commit is contained in:
Divlo
2022-04-08 21:36:29 +02:00
committed by GitHub
parent 69c567cb66
commit a4c77fec50
30 changed files with 529 additions and 366 deletions

View File

@ -6,10 +6,6 @@ import authenticateUser from '../../../../tools/plugins/authenticateUser.js'
import { fastifyErrors } from '../../../../models/utils.js'
import prisma from '../../../../tools/database/prisma.js'
import { uploadFile } from '../../../../tools/utils/uploadFile.js'
import {
MAXIMUM_IMAGE_SIZE,
SUPPORTED_IMAGE_MIMETYPE
} from '../../../../tools/configurations/index.js'
const putServiceSchema: FastifySchema = {
description: 'Edit the current connected user logo',
@ -51,9 +47,7 @@ export const putCurrentUserLogo: FastifyPluginAsync = async (fastify) => {
const file = await uploadFile({
fastify,
request,
folderInUploadsFolder: 'users',
maximumFileSize: MAXIMUM_IMAGE_SIZE,
supportedFileMimetype: SUPPORTED_IMAGE_MIMETYPE
folderInUploadsFolder: 'users'
})
await prisma.user.update({
where: { id: request.user.current.id },