Files
MyClub/internal/models/short_link.go
T
Tomas Dvorak 823fabee02 de day #74
2025-10-28 22:38:27 +01:00

25 lines
993 B
Go

package models
import (
"time"
"gorm.io/datatypes"
)
type ShortLink struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Code string `gorm:"size:16;uniqueIndex" json:"code"`
TargetURL string `gorm:"size:2048" json:"target_url"`
Title string `gorm:"size:512" json:"title"`
SourceType string `gorm:"size:32;index" json:"source_type"`
SourceID *uint `gorm:"index" json:"source_id"`
Active bool `gorm:"default:true" json:"active"`
ExpiresAt *time.Time `gorm:"index" json:"expires_at"`
ClickCount int64 `gorm:"default:0" json:"click_count"`
CreatedByID *uint `gorm:"index" json:"created_by_id"`
Metadata datatypes.JSONMap `gorm:"type:jsonb" json:"metadata"`
}
func (ShortLink) TableName() string { return "short_links" }