feat: add postgres support (#215)

* feat: add postgres support and refactor

* feat: improve releases find

* fix: autobrrctl create user
This commit is contained in:
Ludvig Lundgren 2022-04-02 19:24:23 +02:00 committed by GitHub
parent f6873e932e
commit 3185832708
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 1708 additions and 831 deletions

View file

@ -7,7 +7,7 @@ type ActionRepo interface {
StoreFilterActions(ctx context.Context, actions []Action, filterID int64) ([]Action, error)
DeleteByFilterID(ctx context.Context, filterID int) error
FindByFilterID(ctx context.Context, filterID int) ([]Action, error)
List() ([]Action, error)
List(ctx context.Context) ([]Action, error)
Delete(actionID int) error
ToggleEnabled(actionID int) error
}

View file

@ -7,6 +7,7 @@ type DownloadClientRepo interface {
List(ctx context.Context) ([]DownloadClient, error)
FindByID(ctx context.Context, id int32) (*DownloadClient, error)
Store(ctx context.Context, client DownloadClient) (*DownloadClient, error)
Update(ctx context.Context, client DownloadClient) (*DownloadClient, error)
Delete(ctx context.Context, clientID int) error
}

View file

@ -7,9 +7,9 @@ import (
)
type IndexerRepo interface {
Store(indexer Indexer) (*Indexer, error)
Update(indexer Indexer) (*Indexer, error)
List() ([]Indexer, error)
Store(ctx context.Context, indexer Indexer) (*Indexer, error)
Update(ctx context.Context, indexer Indexer) (*Indexer, error)
List(ctx context.Context) ([]Indexer, error)
Delete(ctx context.Context, id int) error
FindByFilterID(ctx context.Context, id int) ([]Indexer, error)
}

View file

@ -71,11 +71,12 @@ type IrcRepo interface {
StoreNetwork(network *IrcNetwork) error
UpdateNetwork(ctx context.Context, network *IrcNetwork) error
StoreChannel(networkID int64, channel *IrcChannel) error
UpdateChannel(channel *IrcChannel) error
StoreNetworkChannels(ctx context.Context, networkID int64, channels []IrcChannel) error
CheckExistingNetwork(ctx context.Context, network *IrcNetwork) (*IrcNetwork, error)
FindActiveNetworks(ctx context.Context) ([]IrcNetwork, error)
ListNetworks(ctx context.Context) ([]IrcNetwork, error)
ListChannels(networkID int64) ([]IrcChannel, error)
GetNetworkByID(id int64) (*IrcNetwork, error)
GetNetworkByID(ctx context.Context, id int64) (*IrcNetwork, error)
DeleteNetwork(ctx context.Context, id int64) error
}

View file

@ -28,7 +28,7 @@ import (
type ReleaseRepo interface {
Store(ctx context.Context, release *Release) (*Release, error)
Find(ctx context.Context, params ReleaseQueryParams) (res []Release, nextCursor int64, count int64, err error)
Find(ctx context.Context, params ReleaseQueryParams) (res []*Release, nextCursor int64, count int64, err error)
GetIndexerOptions(ctx context.Context) ([]string, error)
GetActionStatusByReleaseID(ctx context.Context, releaseID int64) ([]ReleaseActionStatus, error)
Stats(ctx context.Context) (*ReleaseStats, error)

View file

@ -5,6 +5,7 @@ import "context"
type UserRepo interface {
FindByUsername(ctx context.Context, username string) (*User, error)
Store(ctx context.Context, user User) error
Update(ctx context.Context, user User) error
}
type User struct {