add category api docs
This commit is contained in:
26
models/category.go
Normal file
26
models/category.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Category struct {
|
||||
gorm.Model
|
||||
Translations []CategoryTranslation `gorm:"foreignKey:CategoryID"`
|
||||
}
|
||||
|
||||
type CategoryTranslation struct {
|
||||
gorm.Model
|
||||
CategoryID uint `gorm:"uniqueIndex:idx_post_language"`
|
||||
LanguageID uint `gorm:"uniqueIndex:idx_post_language"`
|
||||
Name string
|
||||
}
|
||||
|
||||
type CategoryRequest struct {
|
||||
Translations []CategoryTranslationRequest `json:"translations" binding:"required"`
|
||||
}
|
||||
|
||||
type CategoryTranslationRequest struct {
|
||||
LanguageID uint `json:"languageId" binding:"required"`
|
||||
Name string `json:"name" binding:"required"`
|
||||
}
|
||||
Reference in New Issue
Block a user