mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 10:42:57 +00:00
de day #74
This commit is contained in:
@@ -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(),
|
||||
}
|
||||
|
||||
@@ -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" }
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
@@ -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" }
|
||||
Reference in New Issue
Block a user