This commit is contained in:
Tomas Dvorak
2025-10-28 22:38:27 +01:00
parent 3d621e2187
commit 823fabee02
106 changed files with 9011 additions and 3930 deletions
+7
View File
@@ -84,6 +84,13 @@ func SubscribeToNewsletter(db *gorm.DB, email string) error {
subscription := NewsletterSubscription{
Email: email,
IsActive: true,
Preferences: datatypes.JSONMap{
"blogs": true,
"matches": true,
"events": true,
"scores": true,
"weekly": true,
},
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}
+24
View File
@@ -0,0 +1,24 @@
package models
import (
"time"
)
type LinkClick struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
ShortLinkID *uint `gorm:"index" json:"short_link_id"`
TargetURL string `gorm:"size:2048" json:"target_url"`
IPHash string `gorm:"size:64;index" json:"ip_hash"`
UserAgent string `gorm:"size:512" json:"user_agent"`
Referrer string `gorm:"size:512" json:"referrer"`
UTMSource string `gorm:"size:128" json:"utm_source"`
UTMMedium string `gorm:"size:128" json:"utm_medium"`
UTMCampaign string `gorm:"size:128" json:"utm_campaign"`
UTMContent string `gorm:"size:128" json:"utm_content"`
UTMTerm string `gorm:"size:128" json:"utm_term"`
}
func (LinkClick) TableName() string { return "link_clicks" }
+1
View File
@@ -95,6 +95,7 @@ func (n *NavigationItem) GetURL() string {
"prefetch": "/admin/prefetch",
"users": "/admin/uzivatele",
"settings": "/admin/nastaveni",
"shortlinks": "/admin/shortlinks",
"files": "/admin/soubory",
"docs": "/admin/docs",
}
+24
View File
@@ -0,0 +1,24 @@
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" }