add count to artist songs

This commit is contained in:
2025-02-06 00:58:49 +01:00
parent 6caefaffb2
commit 2afbf31ed6
6 changed files with 256 additions and 76 deletions

View File

@@ -287,10 +287,7 @@ const docTemplate = `{
"200": {
"description": "List of artists",
"schema": {
"type": "array",
"items": {
"type": "string"
}
"$ref": "#/definitions/main.Artist"
}
},
"400": {
@@ -413,6 +410,52 @@ const docTemplate = `{
}
}
},
"/songs/artist": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"songs"
],
"summary": "Returns all the Songs of a specific Artist",
"parameters": [
{
"type": "string",
"description": "Artist Name",
"name": "artist",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Song"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/songs/favorites": {
"get": {
"description": "Retrieves favorite songs filtered by a query with pagination support.",
@@ -540,6 +583,20 @@ const docTemplate = `{
}
}
},
"main.Artist": {
"description": "Artist holds search results for a given artist",
"type": "object",
"properties": {
"artist": {
"type": "string",
"example": "Miku"
},
"count": {
"type": "integer",
"example": 21
}
}
},
"main.Collection": {
"description": "Collection holds a list of songs",
"type": "object",

View File

@@ -281,10 +281,7 @@
"200": {
"description": "List of artists",
"schema": {
"type": "array",
"items": {
"type": "string"
}
"$ref": "#/definitions/main.Artist"
}
},
"400": {
@@ -407,6 +404,52 @@
}
}
},
"/songs/artist": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"songs"
],
"summary": "Returns all the Songs of a specific Artist",
"parameters": [
{
"type": "string",
"description": "Artist Name",
"name": "artist",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Song"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/songs/favorites": {
"get": {
"description": "Retrieves favorite songs filtered by a query with pagination support.",
@@ -534,6 +577,20 @@
}
}
},
"main.Artist": {
"description": "Artist holds search results for a given artist",
"type": "object",
"properties": {
"artist": {
"type": "string",
"example": "Miku"
},
"count": {
"type": "integer",
"example": 21
}
}
},
"main.Collection": {
"description": "Collection holds a list of songs",
"type": "object",

View File

@@ -11,6 +11,16 @@ definitions:
$ref: '#/definitions/main.Song'
type: array
type: object
main.Artist:
description: Artist holds search results for a given artist
properties:
artist:
example: Miku
type: string
count:
example: 21
type: integer
type: object
main.Collection:
description: Collection holds a list of songs
properties:
@@ -248,9 +258,7 @@ paths:
"200":
description: List of artists
schema:
items:
type: string
type: array
$ref: '#/definitions/main.Artist'
"400":
description: Bad Request
schema:
@@ -332,6 +340,36 @@ paths:
summary: Get a song by its hash
tags:
- songs
/songs/artist:
get:
consumes:
- application/json
parameters:
- description: Artist Name
in: query
name: artist
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/main.Song'
type: array
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Returns all the Songs of a specific Artist
tags:
- songs
/songs/favorites:
get:
consumes: