работаем бля работаем
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { FastifyPluginAsyncTypebox } from '@fastify/type-provider-typebox'
|
||||
import bcrypt from 'bcrypt'
|
||||
import { Type } from 'typebox'
|
||||
import { CreateUserSchema, UserSchema } from '../schemas/auth.ts'
|
||||
import { CreateUserPayloadSchema, LoginPayloadSchema, UserSchema } from '../plugins/schemas/auth.ts'
|
||||
import { TypeboxRef } from '../utils/typebox-ref.ts'
|
||||
|
||||
const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
fastify.post(
|
||||
@@ -11,9 +11,9 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
summary: 'Register',
|
||||
tags: ['Auth'],
|
||||
operationId: 'auth.register',
|
||||
body: CreateUserSchema,
|
||||
body: TypeboxRef(CreateUserPayloadSchema),
|
||||
response: {
|
||||
200: UserSchema,
|
||||
200: TypeboxRef(UserSchema),
|
||||
},
|
||||
},
|
||||
config: {
|
||||
@@ -54,12 +54,9 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
summary: 'Login',
|
||||
tags: ['Auth'],
|
||||
operationId: 'auth.login',
|
||||
body: Type.Object({
|
||||
username: Type.String({ minLength: 1 }),
|
||||
password: Type.String({ minLength: 1 }),
|
||||
}),
|
||||
body: TypeboxRef(LoginPayloadSchema),
|
||||
response: {
|
||||
200: UserSchema,
|
||||
200: TypeboxRef(UserSchema),
|
||||
},
|
||||
},
|
||||
config: {
|
||||
@@ -107,7 +104,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
tags: ['Auth'],
|
||||
operationId: 'auth.me',
|
||||
response: {
|
||||
200: UserSchema,
|
||||
200: TypeboxRef(UserSchema),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user