feat(api): add swagger docs, /api/user/me GET and PUT endpoints
This commit is contained in:
parent
98776aacb2
commit
c5ca2d56ac
10 changed files with 2976 additions and 261 deletions
50
src/lib/swagger.ts
Normal file
50
src/lib/swagger.ts
Normal 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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue