mirror of
https://github.com/go-shiori/shiori.git
synced 2025-01-15 20:37:44 +08:00
cc7c75116d
* migrate bookmark content route to new http server * new archive page * remove unused go generate comment * database mock * utils cleanup * unused var * domains refactor and tests * fixed secret key type * redirect to login on ui errors * fixed archive folder with storage domain * webroot documentation * some bookmark route tests * fixed error in bookmark domain for non existant bookmarks * centralice errors * add coverage data to unittests * added tests, refactor storage to use afero * removed mock to avoid increasing complexity * using deps to copy files around * remove config usage (to deps) * remove handler-ui file
38 lines
985 B
Go
38 lines
985 B
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)
|
|
}
|
|
|
|
type AccountsDomain interface {
|
|
CheckToken(ctx context.Context, userJWT string) (*Account, error)
|
|
GetAccountFromCredentials(ctx context.Context, username, password string) (*Account, error)
|
|
CreateTokenForAccount(account *Account, expiration time.Time) (string, 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
|
|
}
|