-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.go
More file actions
28 lines (25 loc) · 832 Bytes
/
models.go
File metadata and controls
28 lines (25 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package models
import (
"gorm.io/gorm"
)
// Add new model for price alerts
type PriceAlert struct {
gorm.Model
UserID string `gorm:"index"`
CryptocurrencyID string `gorm:"index"` // e.g., "BTC", "ETH"
ThresholdPrice string `gorm:"type:numeric"` // Store as string for precision
IsUpperBound bool // true for price above, false for below
IsActive bool `gorm:"default:true"`
EmailNotification bool `gorm:"default:true"`
}
// Update UserPreference to include price alerts
type UserPreference struct {
gorm.Model
UserID string `gorm:"uniqueIndex"`
WalletAddress string `gorm:"index"`
MinEtherValue string `gorm:"type:numeric"`
TrackNFTs bool
EmailNotification bool
PushNotification bool
PriceAlerts []PriceAlert `gorm:"foreignKey:UserID"`
}