fix
Some checks failed
部署后端服务 / 🧪 测试后端 (push) Failing after 5m8s
部署后端服务 / 🚀 构建并部署 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Has been skipped

This commit is contained in:
xujiang
2025-07-10 18:09:11 +08:00
parent 35004f224e
commit 010fe2a8c7
96 changed files with 23709 additions and 19 deletions

View File

@ -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)
}