Assignment 4: add unit, integration, and e2e tests; refactor for testability
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"5803025015/w04/internal/models"
|
||||
)
|
||||
|
||||
type UserStore interface {
|
||||
Create(ctx context.Context, user *models.User) error
|
||||
GetByUsername(ctx context.Context, username string) (*models.User, error)
|
||||
}
|
||||
|
||||
type SessionStore interface {
|
||||
Create(ctx context.Context, session *models.Session) error
|
||||
Get(ctx context.Context, token string) (*models.Session, error)
|
||||
Delete(ctx context.Context, token string) error
|
||||
}
|
||||
|
||||
type SnippetStore interface {
|
||||
Create(ctx context.Context, s *models.Snippet) error
|
||||
GetByID(ctx context.Context, id string) (*models.Snippet, error)
|
||||
ListByOwner(ctx context.Context, ownerID string) ([]*models.Snippet, error)
|
||||
Delete(ctx context.Context, id string) error
|
||||
}
|
||||
Reference in New Issue
Block a user