package models import ( "time" "github.com/google/uuid" "gorm.io/gorm" ) type PushProvider int const ( PushProviderApple PushProvider = iota PushProviderGoogle ) type Notification struct { Id uuid.UUID `gorm:"primarykey;type:uuid;default:gen_random_uuid()" json:"id"` Topic string `gorm:"not null;size:1024" json:"topic"` Title *string `json:"title"` Subtitle *string `json:"subtitle"` Content *string `json:"content"` Meta map[string]any `gorm:"type:jsonb;default:'{}'::jsonb;not null" json:"meta"` Priority int `gorm:"default:10" json:"priority"` ViewedAt *time.Time `json:"viewed_at"` AccountId uuid.UUID `gorm:"type:uuid;not null" json:"account_id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"` } type NotificationPushSubscription struct { Id uuid.UUID `gorm:"primarykey;type:uuid;default:gen_random_uuid()" json:"id"` AccountId uuid.UUID `gorm:"type:uuid;not null;uniqueIndex:account_device_deleted" json:"account_id"` DeviceId string `gorm:"not null;size:8192;uniqueIndex:account_device_deleted" json:"device_id"` DeviceToken string `gorm:"not null;size:8192" json:"device_token"` Provider PushProvider `gorm:"not null" json:"provider"` CountDelivered int `gorm:"default:0" json:"count_delivered"` LastUsedAt *time.Time `json:"last_used_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"uniqueIndex:account_device_deleted,index" json:"deleted_at"` }