add collection sugar

This commit is contained in:
2025-02-06 00:23:12 +01:00
parent 905b488fd4
commit 2791b6de76
8 changed files with 124 additions and 230 deletions

View File

@@ -77,8 +77,13 @@ const docTemplate = `{
"type": "integer",
"description": "Index",
"name": "index",
"in": "query",
"required": true
"in": "query"
},
{
"type": "string",
"description": "Index",
"name": "name",
"in": "query"
}
],
"responses": {
@@ -106,66 +111,6 @@ const docTemplate = `{
}
}
},
"/collections": {
"get": {
"description": "Retrieves collections from the database with pagination based on the query parameter",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"search"
],
"summary": "Retrieves collections based on a query",
"parameters": [
{
"type": "string",
"description": "Search query",
"name": "query",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Limit the number of results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"default": 0,
"description": "Offset for pagination",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "List of collections",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Collection"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/image/{filepath}": {
"get": {
"description": "Retrieves an image file from the server based on the provided encoded filepath",

View File

@@ -71,8 +71,13 @@
"type": "integer",
"description": "Index",
"name": "index",
"in": "query",
"required": true
"in": "query"
},
{
"type": "string",
"description": "Index",
"name": "name",
"in": "query"
}
],
"responses": {
@@ -100,66 +105,6 @@
}
}
},
"/collections": {
"get": {
"description": "Retrieves collections from the database with pagination based on the query parameter",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"search"
],
"summary": "Retrieves collections based on a query",
"parameters": [
{
"type": "string",
"description": "Search query",
"name": "query",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Limit the number of results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"default": 0,
"description": "Offset for pagination",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "List of collections",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Collection"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/image/{filepath}": {
"get": {
"description": "Retrieves an image file from the server based on the provided encoded filepath",

View File

@@ -105,8 +105,11 @@ paths:
- description: Index
in: query
name: index
required: true
type: integer
- description: Index
in: query
name: name
type: string
produces:
- application/json
responses:
@@ -127,47 +130,6 @@ paths:
summary: Get a collection of songs by index
tags:
- songs
/collections:
get:
consumes:
- application/json
description: Retrieves collections from the database with pagination based on
the query parameter
parameters:
- description: Search query
in: query
name: query
type: string
- default: 10
description: Limit the number of results
in: query
name: limit
type: integer
- default: 0
description: Offset for pagination
in: query
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: List of collections
schema:
items:
$ref: '#/definitions/main.Collection'
type: array
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Retrieves collections based on a query
tags:
- search
/image/{filepath}:
get:
consumes: