first commit
This commit is contained in:
22
internal/models/post_category_view.go
Normal file
22
internal/models/post_category_view.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// PostCategoryView tracks visits to post categories.
|
||||
type PostCategoryView struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey" json:"id"`
|
||||
CategoryID uuid.UUID `gorm:"not null;index:idx_post_category_views,priority:1" json:"category_id"`
|
||||
Category PostCategory `gorm:"foreignKey:CategoryID" json:"category"`
|
||||
IPAddress string `gorm:"type:varchar(64);not null;index:idx_post_category_views,priority:2" json:"ip_address"`
|
||||
UserAgent string `gorm:"type:text" json:"user_agent,omitempty"`
|
||||
CreatedAt time.Time `gorm:"index:idx_post_category_views,priority:3" json:"created_at"`
|
||||
}
|
||||
|
||||
// TableName overrides the table name used by PostCategoryView.
|
||||
func (PostCategoryView) TableName() string {
|
||||
return "post_category_views"
|
||||
}
|
||||
Reference in New Issue
Block a user