mirror of
https://github.com/gabehf/Koito.git
synced 2026-04-22 20:11:50 -07:00
Engine Handler HTTP Response Tests (#13)
* update handler signatures to use specific store interfaces * allow skipping Docker-based integration tests for local unit runs
This commit is contained in:
parent
64236c99c9
commit
ecae3699f1
10 changed files with 249 additions and 8 deletions
37
engine/handlers/store_interfaces.go
Normal file
37
engine/handlers/store_interfaces.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/gabehf/koito/internal/db"
|
||||
"github.com/gabehf/koito/internal/models"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Focused interfaces for handlers to depend on smaller contracts.
|
||||
type ArtistStore interface {
|
||||
GetArtist(ctx context.Context, opts db.GetArtistOpts) (*models.Artist, error)
|
||||
}
|
||||
|
||||
type AlbumStore interface {
|
||||
GetAlbum(ctx context.Context, opts db.GetAlbumOpts) (*models.Album, error)
|
||||
}
|
||||
|
||||
type TrackStore interface {
|
||||
GetTrack(ctx context.Context, opts db.GetTrackOpts) (*models.Track, error)
|
||||
}
|
||||
|
||||
type LoginStore interface {
|
||||
GetUserByUsername(ctx context.Context, username string) (*models.User, error)
|
||||
SaveSession(ctx context.Context, userId int32, expiresAt time.Time, persistent bool) (*models.Session, error)
|
||||
}
|
||||
|
||||
type SessionStore interface {
|
||||
DeleteSession(ctx context.Context, sessionId uuid.UUID) error
|
||||
RefreshSession(ctx context.Context, sessionId uuid.UUID, expiresAt time.Time) error
|
||||
}
|
||||
|
||||
type UserUpdater interface {
|
||||
UpdateUser(ctx context.Context, opts db.UpdateUserOpts) error
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue