Skip to content

Commit 446963f

Browse files
committed
- improves search logic
1 parent a3479bc commit 446963f

File tree

8 files changed

+232
-108
lines changed

8 files changed

+232
-108
lines changed

docs/docs.go

Lines changed: 79 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,54 @@ const docTemplate = `{
3939
"summary": "Searches for games using Manticore engine",
4040
"parameters": [
4141
{
42-
"description": "Account ID",
42+
"description": "Request body",
4343
"name": "query",
4444
"in": "body",
4545
"required": true,
4646
"schema": {
47-
"$ref": "#/definitions/schema.GameSearchRequestDto"
47+
"$ref": "#/definitions/games.GameSearchRequestDto"
4848
}
4949
}
5050
],
5151
"responses": {
5252
"200": {
5353
"description": "OK",
5454
"schema": {
55-
"$ref": "#/definitions/schema.GameSearchResponseDto"
55+
"$ref": "#/definitions/games.GameSearchResponseDto"
56+
}
57+
}
58+
}
59+
}
60+
},
61+
"/search/games/autocomplete": {
62+
"post": {
63+
"description": "Returns a parsed search response from the Manticore engine",
64+
"consumes": [
65+
"application/json"
66+
],
67+
"produces": [
68+
"application/json"
69+
],
70+
"tags": [
71+
"search"
72+
],
73+
"summary": "Autocomplete games names using Manticore engine",
74+
"parameters": [
75+
{
76+
"description": "Request body",
77+
"name": "query",
78+
"in": "body",
79+
"required": true,
80+
"schema": {
81+
"$ref": "#/definitions/games.GameSearchRequestDto"
82+
}
83+
}
84+
],
85+
"responses": {
86+
"200": {
87+
"description": "OK",
88+
"schema": {
89+
"$ref": "#/definitions/games.GameAutocompleteResponseDto"
5690
}
5791
}
5892
}
@@ -78,23 +112,37 @@ const docTemplate = `{
78112
"in": "body",
79113
"required": true,
80114
"schema": {
81-
"$ref": "#/definitions/schema.UserSearchRequestDto"
115+
"$ref": "#/definitions/users.UserSearchRequestDto"
82116
}
83117
}
84118
],
85119
"responses": {
86120
"200": {
87121
"description": "OK",
88122
"schema": {
89-
"$ref": "#/definitions/schema.UserSearchResponseDto"
123+
"$ref": "#/definitions/users.UserSearchResponseDto"
90124
}
91125
}
92126
}
93127
}
94128
}
95129
},
96130
"definitions": {
97-
"schema.GameSearchRequestDto": {
131+
"games.GameAutocompleteResponseDto": {
132+
"type": "object",
133+
"properties": {
134+
"data": {
135+
"type": "array",
136+
"items": {
137+
"type": "string"
138+
}
139+
},
140+
"total": {
141+
"type": "integer"
142+
}
143+
}
144+
},
145+
"games.GameSearchRequestDto": {
98146
"type": "object",
99147
"properties": {
100148
"category": {
@@ -141,38 +189,24 @@ const docTemplate = `{
141189
}
142190
}
143191
},
144-
"schema.GameSearchResponseDto": {
192+
"games.GameSearchResponseDto": {
145193
"type": "object",
146194
"properties": {
147195
"data": {
148-
"$ref": "#/definitions/schema.ResponseData"
196+
"$ref": "#/definitions/games.ResponseData"
149197
},
150198
"pagination": {
151199
"$ref": "#/definitions/schema.PaginationInfo"
152200
}
153201
}
154202
},
155-
"schema.PaginationInfo": {
156-
"type": "object",
157-
"properties": {
158-
"hasNextPage": {
159-
"type": "boolean"
160-
},
161-
"totalItems": {
162-
"type": "integer"
163-
},
164-
"totalPages": {
165-
"type": "integer"
166-
}
167-
}
168-
},
169-
"schema.ResponseData": {
203+
"games.ResponseData": {
170204
"type": "object",
171205
"properties": {
172206
"items": {
173207
"type": "array",
174208
"items": {
175-
"$ref": "#/definitions/schema.SearchGame"
209+
"$ref": "#/definitions/games.SearchGame"
176210
}
177211
},
178212
"profile": {
@@ -184,7 +218,7 @@ const docTemplate = `{
184218
}
185219
}
186220
},
187-
"schema.SearchGame": {
221+
"games.SearchGame": {
188222
"type": "object",
189223
"properties": {
190224
"aggregatedRating": {
@@ -255,7 +289,21 @@ const docTemplate = `{
255289
}
256290
}
257291
},
258-
"schema.UserDto": {
292+
"schema.PaginationInfo": {
293+
"type": "object",
294+
"properties": {
295+
"hasNextPage": {
296+
"type": "boolean"
297+
},
298+
"totalItems": {
299+
"type": "integer"
300+
},
301+
"totalPages": {
302+
"type": "integer"
303+
}
304+
}
305+
},
306+
"users.UserDto": {
259307
"type": "object",
260308
"properties": {
261309
"userId": {
@@ -266,7 +314,7 @@ const docTemplate = `{
266314
}
267315
}
268316
},
269-
"schema.UserSearchRequestDto": {
317+
"users.UserSearchRequestDto": {
270318
"type": "object",
271319
"properties": {
272320
"limit": {
@@ -280,13 +328,13 @@ const docTemplate = `{
280328
}
281329
}
282330
},
283-
"schema.UserSearchResponseData": {
331+
"users.UserSearchResponseData": {
284332
"type": "object",
285333
"properties": {
286334
"items": {
287335
"type": "array",
288336
"items": {
289-
"$ref": "#/definitions/schema.UserDto"
337+
"$ref": "#/definitions/users.UserDto"
290338
}
291339
},
292340
"profile": {
@@ -298,11 +346,11 @@ const docTemplate = `{
298346
}
299347
}
300348
},
301-
"schema.UserSearchResponseDto": {
349+
"users.UserSearchResponseDto": {
302350
"type": "object",
303351
"properties": {
304352
"data": {
305-
"$ref": "#/definitions/schema.UserSearchResponseData"
353+
"$ref": "#/definitions/users.UserSearchResponseData"
306354
},
307355
"pagination": {
308356
"$ref": "#/definitions/schema.PaginationInfo"

0 commit comments

Comments
 (0)