работаем бля работаем
This commit is contained in:
@@ -2,6 +2,8 @@ import type { FastifyPluginAsyncTypebox } from '@fastify/type-provider-typebox'
|
||||
import * as fs from 'node:fs'
|
||||
import * as path from 'node:path'
|
||||
import { Type } from 'typebox'
|
||||
import { GetAttachmentParamsSchema } from '../plugins/schemas/attachment.ts'
|
||||
import { TypeboxRef } from '../utils/typebox-ref.ts'
|
||||
|
||||
const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
const uploadDir = path.join(process.cwd(), 'uploads')
|
||||
@@ -18,6 +20,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
tags: ['Attachment'],
|
||||
operationId: 'attachment.upload',
|
||||
description: 'Pass file to multipart/form-data',
|
||||
consumes: ['multipart/form-data'],
|
||||
response: {
|
||||
200: Type.String({ format: 'uuid', description: 'Attachment UUID' }),
|
||||
},
|
||||
@@ -62,9 +65,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
summary: 'Get attachment',
|
||||
tags: ['Attachment'],
|
||||
operationId: 'attachment.get',
|
||||
params: Type.Object({
|
||||
id: Type.String({ format: 'uuid' }),
|
||||
}),
|
||||
params: TypeboxRef(GetAttachmentParamsSchema),
|
||||
response: {
|
||||
200: Type.Any({ description: 'Attachment content' }),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user