134 lines
2.6 KiB
Go
134 lines
2.6 KiB
Go
package domain
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
ErrUserNotFound = errors.New("user not found")
|
|
)
|
|
|
|
type User struct {
|
|
ID int64
|
|
FirstName string
|
|
LastName string
|
|
NickName string
|
|
Email string `json:"email"`
|
|
PhoneNumber string `json:"phone_number"`
|
|
Password []byte
|
|
Role Role
|
|
Age int
|
|
EducationLevel string
|
|
Country string
|
|
Region string
|
|
EmailVerified bool
|
|
PhoneVerified bool
|
|
Suspended bool
|
|
SuspendedAt time.Time
|
|
OrganizationID ValidInt64
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type UserFilter struct {
|
|
Role string
|
|
OrganizationID ValidInt64
|
|
Page ValidInt
|
|
PageSize ValidInt
|
|
Query ValidString
|
|
CreatedBefore ValidTime
|
|
CreatedAfter ValidTime
|
|
}
|
|
|
|
type RegisterUserReq struct {
|
|
FirstName string
|
|
LastName string
|
|
NickName string
|
|
Email string
|
|
PhoneNumber string
|
|
Password string
|
|
Role string
|
|
Otp string
|
|
ReferralCode string `json:"referral_code"`
|
|
OtpMedium OtpMedium
|
|
OrganizationID ValidInt64
|
|
Age int
|
|
EducationLevel string
|
|
Country string
|
|
Region string
|
|
}
|
|
|
|
type CreateUserReq struct {
|
|
FirstName string
|
|
LastName string
|
|
NickName string
|
|
Email string
|
|
PhoneNumber string
|
|
Password string
|
|
Role string
|
|
Suspended bool
|
|
OrganizationID ValidInt64
|
|
Age int
|
|
EducationLevel string
|
|
Country string
|
|
Region string
|
|
}
|
|
|
|
type ResetPasswordReq struct {
|
|
Email string
|
|
PhoneNumber string
|
|
Password string
|
|
Otp string
|
|
OtpMedium OtpMedium
|
|
OrganizationID int64
|
|
}
|
|
|
|
type UpdateUserReq struct {
|
|
UserID int64
|
|
FirstName ValidString
|
|
LastName ValidString
|
|
NickName ValidString
|
|
Suspended ValidBool
|
|
OrganizationID ValidInt64
|
|
Age ValidInt
|
|
EducationLevel ValidString
|
|
Country ValidString
|
|
Region ValidString
|
|
}
|
|
|
|
type UpdateUserReferralCode struct {
|
|
UserID int64
|
|
Code string
|
|
}
|
|
|
|
// ValidInt64 wraps int64 for optional values
|
|
// type ValidInt64 struct {
|
|
// Value int64
|
|
// Valid bool
|
|
// }
|
|
|
|
// // ValidInt wraps int for optional values
|
|
// type ValidInt struct {
|
|
// Value int
|
|
// Valid bool
|
|
// }
|
|
|
|
// // ValidString wraps string for optional values
|
|
// type ValidString struct {
|
|
// Value string
|
|
// Valid bool
|
|
// }
|
|
|
|
// // ValidBool wraps bool for optional values
|
|
// type ValidBool struct {
|
|
// Value bool
|
|
// Valid bool
|
|
// }
|
|
|
|
// // ValidTime wraps time.Time for optional values
|
|
// type ValidTime struct {
|
|
// Value time.Time
|
|
// Valid bool
|
|
// }
|