feat(api): add swagger docs, /api/user/me GET and PUT endpoints

This commit is contained in:
Dominik 2025-06-11 22:43:37 +02:00
parent 98776aacb2
commit c5ca2d56ac
Signed by: dominik
GPG key ID: 06A4003FC5049644
10 changed files with 2976 additions and 261 deletions

50
src/lib/swagger.ts Normal file
View file

@ -0,0 +1,50 @@
import { createSwaggerSpec } from 'next-swagger-doc';
export const getApiDocs = async () => {
const spec = createSwaggerSpec({
apiFolder: 'src/app/api',
definition: {
openapi: '3.0.0',
info: {
title: 'MeetUP API',
version: '1.0',
},
// components: {
// securitySchemes: {
// BearerAuth: {
// type: "http",
// scheme: "bearer",
// bearerFormat: "JWT",
// },
// },
// },
components:{
schemas: {
ErrorResponse: {
type: 'object',
properties: {
message: {
type: 'string',
description: 'Error message',
},
},
},
User: {
type: 'object',
properties: {
id: { type: 'string', format: 'uuid' },
name: { type: 'string' },
first_name: { type: 'string' },
last_name: { type: 'string' },
email: { type: 'string', format: 'email' },
image: { type: 'string', format: 'uri' },
timezone: { type: 'string', description: 'User timezone' },
},
},
},
},
security: [],
},
});
return spec;
};