-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.js
165 lines (162 loc) · 4.78 KB
/
swagger.js
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
const swaggerAutogen = require('swagger-autogen')();
const doc = {
info: {
version: '1.0.0',
title: 'Rest Api Travel',
description:
"Node `API RESTful` - tourism agency specialized in bringing tourists from around the world to visit Brazil's beaches, savannahs and forests",
},
host: 'localhost:3333/',
servers: ['http://localhost:3333/api/docs'],
basePath: 'api/',
schemes: ['http'],
consumes: ['application/json'],
produces: ['application/json'],
tags: [
{
name: 'Coin',
description: 'CRUD operations about coins',
},
{
name: 'CategoryAgent',
description: 'CRUD operations about categories of agents',
},
{
name: 'Customer',
description: 'CRUD operations about categories of agents',
},
{
name: 'Agent',
description: 'CRUD operations about categories of agents',
},
{
name: 'Hotel',
description: 'CRUD operations about categories of agents',
},
{
name: 'Room',
description: 'CRUD operations about categories of agents',
},
{
name: 'Service',
description: 'CRUD operations about categories of agents',
},
{
name: 'HotelCategoryAgent',
description: 'CRUD operations about categories of agents',
},
{
name: 'Offer',
description: 'CRUD operations about categories of agents',
},
],
definitions: {
Coin: {
$name: 'Libra',
$symbol: 'GBP',
$profit: 0.8,
value: 1.9,
},
CategoryAgent: {
$name: 'Agências',
$profit: 0.6,
$active: true,
},
ExchangeProfit: {
$profit: 0.2,
$active: true,
},
Customer: {
$name: 'José',
$surname: 'Bonifácio',
$phone: '85 985426655',
$country: 'Brazil',
address: 'Rua Desembargador Moreira, 1865 - Fortaleza - Ceará',
$coin_id: 1,
dependencie: {
$ref: '#/definitions/Coin',
},
},
Agent: {
$name: 'Agência Fortaleza',
address: 'Rua Desembargador Moreira, 1865 - Fortaleza - Ceará',
$category_agent_id: 1,
dependencie: {
$ref: '#/definitions/CategoryAgent',
},
},
Hotel: {
$name: 'Hotel Vila Mango',
$country: 'Brazil',
details: 'Hotel com 30 anos de história',
address: 'Av.Beira mar, 2356, Ceará',
},
Room: {
$name: 'Quarto vista jardins',
$type: 'DBL',
$hotel_id: 1,
dependencie: {
$ref: '#/definitions/Hotel',
},
},
Service: {
$price: 500,
$hotel_id: 1,
$room_id: 1,
$coin_id: 1,
dependencie1: {
$ref: '#/definitions/Hotel',
},
dependencie2: {
$ref: '#/definitions/Room',
},
dependencie3: {
$ref: '#/definitions/Coin',
},
},
HotelCategoryAgent: {
$profit: 0.3,
$hotel_id: 1,
$category_agent_id: 1,
dependencie1: {
$ref: '#/definitions/Hotel',
},
dependencie2: {
$ref: '#/definitions/CategoryAgent',
},
},
Offer: {
$name: 'Oferta Reveilon',
$checkin: '2022-10-23',
$checkout: '2022-10-25',
$customer_id: 2,
$agent_id: 1,
$service_id: 1,
dependencie1: {
$ref: '#/definitions/Customer',
},
dependencie2: {
$ref: '#/definitions/Agent',
},
dependencie3: {
$ref: '#/definitions/Service',
},
},
Exchange: {
$coin_from: 1,
$coin_to: 2,
$amount_from: 100,
$amount_total: 200,
$customer_id: 1,
dependencie1: {
$ref: '#/definitions/Coin',
},
dependencie2: {
$ref: '#/definitions/Customer',
},
},
},
};
const outputFile = './swagger.json';
const endpointsFiles = ['./src/routes.js'];
swaggerAutogen(outputFile, endpointsFiles, doc).then(() => {});