mirror of
https://github.com/go-shiori/shiori.git
synced 2025-09-08 05:54:31 +08:00
* fix: frontend url to retrieve bookmark count * chore: unneeded type in generic * feat: allow tag filtering and count retrieval * fix: make styles * fix: make swagger * fix: make swag * tests: refactored gettags tests * fix: initialise tags empty slice
56 lines
1.8 KiB
Go
56 lines
1.8 KiB
Go
package model
|
|
|
|
import (
|
|
"context"
|
|
"io/fs"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/go-shiori/warc"
|
|
"github.com/spf13/afero"
|
|
)
|
|
|
|
type BookmarksDomain interface {
|
|
HasEbook(b *BookmarkDTO) bool
|
|
HasArchive(b *BookmarkDTO) bool
|
|
HasThumbnail(b *BookmarkDTO) bool
|
|
GetBookmark(ctx context.Context, id DBID) (*BookmarkDTO, error)
|
|
GetBookmarks(ctx context.Context, ids []int) ([]BookmarkDTO, error)
|
|
UpdateBookmarkCache(ctx context.Context, bookmark BookmarkDTO, keepMetadata bool, skipExist bool) (*BookmarkDTO, error)
|
|
BulkUpdateBookmarkTags(ctx context.Context, bookmarkIDs []int, tagIDs []int) error
|
|
}
|
|
|
|
type AuthDomain interface {
|
|
CheckToken(ctx context.Context, userJWT string) (*AccountDTO, error)
|
|
GetAccountFromCredentials(ctx context.Context, username, password string) (*AccountDTO, error)
|
|
CreateTokenForAccount(account *AccountDTO, expiration time.Time) (string, error)
|
|
}
|
|
|
|
type AccountsDomain interface {
|
|
ListAccounts(ctx context.Context) ([]AccountDTO, error)
|
|
CreateAccount(ctx context.Context, account AccountDTO) (*AccountDTO, error)
|
|
UpdateAccount(ctx context.Context, account AccountDTO) (*AccountDTO, error)
|
|
DeleteAccount(ctx context.Context, id int) error
|
|
}
|
|
|
|
type ArchiverDomain interface {
|
|
DownloadBookmarkArchive(book BookmarkDTO) (*BookmarkDTO, error)
|
|
GetBookmarkArchive(book *BookmarkDTO) (*warc.Archive, error)
|
|
}
|
|
|
|
type StorageDomain interface {
|
|
Stat(name string) (fs.FileInfo, error)
|
|
FS() afero.Fs
|
|
FileExists(path string) bool
|
|
DirExists(path string) bool
|
|
WriteData(dst string, data []byte) error
|
|
WriteFile(dst string, src *os.File) error
|
|
}
|
|
|
|
type TagsDomain interface {
|
|
ListTags(ctx context.Context, opts ListTagsOptions) ([]TagDTO, error)
|
|
CreateTag(ctx context.Context, tag TagDTO) (TagDTO, error)
|
|
GetTag(ctx context.Context, id int) (TagDTO, error)
|
|
UpdateTag(ctx context.Context, tag TagDTO) (TagDTO, error)
|
|
DeleteTag(ctx context.Context, id int) error
|
|
}
|