add category lang,include query params

This commit is contained in:
2026-04-07 10:50:51 +02:00
parent 03a99edf99
commit 25ec23898a
2 changed files with 13 additions and 2 deletions

View File

@@ -23,7 +23,9 @@ type DummyController struct{}
// @Tags category
// @Accept json
// @Produce json
// @Success 200 {array} models.Category
// @Param lang query string false "Language code of language that should be returned. Defaults to 'en'"
// @Param include query string false "Comma-separated related resources to include"
// @Success 200 {array} models.CategoryLocalizedResponse
// @Failure 400 {object} httputil.HTTPError
// @Router /category/ [get]
func (dc *DummyController) ListCategories(c *gin.Context) {}
@@ -44,8 +46,10 @@ func (dc *DummyController) CreateCategory(c *gin.Context) {}
// @Tags category
// @Accept json
// @Produce json
// @Param lang query string false "Language code of language that should be returned. Defaults to 'en'"
// @Param include query string false "Comma-separated related resources to include"
// @Param id path int true "A unique integer value identifying this category."
// @Success 200 {object} models.Category
// @Success 200 {object} models.CategoryLocalizedResponse
// @Failure 400 {object} httputil.HTTPError
// @Router /category/{id} [get]
func (dc *DummyController) RetreiveCategory(c *gin.Context) {}

View File

@@ -20,6 +20,13 @@ type CategoryRequest struct {
Translations []CategoryTranslationRequest `json:"translations" binding:"required"`
}
type CategoryLocalizedResponse struct {
ID uint `json:"id" binding:"required"`
Language string `json:"language" binding:"required"`
Name string `json:"name" binding:"required"`
Translations []CategoryTranslation `json:"translation"`
}
type CategoryTranslationRequest struct {
LanguageID uint `json:"languageId" binding:"required"`
Name string `json:"name" binding:"required"`