работаем бля работаем

This commit is contained in:
2026-05-09 03:21:44 +06:00
parent f845777bac
commit 0b148c6a7d
169 changed files with 15816 additions and 1005 deletions

View File

@@ -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),
},
},
},