refactor: separate backend domains and storage adapters
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package biz
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type APIToken struct {
|
||||
ID uint
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
UserID uint
|
||||
AuthorityID uint
|
||||
Token string
|
||||
Status bool
|
||||
ExpiresAt time.Time
|
||||
Remark string
|
||||
User *User
|
||||
}
|
||||
|
||||
type APITokenRepo interface {
|
||||
UserHasAuthority(context.Context, uint, uint) (*User, bool, error)
|
||||
CreateAPIToken(context.Context, *APIToken) error
|
||||
ListAPITokens(context.Context, int, int, uint, *bool) ([]*APIToken, int64, error)
|
||||
DisableAPIToken(context.Context, uint) (string, error)
|
||||
BlacklistToken(context.Context, string) error
|
||||
IsTokenDisabled(context.Context, string) (bool, error)
|
||||
}
|
||||
Reference in New Issue
Block a user