arimelody-web/repository/account/interface.go

39 lines
1.5 KiB
Go
Raw Normal View History

package account
import "arimelody-web/model"
type AccountRepository interface {
GetAll() ([]*model.Account, error)
GetCount() (int, error)
// Fetches an account by ID, returning an error if one was encountered.
// If the account does not exist, both response fields are nil.
GetByID(id string) (*model.Account, error)
GetByUsername(username string) (*model.Account, error)
GetByEmail(email string) (*model.Account, error)
// Pulled this function: Cross-cutting concerns between accounts and sessions.
// Instead, fetch account ID from session and use GetByID()
// GetBySession(sessionToken string) (*model.Account, error)
// Create an account, returning the new account ID.
Create(username string, password string, email *string, avatarURL *string) (string, error)
2026-07-31 04:46:32 +01:00
// Deprecated in favour of more specialised Change* and Remove* functions.
Update(id string, username string, password string, email *string, avatarUrl *string) error
ChangeUsername(id string, username string) error
ChangePassword(id string, password string) error
ChangeEmail(id string, email string) error
RemoveEmail(id string) error
ChangeAvatarURL(id string, avatarURL string) error
RemoveAvatar(id string) error
Delete(id string) error
// Increment the number of account login failure attempts,
// returning the current fail count.
IncrementFails(id string) (int, error)
ResetFails(id string) error
Lock(id string) error
Unlock(id string) error
}