add user management functionality with OTP verification and consent handling, DI introduced

This commit is contained in:
2025-08-10 10:38:49 +03:00
parent 6a9061a3de
commit 5d80a68b44
30 changed files with 828 additions and 528 deletions

View 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()
}