first commit
This commit is contained in:
96
database/models/docs_models.go
Normal file
96
database/models/docs_models.go
Normal file
@@ -0,0 +1,96 @@
|
||||
package models
|
||||
|
||||
// Swagger-friendly (light) structs for documentation only.
|
||||
// These avoid embedding external types (gorm.Model) so `swag` can parse them.
|
||||
|
||||
type CategoryDoc struct {
|
||||
ID uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description,omitempty"`
|
||||
ParentID *uint `json:"parent_id,omitempty"`
|
||||
Children []CategoryDoc `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
type TagDoc struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type PostDoc struct {
|
||||
ID uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content,omitempty"`
|
||||
Images []string `json:"images,omitempty"`
|
||||
Categories []CategoryDoc `json:"categories,omitempty"`
|
||||
Tags []TagDoc `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
type CommentDoc struct {
|
||||
ID uint `json:"id"`
|
||||
UserID uint `json:"user_id"`
|
||||
PostID uint `json:"post_id"`
|
||||
Body string `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
type CategoryViewDoc struct {
|
||||
ID uint `json:"id"`
|
||||
CategoryID uint `json:"category_id"`
|
||||
IPAddress string `json:"ip_address,omitempty"`
|
||||
}
|
||||
|
||||
type ProductCategoryDoc struct {
|
||||
ID uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Keywords string `json:"keywords,omitempty"`
|
||||
ParentID *uint `json:"parent_id,omitempty"`
|
||||
Children []ProductCategoryDoc `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
type ProductTagDoc struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ProductDoc struct {
|
||||
ID uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Images string `json:"images"`
|
||||
Price float64 `json:"price"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
Quality int `json:"quality"`
|
||||
Format string `json:"format"`
|
||||
Content string `json:"content,omitempty"`
|
||||
Slug string `json:"slug"`
|
||||
Categories []ProductCategoryDoc `json:"categories,omitempty"`
|
||||
Tags []ProductTagDoc `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
type CartItemDoc struct {
|
||||
ID uint `json:"id"`
|
||||
CartID uint `json:"cart_id"`
|
||||
ProductID uint `json:"product_id"`
|
||||
Product ProductDoc `json:"product,omitempty"`
|
||||
Quantity int `json:"quantity"`
|
||||
}
|
||||
|
||||
type CartDoc struct {
|
||||
ID uint `json:"id"`
|
||||
UserID uint `json:"user_id"`
|
||||
Items []CartItemDoc `json:"items,omitempty"`
|
||||
}
|
||||
|
||||
type ProductCommentDoc struct {
|
||||
ID uint `json:"id"`
|
||||
UserID uint `json:"user_id"`
|
||||
ProductID uint `json:"product_id"`
|
||||
Body string `json:"body"`
|
||||
}
|
||||
|
||||
type ProductCategoryViewDoc struct {
|
||||
ID uint `json:"id"`
|
||||
CategoryID uint `json:"category_id"`
|
||||
IPAddress string `json:"ip_address,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user