feat: expanded search for items (#46)

* expanded search for items

* range domain from email to example

* implement pagination for items
This commit is contained in:
Hayden 2022-10-12 21:13:07 -08:00 committed by GitHub
parent 1b20a69c5e
commit 30014a77ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 751 additions and 346 deletions

View file

@ -70,26 +70,51 @@ const docTemplate = `{
"Items"
],
"summary": "Get All Items",
"parameters": [
{
"type": "string",
"description": "search string",
"name": "q",
"in": "query"
},
{
"type": "integer",
"description": "page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "items per page",
"name": "pageSize",
"in": "query"
},
{
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi",
"description": "label Ids",
"name": "labels",
"in": "query"
},
{
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi",
"description": "location Ids",
"name": "locations",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.ItemSummary"
}
}
}
}
]
"$ref": "#/definitions/repo.PaginationResult-repo_ItemSummary"
}
}
}
@ -153,7 +178,7 @@ const docTemplate = `{
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -254,7 +279,7 @@ const docTemplate = `{
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -354,7 +379,7 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": ""
"description": "OK"
}
}
}
@ -470,7 +495,7 @@ const docTemplate = `{
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -634,7 +659,7 @@ const docTemplate = `{
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -798,7 +823,7 @@ const docTemplate = `{
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -846,7 +871,7 @@ const docTemplate = `{
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -903,7 +928,7 @@ const docTemplate = `{
"summary": "User Logout",
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -922,7 +947,7 @@ const docTemplate = `{
"summary": "User Token Refresh",
"responses": {
"200": {
"description": ""
"description": "OK"
}
}
}
@ -949,7 +974,7 @@ const docTemplate = `{
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -1049,7 +1074,7 @@ const docTemplate = `{
"summary": "Deletes the user account",
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -1070,7 +1095,7 @@ const docTemplate = `{
"summary": "Update the current user's password // TODO:",
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -1488,6 +1513,26 @@ const docTemplate = `{
}
}
},
"repo.PaginationResult-repo_ItemSummary": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.ItemSummary"
}
},
"page": {
"type": "integer"
},
"pageSize": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"repo.UserOut": {
"type": "object",
"properties": {
@ -1541,9 +1586,7 @@ const docTemplate = `{
"server.Results": {
"type": "object",
"properties": {
"items": {
"type": "any"
}
"items": {}
}
},
"server.ValidationError": {

View file

@ -62,26 +62,51 @@
"Items"
],
"summary": "Get All Items",
"parameters": [
{
"type": "string",
"description": "search string",
"name": "q",
"in": "query"
},
{
"type": "integer",
"description": "page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "items per page",
"name": "pageSize",
"in": "query"
},
{
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi",
"description": "label Ids",
"name": "labels",
"in": "query"
},
{
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi",
"description": "location Ids",
"name": "locations",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.ItemSummary"
}
}
}
}
]
"$ref": "#/definitions/repo.PaginationResult-repo_ItemSummary"
}
}
}
@ -145,7 +170,7 @@
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -246,7 +271,7 @@
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -346,7 +371,7 @@
],
"responses": {
"200": {
"description": ""
"description": "OK"
}
}
}
@ -462,7 +487,7 @@
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -626,7 +651,7 @@
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -790,7 +815,7 @@
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -838,7 +863,7 @@
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -895,7 +920,7 @@
"summary": "User Logout",
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -914,7 +939,7 @@
"summary": "User Token Refresh",
"responses": {
"200": {
"description": ""
"description": "OK"
}
}
}
@ -941,7 +966,7 @@
],
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -1041,7 +1066,7 @@
"summary": "Deletes the user account",
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -1062,7 +1087,7 @@
"summary": "Update the current user's password // TODO:",
"responses": {
"204": {
"description": ""
"description": "No Content"
}
}
}
@ -1480,6 +1505,26 @@
}
}
},
"repo.PaginationResult-repo_ItemSummary": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.ItemSummary"
}
},
"page": {
"type": "integer"
},
"pageSize": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"repo.UserOut": {
"type": "object",
"properties": {
@ -1533,9 +1578,7 @@
"server.Results": {
"type": "object",
"properties": {
"items": {
"type": "any"
}
"items": {}
}
},
"server.ValidationError": {

View file

@ -275,6 +275,19 @@ definitions:
updatedAt:
type: string
type: object
repo.PaginationResult-repo_ItemSummary:
properties:
items:
items:
$ref: '#/definitions/repo.ItemSummary'
type: array
page:
type: integer
pageSize:
type: integer
total:
type: integer
type: object
repo.UserOut:
properties:
email:
@ -310,8 +323,7 @@ definitions:
type: object
server.Results:
properties:
items:
type: any
items: {}
type: object
server.ValidationError:
properties:
@ -426,20 +438,40 @@ paths:
- User
/v1/items:
get:
parameters:
- description: search string
in: query
name: q
type: string
- description: page number
in: query
name: page
type: integer
- description: items per page
in: query
name: pageSize
type: integer
- collectionFormat: multi
description: label Ids
in: query
items:
type: string
name: labels
type: array
- collectionFormat: multi
description: location Ids
in: query
items:
type: string
name: locations
type: array
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/server.Results'
- properties:
items:
items:
$ref: '#/definitions/repo.ItemSummary'
type: array
type: object
$ref: '#/definitions/repo.PaginationResult-repo_ItemSummary'
security:
- Bearer: []
summary: Get All Items
@ -477,7 +509,7 @@ paths:
- application/json
responses:
"204":
description: ""
description: No Content
security:
- Bearer: []
summary: deletes a item
@ -583,7 +615,7 @@ paths:
type: string
responses:
"204":
description: ""
description: No Content
security:
- Bearer: []
summary: retrieves an attachment for an item
@ -658,7 +690,7 @@ paths:
- application/octet-stream
responses:
"200":
description: ""
description: OK
security:
- Bearer: []
summary: retrieves an attachment for an item
@ -676,7 +708,7 @@ paths:
- application/json
responses:
"204":
description: ""
description: No Content
security:
- Bearer: []
summary: imports items into the database
@ -735,7 +767,7 @@ paths:
- application/json
responses:
"204":
description: ""
description: No Content
security:
- Bearer: []
summary: deletes a label
@ -832,7 +864,7 @@ paths:
- application/json
responses:
"204":
description: ""
description: No Content
security:
- Bearer: []
summary: deletes a location
@ -899,7 +931,7 @@ paths:
$ref: '#/definitions/v1.ChangePassword'
responses:
"204":
description: ""
description: No Content
security:
- Bearer: []
summary: Updates the users password
@ -935,7 +967,7 @@ paths:
post:
responses:
"204":
description: ""
description: No Content
security:
- Bearer: []
summary: User Logout
@ -948,7 +980,7 @@ paths:
This does not validate that the user still exists within the database.
responses:
"200":
description: ""
description: OK
security:
- Bearer: []
summary: User Token Refresh
@ -967,7 +999,7 @@ paths:
- application/json
responses:
"204":
description: ""
description: No Content
summary: Get the current user
tags:
- User
@ -977,7 +1009,7 @@ paths:
- application/json
responses:
"204":
description: ""
description: No Content
security:
- Bearer: []
summary: Deletes the user account
@ -1032,7 +1064,7 @@ paths:
- application/json
responses:
"204":
description: ""
description: No Content
security:
- Bearer: []
summary: 'Update the current user''s password // TODO:'