76 lines
2.2 KiB
Go
76 lines
2.2 KiB
Go
package ports
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"Yimaru-Backend/internal/domain"
|
|
)
|
|
|
|
type UserStore interface {
|
|
IsProfileCompleted(ctx context.Context, userId int64) (bool, error)
|
|
UpdateUserStatus(ctx context.Context, user domain.UpdateUserReq) error
|
|
// GetCorrectOptionForQuestion(
|
|
// ctx context.Context,
|
|
// questionID int64,
|
|
// ) (int64, error)
|
|
// GetLatestAssessmentAttempt(
|
|
// ctx context.Context,
|
|
// userID int64,
|
|
// ) (*dbgen.AssessmentAttempt, error)
|
|
UpdateUserKnowledgeLevel(ctx context.Context, userID int64, knowledgeLevel string) error
|
|
IsUserNameUnique(ctx context.Context, userName string) (bool, error)
|
|
IsUserPending(ctx context.Context, UserName string) (bool, error)
|
|
GetUserByUserName(
|
|
ctx context.Context,
|
|
userName string,
|
|
) (domain.User, error)
|
|
CreateUser(
|
|
ctx context.Context,
|
|
user domain.User,
|
|
usedOtpId int64,
|
|
) (domain.User, error)
|
|
CreateUserWithoutOtp(
|
|
ctx context.Context,
|
|
user domain.User,
|
|
) (domain.User, error)
|
|
GetUserByID(
|
|
ctx context.Context,
|
|
id int64,
|
|
) (domain.User, error)
|
|
GetAllUsers(
|
|
ctx context.Context,
|
|
role *string,
|
|
query *string,
|
|
createdBefore, createdAfter *time.Time,
|
|
limit, offset int32,
|
|
) ([]domain.User, int64, error)
|
|
GetTotalUsers(ctx context.Context, role *string) (int64, error)
|
|
SearchUserByNameOrPhone(
|
|
ctx context.Context,
|
|
search string,
|
|
role *string,
|
|
) ([]domain.User, error)
|
|
UpdateUser(ctx context.Context, user domain.User) error
|
|
DeleteUser(ctx context.Context, userID int64) error
|
|
CheckPhoneEmailExist(ctx context.Context, phone, email string) (phoneExists, emailExists bool, err error)
|
|
GetUserByEmailPhone(
|
|
ctx context.Context,
|
|
email string,
|
|
phone string,
|
|
) (domain.User, error)
|
|
UpdatePassword(ctx context.Context, password, userName string) error
|
|
}
|
|
type SmsGateway interface {
|
|
SendSMSOTP(ctx context.Context, phoneNumber, otp string) error
|
|
}
|
|
type EmailGateway interface {
|
|
SendEmailOTP(ctx context.Context, email string, otp string) error
|
|
}
|
|
type OtpStore interface {
|
|
UpdateOtp(ctx context.Context, otp, userName string) error
|
|
MarkOtpAsUsed(ctx context.Context, otp domain.Otp) error
|
|
CreateOtp(ctx context.Context, otp domain.Otp) error
|
|
GetOtp(ctx context.Context, userName string) (domain.Otp, error)
|
|
}
|