63 lines
3.1 KiB
Go
63 lines
3.1 KiB
Go
package ports
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"Yimaru-Backend/internal/domain"
|
|
)
|
|
|
|
type UserStore interface {
|
|
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,
|
|
organizationID *int64,
|
|
query *string,
|
|
createdBefore, createdAfter *time.Time,
|
|
limit, offset int32,
|
|
) ([]domain.User, int64, error)
|
|
GetTotalUsers(ctx context.Context, role *string, organizationID *int64) (int64, error)
|
|
SearchUserByNameOrPhone(ctx context.Context, search string, organizationID *int64, role *string) ([]domain.User, error)
|
|
UpdateUser(ctx context.Context, user domain.User) error
|
|
UpdateUserOrganization(ctx context.Context, userID, organizationID int64) error
|
|
SuspendUser(ctx context.Context, userID int64, suspended bool, suspendedAt time.Time) error
|
|
DeleteUser(ctx context.Context, userID int64) error
|
|
CheckPhoneEmailExist(ctx context.Context, phone, email string, organizationID domain.ValidInt64) (phoneExists, emailExists bool, err error)
|
|
GetUserByEmailPhone(
|
|
ctx context.Context,
|
|
email string,
|
|
phone string,
|
|
organizationID domain.ValidInt64,
|
|
) (domain.User, error)
|
|
UpdatePassword(ctx context.Context, password, email, phone string, organizationID int64, updatedAt time.Time) error
|
|
GetOwnerByOrganizationID(ctx context.Context, organizationID int64) (domain.User, error)
|
|
UpdateUserSuspend(ctx context.Context, id int64, status bool) error
|
|
|
|
// UpdateUser(ctx context.Context, user domain.UpdateUserReq) error
|
|
// UpdateUserSuspend(ctx context.Context, id int64, status bool) error
|
|
// DeleteUser(ctx context.Context, id int64) error
|
|
// CheckPhoneEmailExist(ctx context.Context, phoneNum, email string, companyID domain.ValidInt64) (bool, bool, error)
|
|
// GetUserByEmail(ctx context.Context, email string, companyID domain.ValidInt64) (domain.User, error)
|
|
// GetUserByPhone(ctx context.Context, phoneNum string, companyID domain.ValidInt64) (domain.User, error)
|
|
// SearchUserByNameOrPhone(ctx context.Context, searchString string, role *domain.Role, companyID domain.ValidInt64) ([]domain.User, error)
|
|
// UpdatePassword(ctx context.Context, identifier string, password []byte, usedOtpId int64, companyId int64) error
|
|
// GetUserByEmailPhone(ctx context.Context, email, phone string, companyID domain.ValidInt64) (domain.User, error)
|
|
|
|
// GetCustomerCounts(ctx context.Context, filter domain.ReportFilter) (total, active, inactive int64, err error)
|
|
// GetCustomerDetails(ctx context.Context, filter domain.ReportFilter) (map[int64]domain.CustomerDetail, error)
|
|
// GetRoleCounts(ctx context.Context, role string, filter domain.ReportFilter) (total, active, inactive int64, err 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 {
|
|
CreateOtp(ctx context.Context, otp domain.Otp) error
|
|
GetOtp(ctx context.Context, sentTo string, sentfor domain.OtpFor, medium domain.OtpMedium) (domain.Otp, error)
|
|
}
|