apollo-backend/internal/domain/account.go

38 lines
1 KiB
Go
Raw Normal View History

2021-07-24 19:44:26 +00:00
package domain
import "context"
// Account represents an account we need to periodically check in the notifications worker.
type Account struct {
ID int64
// Reddit information
Username string
AccountID string
AccessToken string
RefreshToken string
ExpiresAt int64
// Tracking how far behind we are
LastMessageID string
LastCheckedAt float64
}
// AccountRepository represents the account's repository contract
type AccountRepository interface {
GetByID(ctx context.Context, id int64) (Account, error)
GetByRedditID(ctx context.Context, id string) (Account, error)
Update(ctx context.Context, ac *Account) error
Create(ctx context.Context, ac *Account) error
Delete(ctx context.Context, id int64) error
}
// AccountUsecase represents the account's usecases
type AccountUsecase interface {
GetByID(ctx context.Context, id int64) (Account, error)
GetByRedditID(ctx context.Context, id string) (Account, error)
CreateOrUpdate(ctx context.Context, ac *Account) error
Delete(ctx context.Context, id int64) error
}