fix
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
package interfaces
|
||||
|
||||
import (
|
||||
"context"
|
||||
"photography-backend/internal/model/entity"
|
||||
)
|
||||
|
||||
// UserRepository 用户仓储接口
|
||||
type UserRepository interface {
|
||||
// 基本CRUD操作
|
||||
Create(ctx context.Context, user *entity.User) error
|
||||
GetByID(ctx context.Context, id uint) (*entity.User, error)
|
||||
GetByEmail(ctx context.Context, email string) (*entity.User, error)
|
||||
GetByUsername(ctx context.Context, username string) (*entity.User, error)
|
||||
Update(ctx context.Context, user *entity.User) error
|
||||
Delete(ctx context.Context, id uint) error
|
||||
|
||||
// 查询操作
|
||||
List(ctx context.Context, params *entity.UserListParams) ([]*entity.User, int64, error)
|
||||
Search(ctx context.Context, query string, params *entity.UserListParams) ([]*entity.User, int64, error)
|
||||
|
||||
// 认证相关
|
||||
UpdatePassword(ctx context.Context, userID uint, hashedPassword string) error
|
||||
UpdateLastLogin(ctx context.Context, userID uint) error
|
||||
IncrementLoginCount(ctx context.Context, userID uint) error
|
||||
|
||||
// 状态管理
|
||||
SetActive(ctx context.Context, userID uint, isActive bool) error
|
||||
VerifyEmail(ctx context.Context, userID uint) error
|
||||
|
||||
// 统计操作
|
||||
Count(ctx context.Context) (int64, error)
|
||||
CountByRole(ctx context.Context, role entity.UserRole) (int64, error)
|
||||
CountActive(ctx context.Context) (int64, error)
|
||||
GetStats(ctx context.Context) (*entity.UserStats, error)
|
||||
|
||||
// 验证操作
|
||||
ExistsByEmail(ctx context.Context, email string) (bool, error)
|
||||
ExistsByUsername(ctx context.Context, username string) (bool, error)
|
||||
}
|
||||
Reference in New Issue
Block a user