domain

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2023 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	Name      string     `json:"name,omitempty"`
	Key       string     `json:"key,omitempty"`
	Scopes    []string   `json:"scopes,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
}

type APIRepo

type APIRepo interface {
	Store(ctx context.Context, key *APIKey) error
	Delete(ctx context.Context, key string) error
	GetKeys(ctx context.Context) ([]APIKey, error)
}

type Category

type Category struct {
	Name  string `json:"name"`
	Flags int    `json:"flags"`
	Order int    `json:"order"`
}

type Chapter

type Chapter struct {
	URL            string  `json:"url"`
	Name           string  `json:"name"`
	Scanlator      string  `json:"scanlator"`
	Read           bool    `json:"read"`
	Bookmark       bool    `json:"bookmark"`
	LastPageRead   int64   `json:"lastPageRead"`
	DateFetch      int64   `json:"dateFetch"`
	DateUpload     int64   `json:"dateUpload"`
	ChapterNumber  float64 `json:"chapterNumber"`
	SourceOrder    int     `json:"sourceOrder"`
	LastModifiedAt int64   `json:"lastModifiedAt"`
}

type Config

type Config struct {
	Version          string
	ConfigPath       string
	Host             string `toml:"host"`
	Port             int    `toml:"port"`
	LogLevel         string `toml:"logLevel"`
	LogPath          string `toml:"logPath"`
	LogMaxSize       int    `toml:"logMaxSize"`
	LogMaxBackups    int    `toml:"logMaxBackups"`
	BaseURL          string `toml:"baseUrl"`
	SessionSecret    string `toml:"sessionSecret"`
	CheckForUpdates  bool   `toml:"checkForUpdates"`
	DatabaseType     string `toml:"databaseType"`
	PostgresHost     string `toml:"postgresHost"`
	PostgresPort     int    `toml:"postgresPort"`
	PostgresDatabase string `toml:"postgresDatabase"`
	PostgresUser     string `toml:"postgresUser"`
	PostgresPass     string `toml:"postgresPass"`
}

type ConfigUpdate

type ConfigUpdate struct {
	Host            *string `json:"host,omitempty"`
	Port            *int    `json:"port,omitempty"`
	LogLevel        *string `json:"log_level,omitempty"`
	LogPath         *string `json:"log_path,omitempty"`
	BaseURL         *string `json:"base_url,omitempty"`
	CheckForUpdates *bool   `json:"check_for_updates,omitempty"`
}

type History

type History struct {
	URL          string `json:"url"`
	LastRead     int64  `json:"lastRead"`
	ReadDuration int    `json:"readDuration"`
}

type Manga

type Manga struct {
	Source         int64      `json:"source"`
	URL            string     `json:"url"`
	Title          string     `json:"title"`
	Artist         string     `json:"artist"`
	Author         string     `json:"author"`
	Description    string     `json:"description"`
	Genre          []string   `json:"genre"`
	Status         int        `json:"status"`
	ThumbnailURL   string     `json:"thumbnailUrl"`
	DateAdded      int64      `json:"dateAdded"`
	Viewer         int        `json:"viewer"`
	Chapters       []Chapter  `json:"chapters"`
	Tracking       []Tracking `json:"tracking"`
	Favorite       bool       `json:"favorite"`
	Categories     []int      `json:"categories"`
	ViewerFlags    int        `json:"viewer_flags"`
	History        []History  `json:"history"`
	LastModifiedAt int64      `json:"lastModifiedAt"`
}

type MangaData

type MangaData struct {
	ID                  int           `json:"id"`
	BackupManga         []Manga       `json:"backupManga"`
	BackupCategories    []Category    `json:"backupCategories"`
	BackupBrokenSources []interface{} `json:"backupBrokenSources"`
	BackupSources       []Sources     `json:"backupSources"`
	UserApiKey          *APIKey       `json:"user_api_key,omitempty"`
	CreatedAt           time.Time     `json:"created_at"`
	UpdatedAt           time.Time     `json:"updated_at"`
}

type MangaDataRepo

type MangaDataRepo interface {
	Store(ctx context.Context, mdata *MangaData) (*MangaData, error)
	Delete(ctx context.Context, id int) error
	Update(ctx context.Context, mdata *MangaData) (*MangaData, error)
	ListMangaData(ctx context.Context, apiKey string) ([]MangaData, error)
	GetMangaDataByApiKey(ctx context.Context, apiKey string) (*MangaData, error)
}

type Notification

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 NotificationEvent

type NotificationEvent string
const (
	NotificationEventAppUpdateAvailable NotificationEvent = "SERVER_UPDATE_AVAILABLE"
	NotificationEventSyncStarted        NotificationEvent = "SYNC_STARTED"
	NotificationEventSyncSuccess        NotificationEvent = "SYNC_SUCCESS"
	NotificationEventSyncFailed         NotificationEvent = "SYNC_FAILED"
	NotificationEventSyncError          NotificationEvent = "SYNC_ERROR"
	NotificationEventTest               NotificationEvent = "TEST"
)

type NotificationEventArr

type NotificationEventArr []NotificationEvent

type NotificationPayload

type NotificationPayload struct {
	Subject   string
	Message   string
	Event     NotificationEvent
	Timestamp time.Time
}

type NotificationQueryParams

type NotificationQueryParams struct {
	Limit   uint64
	Offset  uint64
	Sort    map[string]string
	Filters struct {
		Indexers   []string
		PushStatus string
	}
	Search string
}

type NotificationRepo

type NotificationRepo interface {
	List(ctx context.Context) ([]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 NotificationSender

type NotificationSender interface {
	Send(event NotificationEvent, payload NotificationPayload) error
	CanSend(event NotificationEvent) bool
}

type NotificationType

type NotificationType string
const (
	NotificationTypeDiscord    NotificationType = "DISCORD"
	NotificationTypeNotifiarr  NotificationType = "NOTIFIARR"
	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 Sources added in v0.2.2

type Sources struct {
	Name     string `json:"name"`
	SourceID int64  `json:"sourceId"`
}

type Sync

type Sync struct {
	ID              int        `json:"id,omitempty"`
	LastSynced      *time.Time `json:"last_synced,omitempty"`
	Status          SyncStatus `json:"status,omitempty"`
	UserApiKey      *APIKey    `json:"user_api_key,omitempty"`
	CreatedAt       *time.Time `json:"created_at,omitempty"`
	UpdatedAt       *time.Time `json:"updated_at,omitempty"`
	LastSyncedEpoch int64      `json:"last_synced_epoch,omitempty"`
}

type SyncData

type SyncData struct {
	Sync *Sync      `json:"sync,omitempty"`
	Data *MangaData `json:"backup,omitempty"`
}

type SyncRepo

type SyncRepo interface {
	Store(ctx context.Context, sync *Sync) (*Sync, error)
	Delete(ctx context.Context, id int) error
	Update(ctx context.Context, sync *Sync) (*Sync, error)
	ListSyncs(ctx context.Context, apiKey string) ([]Sync, error)
	GetSyncByApiKey(ctx context.Context, apiKey string) (*Sync, error)
}

type SyncStatus

type SyncStatus string
const (
	SyncStatusPending SyncStatus = "pending"
	SyncStatusSyncing SyncStatus = "syncing"
	SyncStatusSuccess SyncStatus = "success"
	SyncStatusError   SyncStatus = "error"
)

type Tracking added in v0.2.1

type Tracking struct {
	SyncId              *int     `json:"syncId,omitempty"`
	LibraryId           *int64   `json:"libraryId,omitempty"`
	MediaIdInt          *int     `json:"mediaIdInt,omitempty"`
	TrackingUrl         *string  `json:"trackingUrl,omitempty"`
	Title               *string  `json:"title,omitempty"`
	LastChapterRead     *float64 `json:"lastChapterRead,omitempty"`
	TotalChapters       *int     `json:"totalChapters,omitempty"`
	Score               *float64 `json:"score,omitempty"`
	Status              *int     `json:"status,omitempty"`
	StartedReadingDate  *int64   `json:"startedReadingDate,omitempty"`
	FinishedReadingDate *int64   `json:"finishedReadingDate,omitempty"`
	MediaId             *int64   `json:"mediaId,omitempty"`
}

type User

type User struct {
	ID       int    `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type UserRepo

type UserRepo interface {
	GetUserCount(ctx context.Context) (int, error)
	FindByUsername(ctx context.Context, username string) (*User, error)
	Store(ctx context.Context, user User) error
	Update(ctx context.Context, user User) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL