package model import ( "time" "gorm.io/gorm" ) type ActivityType string const ( Buy ActivityType = "BUY" Sell ActivityType = "SELL" Dividend ActivityType = "DIVIDEND" Fee ActivityType = "FEE" Tax ActivityType = "TAX" ) type Activity struct { ID uint `gorm:"primaryKey" json:"id"` PortfolioID uint `gorm:"not null;index" json:"portfolio_id"` // Referenz auf Portfolio Stock string `gorm:"not null;size:20" json:"stock"` // Symbol oder ISIN Type ActivityType `gorm:"not null;size:20" json:"type"` // BUY, SELL, DIVIDEND, FEE, TAX Amount float64 `gorm:"not null" json:"amount"` // Stückzahl oder Betrag Price float64 `gorm:"default:0" json:"price"` // Preis pro Stück (bei BUY/SELL), sonst 0 ConvertedPrice float64 `gorm:"default:0" json:"converted_price"` // Preis pro Stück (bei BUY/SELL), sonst 0 Fee float64 `gorm:"default:0" json:"fee"` // Gebühr (bei BUY/SELL), sonst 0 Taxes float64 `gorm:"default:0" json:"taxes"` // Steuern (bei BUY/SELL), sonst 0 Currency string `gorm:"not null;size:3;default:'EUR'" json:"currency"` // Währung (z.B. EUR, USD) Date time.Time `gorm:"not null" json:"date"` // Datum der Aktivität Note string `gorm:"type:text" json:"note"` // Optional: Notiz CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"` // Relationships Portfolio Portfolio `gorm:"foreignKey:PortfolioID" json:"portfolio,omitempty"` }