Files
atahango/internal/models/post_category_view.go
Beyhan Oğur bbbf76b184 first commit
2026-04-26 21:35:24 +03:00

23 lines
842 B
Go

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"
}