38 lines
		
	
	
		
			958 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			958 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package models
 | |
| 
 | |
| import (
 | |
| 	"gorm.io/datatypes"
 | |
| )
 | |
| 
 | |
| type Notification struct {
 | |
| 	BaseModel
 | |
| 
 | |
| 	Topic     string            `json:"topic"`
 | |
| 	Title     string            `json:"title"`
 | |
| 	Subtitle  *string           `json:"subtitle"`
 | |
| 	Body      string            `json:"body"`
 | |
| 	Metadata  datatypes.JSONMap `json:"metadata"`
 | |
| 	Avatar    *string           `json:"avatar"`
 | |
| 	Picture   *string           `json:"picture"`
 | |
| 	AccountID uint              `json:"account_id"`
 | |
| 	SenderID  *uint             `json:"sender_id"`
 | |
| 
 | |
| 	IsRealtime  bool `json:"is_realtime" gorm:"-"`
 | |
| 	IsForcePush bool `json:"is_force_push" gorm:"-"`
 | |
| }
 | |
| 
 | |
| const (
 | |
| 	NotifySubscriberFirebase = "firebase"
 | |
| 	NotifySubscriberAPNs     = "apple"
 | |
| )
 | |
| 
 | |
| type NotificationSubscriber struct {
 | |
| 	BaseModel
 | |
| 
 | |
| 	UserAgent   string `json:"user_agent"`
 | |
| 	Provider    string `json:"provider"`
 | |
| 	DeviceID    string `json:"device_id" gorm:"uniqueIndex"`
 | |
| 	DeviceToken string `json:"device_token"`
 | |
| 	AccountID   uint   `json:"account_id"`
 | |
| }
 |