Fix bugs in pagination and syntax error in artist search endpoint
This commit is contained in:
parent
0990755643
commit
48bf0df6d4
1 changed files with 3 additions and 3 deletions
|
@ -42,8 +42,8 @@ func paginator() gin.HandlerFunc {
|
|||
page = 1
|
||||
}
|
||||
|
||||
if pageSize < 10 {
|
||||
pageSize = 10
|
||||
if pageSize < 1 {
|
||||
pageSize = 1
|
||||
}
|
||||
|
||||
// Calculate the correct SQL offset for this page
|
||||
|
@ -127,7 +127,7 @@ func (env *Env) getArtistByName(c *gin.Context) {
|
|||
// NOTE: However unicode is treated case sensitive due to very difficult conversions for some languages/characters
|
||||
// NOTE: In future better DBs with unicode support such as postgres should be used
|
||||
var artistProfiles []ArtistProfile
|
||||
searchString := fmt.Sprintf("%%%s%%"), artistName)
|
||||
searchString := fmt.Sprintf("%%%s%%", artistName)
|
||||
dbResult := env.db.Where("name LIKE ?", searchString).Preload("Genres").Offset(pageOffset).Limit(pageSize).Find(&artistProfiles)
|
||||
if dbResult.Error != nil {
|
||||
slog.Error("[GOMUSIC] Failed to query local database for artist name", "Name", artistName)
|
||||
|
|
Loading…
Add table
Reference in a new issue