feat: extend equipment and workout models with service tracking
This commit is contained in:
35
internal/integration/model.go
Normal file
35
internal/integration/model.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package integration
|
||||
|
||||
import "time"
|
||||
|
||||
type OAuthConnection struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
UserID uint `gorm:"not null;uniqueIndex:idx_user_provider" json:"user_id"`
|
||||
Provider string `gorm:"not null;uniqueIndex:idx_user_provider" json:"provider"` // "garmin", "wahoo"
|
||||
AccessToken string `gorm:"not null" json:"-"`
|
||||
RefreshToken string `gorm:"default:''" json:"-"`
|
||||
TokenExpiresAt time.Time `json:"token_expires_at"`
|
||||
ProviderUserID string `gorm:"default:''" json:"provider_user_id"`
|
||||
Scopes string `gorm:"default:''" json:"scopes"`
|
||||
Status string `gorm:"default:'active'" json:"status"` // "active", "revoked", "expired"
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (OAuthConnection) TableName() string {
|
||||
return "oauth_connections"
|
||||
}
|
||||
|
||||
type OAuthState struct {
|
||||
ID uint `gorm:"primaryKey"`
|
||||
State string `gorm:"uniqueIndex;not null"`
|
||||
UserID uint `gorm:"not null"`
|
||||
Provider string `gorm:"not null"` // "garmin", "wahoo"
|
||||
CodeVerifier string `gorm:"default:''"` // for PKCE (Garmin)
|
||||
ExpiresAt time.Time `gorm:"not null"`
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
func (OAuthState) TableName() string {
|
||||
return "oauth_states"
|
||||
}
|
||||
Reference in New Issue
Block a user