Add language to inventaire search book

This commit is contained in:
2026-01-22 13:37:42 +01:00
parent 8d3569e5d6
commit 7921a83f30
6 changed files with 33 additions and 9 deletions

View File

@@ -12,9 +12,18 @@ import (
"github.com/gin-gonic/gin"
)
type bookGetSearch struct {
Lang string `form:"lang" binding:"max=5"`
}
func GetSearchBooksHandler(ac appcontext.AppContext) {
searchterm := ac.C.Param("searchterm")
var params bookGetSearch
err := ac.C.ShouldBind(&params)
if err != nil {
myvalidator.ReturnErrorsAsJsonResponse(&ac, err)
return
}
user, fetchUserErr := ac.GetAuthenticatedUser()
if fetchUserErr != nil {
myvalidator.ReturnErrorsAsJsonResponse(&ac, fetchUserErr)
@@ -40,7 +49,7 @@ func GetSearchBooksHandler(ac appcontext.AppContext) {
if len(books) > 0 {
returnedBooks = books
} else {
queryResult, err := inventaire.CallInventaireSearch(searchterm, limit, offset)
queryResult, err := inventaire.CallInventaireSearch(searchterm, params.Lang, limit, offset)
if err != nil {
myvalidator.ReturnErrorsAsJsonResponse(&ac, err)
return