Yimaru-BackEnd/internal/domain/user.go

101 lines
2.2 KiB
Go

package domain
import (
"errors"
"time"
)
var (
ErrUserNotFound = errors.New("user not found")
)
type User struct {
ID int64
FirstName string
LastName string
Email string `json:"email"`
PhoneNumber string `json:"phone_number"`
Password []byte
Role Role
EmailVerified bool
PhoneVerified bool
CreatedAt time.Time
UpdatedAt time.Time
SuspendedAt time.Time
Suspended bool
CompanyID ValidInt64
}
type UserFilter struct {
Role string
CompanyID ValidInt64
Page ValidInt
PageSize ValidInt
Query ValidString
CreatedBefore ValidTime
CreatedAfter ValidTime
}
type RegisterUserReq struct {
FirstName string
LastName string
Email string
PhoneNumber string
Password string
Role string
Otp string
ReferralCode string `json:"referral_code"`
OtpMedium OtpMedium
CompanyID ValidInt64
}
type CreateUserReq struct {
FirstName string
LastName string
Email string
PhoneNumber string
Password string
Role string
Suspended bool
CompanyID ValidInt64
}
type ResetPasswordReq struct {
Email string
PhoneNumber string
Password string
Otp string
OtpMedium OtpMedium
CompanyID int64
}
type UpdateUserReq struct {
UserId int64
FirstName ValidString
LastName ValidString
Suspended ValidBool
CompanyID ValidInt64
}
type UpdateUserReferalCode struct {
UserID int64
Code string
}
type GetCashier struct {
ID int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
PhoneNumber string `json:"phone_number"`
Role Role `json:"role"`
EmailVerified bool `json:"email_verified"`
PhoneVerified bool `json:"phone_verified"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
SuspendedAt time.Time `json:"suspended_at"`
Suspended bool `json:"suspended"`
BranchID int64 `json:"branch_id"`
BranchName string `json:"branch_name"`
BranchWallet int64 `json:"branch_wallet"`
BranchLocation string `json:"branch_location"`
}