add user management functionality with OTP verification and consent handling, DI introduced
This commit is contained in:
51
internal/api/auth/domain/auth_domain.go
Normal file
51
internal/api/auth/domain/auth_domain.go
Normal file
@ -0,0 +1,51 @@
|
||||
package domain
|
||||
|
||||
import "context"
|
||||
|
||||
type AuthRepository interface {
|
||||
SaveOtpRequest(ctx context.Context, uuid string, code string) error
|
||||
GetOtpRequest(ctx context.Context, uuid string) (*string, error)
|
||||
}
|
||||
|
||||
type ErrOtpNotFound struct {
|
||||
Uuid string
|
||||
}
|
||||
|
||||
func (e ErrOtpNotFound) Error() string {
|
||||
return "OTP request not found for UUID: " + e.Uuid
|
||||
}
|
||||
|
||||
type ErrUserNotFound struct {
|
||||
PhoneNumber string
|
||||
}
|
||||
|
||||
func (e ErrUserNotFound) Error() string {
|
||||
return "User not found with phone number: " + e.PhoneNumber
|
||||
}
|
||||
|
||||
type ErrOtpInvalid struct {
|
||||
Code string
|
||||
Uuid string
|
||||
}
|
||||
|
||||
func (e ErrOtpInvalid) Error() string {
|
||||
return "Invalid OTP code: " + e.Code + " for UUID: " + e.Uuid
|
||||
}
|
||||
|
||||
type ErrInvalidHydraAccept struct {
|
||||
Message string
|
||||
Uuid string
|
||||
}
|
||||
|
||||
func (e ErrInvalidHydraAccept) Error() string {
|
||||
return "Invalid Hydra accept request: " + e.Message + " for UUID: " + e.Uuid
|
||||
}
|
||||
|
||||
type ErrInvalidPhoneNumber struct {
|
||||
PhoneNumber string
|
||||
Err error
|
||||
}
|
||||
|
||||
func (e ErrInvalidPhoneNumber) Error() string {
|
||||
return "Invalid phone number: " + e.PhoneNumber + ", error: " + e.Err.Error()
|
||||
}
|
||||
Reference in New Issue
Block a user