first commit
This commit is contained in:
137
app/controllers/swagger_models.go
Normal file
137
app/controllers/swagger_models.go
Normal file
@@ -0,0 +1,137 @@
|
||||
package controllers
|
||||
|
||||
import "time"
|
||||
|
||||
// Note: these structs are only used for Swagger documentation generation.
|
||||
// They intentionally avoid embedding gorm.Model to keep swag parser happy.
|
||||
|
||||
type CategorySimple struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
Title string `json:"title" example:"News"`
|
||||
Slug string `json:"slug" example:"news"`
|
||||
ParentID *uint `json:"parent_id,omitempty"`
|
||||
}
|
||||
|
||||
// AdminCategoryListItem admin listesinde deleted_at ile ayırt etmek için
|
||||
type AdminCategoryListItem struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
Title string `json:"title" example:"News"`
|
||||
Slug string `json:"slug" example:"news"`
|
||||
ParentID *uint `json:"parent_id,omitempty"`
|
||||
DeletedAt *time.Time `json:"deleted_at,omitempty"`
|
||||
}
|
||||
|
||||
type TagSimple struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
Name string `json:"name" example:"golang"`
|
||||
}
|
||||
|
||||
// AdminTagListItem admin listesinde deleted_at ile ayırt etmek için
|
||||
type AdminTagListItem struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
Name string `json:"name" example:"golang"`
|
||||
DeletedAt *time.Time `json:"deleted_at,omitempty"`
|
||||
}
|
||||
|
||||
type PostResponse struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
Title string `json:"title" example:"My post title"`
|
||||
Slug string `json:"slug" example:"my-post-title"`
|
||||
Images string `json:"images"`
|
||||
Content string `json:"content"`
|
||||
Categories []CategorySimple `json:"categories,omitempty"`
|
||||
Tags []TagSimple `json:"tags,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type PostListResponse struct {
|
||||
Items []PostResponse `json:"items"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PerPage int `json:"per_page"`
|
||||
}
|
||||
|
||||
// New swagger-only types
|
||||
type CommentSimple struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
UserID uint `json:"user_id" example:"2"`
|
||||
PostID uint `json:"post_id" example:"1"`
|
||||
Body string `json:"body" example:"Nice post"`
|
||||
Created time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type CategoryViewSimple struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
CategoryID uint `json:"category_id" example:"1"`
|
||||
IPAddress string `json:"ip_address" example:"127.0.0.1"`
|
||||
Created time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// Setting swagger-only types
|
||||
type SettingResponse struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
Title string `json:"title" example:"Site Başlığı"`
|
||||
MetaTitle string `json:"meta_title" example:"Meta Başlık"`
|
||||
MetaDescription string `json:"meta_description" example:"Site açıklaması"`
|
||||
Phone string `json:"phone" example:" +90 555 555 55 55"`
|
||||
URL string `json:"url" example:"https://example.com"`
|
||||
Email string `json:"email" example:"info@example.com"`
|
||||
Facebook string `json:"facebook" example:"https://facebook.com/example"`
|
||||
X string `json:"x" example:"https://x.com/example"`
|
||||
Instagram string `json:"instagram" example:"https://instagram.com/example"`
|
||||
Whatsapp string `json:"whatsapp" example:"https://wa.me/90555"`
|
||||
Pinterest string `json:"pinterest" example:"https://pinterest.com/example"`
|
||||
Linkedin string `json:"linkedin" example:"https://linkedin.com/company/example"`
|
||||
Slogan string `json:"slogan" example:"En iyi içerik"`
|
||||
Address string `json:"address" example:"Adres örneği"`
|
||||
Copyright string `json:"copyright" example:"© 2026 Example"`
|
||||
MapEmbed string `json:"map_embed"`
|
||||
WLogo string `json:"w_logo"`
|
||||
BLogo string `json:"b_logo"`
|
||||
IsActive bool `json:"is_active"`
|
||||
// image transform / metadata fields (match app/database/models/setting.go)
|
||||
WWidth int `json:"w_width"`
|
||||
WHeight int `json:"w_height"`
|
||||
WQuality int `json:"w_quality"`
|
||||
WFormat string `json:"w_format"`
|
||||
BWidth int `json:"b_width"`
|
||||
BHeight int `json:"b_height"`
|
||||
BQuality int `json:"b_quality"`
|
||||
BFormat string `json:"b_format"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type SettingListResponse struct {
|
||||
Items []SettingResponse `json:"items"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PerPage int `json:"per_page"`
|
||||
}
|
||||
|
||||
// Hero swagger-only types
|
||||
type HeroResponse struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
Color string `json:"color" example:"#ffffff"`
|
||||
Title string `json:"title" example:"Hero Başlık"`
|
||||
Text1 string `json:"text1" example:"Kısa açıklama"`
|
||||
Text2 string `json:"text2" example:"İkinci metin"`
|
||||
Text4 string `json:"text4" example:"Yardımcı metin"`
|
||||
Text5 string `json:"text5" example:"Ek metin"`
|
||||
Image string `json:"image" example:"/uploads/heroes/img.jpg"`
|
||||
IsActive bool `json:"is_active"`
|
||||
Width int `json:"width" example:"1920"`
|
||||
Height int `json:"height" example:"1080"`
|
||||
Quality int `json:"quality" example:"80"`
|
||||
Format string `json:"format" example:"jpeg"`
|
||||
Created time.Time `json:"created_at"`
|
||||
Updated time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type HeroListResponse struct {
|
||||
Items []HeroResponse `json:"items"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PerPage int `json:"per_page"`
|
||||
}
|
||||
Reference in New Issue
Block a user