30 lines
446 B
Go

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,
}
}