Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NM-59: full text search #60

Merged
merged 9 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ on:
pull_request:
branches:
- main
- develop
- dev
- NM-*
push:
branches:
- main
- dev
- NM-*

jobs:
lint:
Expand Down
238 changes: 120 additions & 118 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ const docTemplate = `{
},
"/api/v1/albums/search": {
"get": {
"description": "Searches for albums based on the provided \"name\" query parameter.",
"summary": "Search albums by name",
"description": "Searches for albums based on the provided \"query\" query parameter.",
"summary": "Search albums by query",
"parameters": [
{
"type": "string",
"description": "Name of the album to search for",
"name": "name",
"name": "query",
"in": "query",
"required": true
}
Expand Down Expand Up @@ -198,13 +198,13 @@ const docTemplate = `{
},
"/api/v1/artists/search": {
"get": {
"description": "Searches for artists based on the provided \"name\" query parameter.",
"summary": "Search artists by name",
"description": "Searches for artists based on the provided \"query\" parameter.",
"summary": "Search artists by query",
"parameters": [
{
"type": "string",
"description": "Name of the artist to search for",
"name": "name",
"name": "query",
"in": "query",
"required": true
}
Expand Down Expand Up @@ -323,17 +323,6 @@ const docTemplate = `{
"Authentication"
],
"summary": "User Login",
"parameters": [
{
"description": "User login details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.User"
}
}
],
"responses": {
"200": {
"description": "Login successful with token",
Expand Down Expand Up @@ -398,17 +387,6 @@ const docTemplate = `{
"Authentication"
],
"summary": "Register a new user",
"parameters": [
{
"description": "User registration details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.User"
}
}
],
"responses": {
"200": {
"description": "User registration successful with token",
Expand All @@ -431,44 +409,6 @@ const docTemplate = `{
}
}
},
"/api/v1/genres/album/{albumID}": {
"get": {
"description": "Retrieves a list of all genres for a given album ID from the database.",
"summary": "Get all genres by album ID",
"parameters": [
{
"type": "integer",
"description": "Album ID",
"name": "albumID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "List of genres by album",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.GenreDTO"
}
}
},
"404": {
"description": "No genres found for the album",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
},
"500": {
"description": "Failed to load genres",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
}
}
}
},
"/api/v1/genres/all": {
"get": {
"description": "Retrieves a list of all genres from the database.",
Expand Down Expand Up @@ -619,35 +559,132 @@ const docTemplate = `{
},
"/api/v1/tracks/byArtistId/{artistId}": {
"get": {
"description": "Retrieves a list of all tracks for a given artist ID.",
"summary": "Get all tracks by artist ID",
"description": "Retrieves a list of favorite tracks for the user.",
"summary": "Get favorite tracks",
"responses": {
"200": {
"description": "List of favorite tracks",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.TrackDTO"
}
}
},
"404": {
"description": "User id not found",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
},
"500": {
"description": "Failed to get favorite tracks",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
}
}
}
},
"/api/v1/tracks/favorite": {
"post": {
"description": "Add new favorite track for user.",
"summary": "Add favorite track for user",
"parameters": [
{
"type": "integer",
"description": "Artist ID",
"name": "artistId",
"description": "Track ID",
"name": "trackID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "List of tracks by artist",
"description": "OK"
},
"404": {
"description": "User id not found",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.TrackDTO"
"$ref": "#/definitions/utils.ErrorResponse"
}
},
"500": {
"description": "Can't add track to favorite",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
}
}
},
"delete": {
"description": "Add new favorite track for user.",
"summary": "Add favorite track for user",
"parameters": [
{
"type": "integer",
"description": "Track ID",
"name": "trackID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "User id not found",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
},
"500": {
"description": "Can't delete track from favorite",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
}
}
}
},
"/api/v1/tracks/favorite/{trackID}": {
"get": {
"description": "Checks if a specific track is marked as a favorite for the authenticated user.",
"summary": "Check if a track is a user's favorite",
"parameters": [
{
"type": "integer",
"description": "Track ID",
"name": "trackID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Response indicating whether the track is a favorite",
"schema": {
"type": "object",
"additionalProperties": {
"type": "boolean"
}
}
},
"400": {
"description": "Invalid track ID or user ID",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
},
"404": {
"description": "No tracks found for the given artist ID",
"description": "Track ID not found",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
},
"500": {
"description": "Failed to load tracks by artist ID",
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
Expand All @@ -657,13 +694,13 @@ const docTemplate = `{
},
"/api/v1/tracks/search": {
"get": {
"description": "Searches for tracks based on the provided \"name\" query parameter.",
"summary": "Search tracks by name",
"description": "Searches for tracks based on the provided \"query\" query parameter.",
"summary": "Search tracks by query",
"parameters": [
{
"type": "string",
"description": "Name of the track to search for",
"name": "name",
"description": "Query of the track to search for",
"name": "query",
"in": "query",
"required": true
}
Expand Down Expand Up @@ -792,15 +829,6 @@ const docTemplate = `{
"name": "user_id",
"in": "path",
"required": true
},
{
"description": "Updated user details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.User"
}
}
],
"responses": {
Expand Down Expand Up @@ -1029,6 +1057,9 @@ const docTemplate = `{
"filepath": {
"type": "string"
},
"id": {
"type": "integer"
},
"image": {
"type": "string"
},
Expand Down Expand Up @@ -1068,35 +1099,6 @@ const docTemplate = `{
}
}
},
"models.User": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"email": {
"type": "string"
},
"image": {
"type": "string"
},
"password": {
"type": "string"
},
"role": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"userID": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"utils.ErrorResponse": {
"type": "object",
"properties": {
Expand Down
Loading