feat: add otp redis repo

This commit is contained in:
2025-09-15 13:03:48 +03:30
parent 75e1b5111e
commit 36cda3fd5a
6 changed files with 109 additions and 1 deletions
+29
View File
@@ -0,0 +1,29 @@
package domain
import (
"backend/pkg/util"
"context"
"time"
"github.com/google/uuid"
)
type OTPRepo interface {
Create(ctx context.Context, phone string, otp *OTP) error
Delete(ctx context.Context, phone string) error
}
type OTP struct {
ID uuid.UUID
Code string
Phone string
ExpiredAt time.Time
}
func NewOTP(phone string) *OTP {
return &OTP{
ID: uuid.New(),
Code: util.GenOTPCode(),
Phone: phone,
}
}