-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathswagger.ts
More file actions
75 lines (75 loc) · 2.18 KB
/
swagger.ts
File metadata and controls
75 lines (75 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { createSwaggerSpec } from 'next-swagger-doc';
export const swaggerOptions = {
definition: {
openapi: '3.0.0',
info: {
title: 'Next.js API Documentation',
version: '1.0.0',
description: 'API documentation for the application endpoints',
},
servers: [
{
url: process.env.NEXT_PUBLIC_API_URL || 'https://pointblank.club',
description: 'Production server',
},
{
url: process.env.NEXT_PUBLIC_STAGING_URL || 'https://staging--pbpage.netlify.app',
description: 'Staging server',
},
{
url: 'http://localhost:3000',
description: 'Development server',
}
],
tags: [
{ name: 'Achievements', description: 'Achievements management endpoints' },
{ name: 'Credits', description: 'Credit management endpoints' },
{ name: 'Events', description: 'Event management endpoints' },
{ name: 'Hustle', description: 'Hustle and leaderboard related endpoints' },
{ name: 'Leads', description: 'Lead management endpoints' },
{ name: 'Members', description: 'Member data management endpoints' },
{ name: 'Registration', description: 'Registration related endpoints' },
],
components: {
schemas: {
Error: {
type: 'object',
properties: {
message: { type: 'string' },
},
},
Success: {
type: 'object',
properties: {
message: { type: 'string' },
data: { type: 'object' },
},
},
},
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
},
},
},
security: [
{
bearerAuth: [],
},
],
},
apis: [
'./app/(default)/api/achievements/route.ts',
'./app/(default)/api/credits/**/route.ts',
'./app/(default)/api/events/route.ts',
'./app/(default)/api/hustle/**/route.ts',
'./app/(default)/api/leads/**/route.ts',
'./app/(default)/api/membersData/**/route.ts',
'./app/(default)/api/registration/**/route.ts',
],
};
export const getApiDocs = async () => {
return createSwaggerSpec(swaggerOptions);
};