- Assign default circle to user when leaving a circle

- Support Pushover
- Support Disable Signup
- Migrate chatID to TargetID
This commit is contained in:
Mo Tarbin 2024-12-14 02:15:51 -05:00
parent 850d472445
commit adf5c0c0cd
20 changed files with 362 additions and 151 deletions

View file

@ -1,6 +1,10 @@
package user
import "time"
import (
"time"
nModel "donetick.com/core/internal/notifier/model"
)
type User struct {
ID int `json:"id" gorm:"primary_key"` // Unique identifier
@ -16,10 +20,10 @@ type User struct {
UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` // Updated at
Disabled bool `json:"disabled" gorm:"column:disabled"` // Disabled
// Email string `json:"email" gorm:"column:email"` // Email
CustomerID *string `gorm:"column:customer_id;<-:false"` // read only column
Subscription *string `json:"subscription" gorm:"column:subscription;<-:false"` // read only column
Expiration *string `json:"expiration" gorm:"column:expiration;<-:false"` // read only column
UserNotificationTargets []UserNotificationTarget `json:"-" gorm:"foreignKey:UserID;references:ID"`
CustomerID *string `gorm:"column:customer_id;<-:false"` // read only column
Subscription *string `json:"subscription" gorm:"column:subscription;<-:false"` // read only column
Expiration *string `json:"expiration" gorm:"column:expiration;<-:false"` // read only column
UserNotificationTargets UserNotificationTarget `json:"notification_target" gorm:"foreignKey:UserID;references:ID"`
}
type UserPasswordReset struct {
@ -39,18 +43,8 @@ type APIToken struct {
}
type UserNotificationTarget struct {
ID int `json:"id" gorm:"primary_key"` // Unique identifier
UserID int `json:"userId" gorm:"column:user_id;index"` // Index on userID
Type UserNotificationType `json:"type" gorm:"column:type"` // Type
TargetID string `json:"targetId" gorm:"column:target_id"` // Target ID
CreatedAt time.Time `json:"createdAt" gorm:"column:created_at"`
UserID int `json:"userId" gorm:"column:user_id;index;primaryKey"` // Index on userID
Type nModel.NotificationType `json:"type" gorm:"column:type"` // Type
TargetID string `json:"target_id" gorm:"column:target_id"` // Target ID
CreatedAt time.Time `json:"-" gorm:"column:created_at"`
}
type UserNotificationType int8
const (
_ UserNotificationType = iota
Android
IOS
Telegram
)