mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat: add notifications (#216)
* feat: initial notifications support * chore: update deps
This commit is contained in:
parent
3185832708
commit
431742fd94
20 changed files with 1632 additions and 36 deletions
75
internal/domain/notification.go
Normal file
75
internal/domain/notification.go
Normal file
|
@ -0,0 +1,75 @@
|
|||
package domain
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type NotificationRepo interface {
|
||||
List(ctx context.Context) ([]Notification, error)
|
||||
//FindByType(ctx context.Context, nType NotificationType) ([]Notification, error)
|
||||
Find(ctx context.Context, params NotificationQueryParams) ([]Notification, int, error)
|
||||
FindByID(ctx context.Context, id int) (*Notification, error)
|
||||
Store(ctx context.Context, notification Notification) (*Notification, error)
|
||||
Update(ctx context.Context, notification Notification) (*Notification, error)
|
||||
Delete(ctx context.Context, notificationID int) error
|
||||
}
|
||||
|
||||
type Notification struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type NotificationType `json:"type"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Events []string `json:"events"`
|
||||
Token string `json:"token"`
|
||||
APIKey string `json:"api_key"`
|
||||
Webhook string `json:"webhook"`
|
||||
Title string `json:"title"`
|
||||
Icon string `json:"icon"`
|
||||
Username string `json:"username"`
|
||||
Host string `json:"host"`
|
||||
Password string `json:"password"`
|
||||
Channel string `json:"channel"`
|
||||
Rooms string `json:"rooms"`
|
||||
Targets string `json:"targets"`
|
||||
Devices string `json:"devices"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type NotificationType string
|
||||
|
||||
const (
|
||||
NotificationTypeDiscord NotificationType = "DISCORD"
|
||||
NotificationTypeIFTTT NotificationType = "IFTTT"
|
||||
NotificationTypeJoin NotificationType = "JOIN"
|
||||
NotificationTypeMattermost NotificationType = "MATTERMOST"
|
||||
NotificationTypeMatrix NotificationType = "MATRIX"
|
||||
NotificationTypePushBullet NotificationType = "PUSH_BULLET"
|
||||
NotificationTypePushover NotificationType = "PUSHOVER"
|
||||
NotificationTypeRocketChat NotificationType = "ROCKETCHAT"
|
||||
NotificationTypeSlack NotificationType = "SLACK"
|
||||
NotificationTypeTelegram NotificationType = "TELEGRAM"
|
||||
)
|
||||
|
||||
type NotificationEvent string
|
||||
|
||||
const (
|
||||
NotificationEventPushApproved NotificationEvent = "PUSH_APPROVED"
|
||||
NotificationEventPushRejected NotificationEvent = "PUSH_REJECTED"
|
||||
NotificationEventUpdateAvailable NotificationEvent = "UPDATE_AVAILABLE"
|
||||
NotificationEventIRCHealth NotificationEvent = "IRC_HEALTH"
|
||||
)
|
||||
|
||||
type NotificationEventArr []NotificationEvent
|
||||
|
||||
type NotificationQueryParams struct {
|
||||
Limit uint64
|
||||
Offset uint64
|
||||
Sort map[string]string
|
||||
Filters struct {
|
||||
Indexers []string
|
||||
PushStatus string
|
||||
}
|
||||
Search string
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue