feat(架构): 完善基础架构设计
This commit is contained in:
@@ -2,6 +2,15 @@ package interfaces
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"tyapi-server/internal/domains/user/dto"
|
||||
"tyapi-server/internal/domains/user/entities"
|
||||
)
|
||||
|
||||
// 常见错误定义
|
||||
var (
|
||||
ErrCacheMiss = errors.New("cache miss")
|
||||
)
|
||||
|
||||
// Service 通用服务接口
|
||||
@@ -16,6 +25,22 @@ type Service interface {
|
||||
Shutdown(ctx context.Context) error
|
||||
}
|
||||
|
||||
// UserService 用户服务接口
|
||||
type UserService interface {
|
||||
Service
|
||||
|
||||
// 用户注册
|
||||
Register(ctx context.Context, req *dto.RegisterRequest) (*entities.User, error)
|
||||
// 密码登录
|
||||
LoginWithPassword(ctx context.Context, req *dto.LoginWithPasswordRequest) (*entities.User, error)
|
||||
// 短信验证码登录
|
||||
LoginWithSMS(ctx context.Context, req *dto.LoginWithSMSRequest) (*entities.User, error)
|
||||
// 修改密码
|
||||
ChangePassword(ctx context.Context, userID string, req *dto.ChangePasswordRequest) error
|
||||
// 根据ID获取用户
|
||||
GetByID(ctx context.Context, id string) (*entities.User, error)
|
||||
}
|
||||
|
||||
// DomainService 领域服务接口,支持泛型
|
||||
type DomainService[T Entity] interface {
|
||||
Service
|
||||
|
||||
Reference in New Issue
Block a user