HEAVY: migrate accounts and logs to service/repo architecture
This commit is contained in:
parent
5c255fb34b
commit
49e14b5bc5
37 changed files with 1019 additions and 687 deletions
33
repository/account/interface.go
Normal file
33
repository/account/interface.go
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package account
|
||||
|
||||
import "arimelody-web/model"
|
||||
|
||||
type AccountRepository interface {
|
||||
GetAll() ([]model.Account, error)
|
||||
GetCount() (int, error)
|
||||
GetByID(id string) (*model.Account, error)
|
||||
GetByUsername(username string) (*model.Account, error)
|
||||
GetByEmail(email string) (*model.Account, error)
|
||||
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)
|
||||
|
||||
// Intended for large profile updates. For smaller adjusments,
|
||||
// more specialised Change* and Remove* functions should be used.
|
||||
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(accountID string) error
|
||||
|
||||
// Increment the number of account login failure attempts,
|
||||
// returning the current fail count.
|
||||
IncrementFails(accountID string) (int, error)
|
||||
Lock(accountID string) error
|
||||
Unlock(accountID string) error
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue