Skip to content

Commit e216e8a

Browse files
committed
Update model to include price alert preferences
1 parent f8ea2c6 commit e216e8a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

models/models.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ import (
44
"gorm.io/gorm"
55
)
66

7+
// Add new model for price alerts
8+
type PriceAlert struct {
9+
gorm.Model
10+
UserID string `gorm:"index"`
11+
CryptocurrencyID string `gorm:"index"` // e.g., "BTC", "ETH"
12+
ThresholdPrice string `gorm:"type:numeric"` // Store as string for precision
13+
IsUpperBound bool // true for price above, false for below
14+
IsActive bool `gorm:"default:true"`
15+
EmailNotification bool `gorm:"default:true"`
16+
}
17+
18+
// Update UserPreference to include price alerts
719
type UserPreference struct {
820
gorm.Model
921
UserID string `gorm:"uniqueIndex"`
@@ -12,4 +24,5 @@ type UserPreference struct {
1224
TrackNFTs bool
1325
EmailNotification bool
1426
PushNotification bool
27+
PriceAlerts []PriceAlert `gorm:"foreignKey:UserID"`
1528
}

0 commit comments

Comments
 (0)