diff --git a/controllers/categoryController.go b/controllers/categoryController.go index 57aa4c2..46a8958 100644 --- a/controllers/categoryController.go +++ b/controllers/categoryController.go @@ -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) {} diff --git a/models/category.go b/models/category.go index 178e583..c68b366 100644 --- a/models/category.go +++ b/models/category.go @@ -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"`