fixed verification code
This commit is contained in:
28
api/pkg/db/verification/errors.go
Normal file
28
api/pkg/db/verification/errors.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package verification
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrTokenNotFound = errors.New("vtNotFound")
|
||||
ErrTokenAlreadyUsed = errors.New("vtAlreadyUsed")
|
||||
ErrTokenExpired = errors.New("vtExpired")
|
||||
)
|
||||
|
||||
func wrap(err error, msg string) error {
|
||||
return fmt.Errorf("%w: %s", err, msg)
|
||||
}
|
||||
|
||||
func ErorrTokenNotFound() error {
|
||||
return wrap(ErrTokenNotFound, "verification token not found")
|
||||
}
|
||||
|
||||
func ErorrTokenAlreadyUsed() error {
|
||||
return wrap(ErrTokenAlreadyUsed, "verification token has already been used")
|
||||
}
|
||||
|
||||
func ErorrTokenExpired() error {
|
||||
return wrap(ErrTokenExpired, "verification token expired")
|
||||
}
|
||||
@@ -2,19 +2,12 @@ package verification
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/tech/sendico/pkg/model"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrTokenNotFound = errors.New("verification token not found")
|
||||
ErrTokenAlreadyUsed = errors.New("verification token already used")
|
||||
ErrTokenExpired = errors.New("verification token expired")
|
||||
)
|
||||
|
||||
type DB interface {
|
||||
// template.DB[*model.VerificationToken]
|
||||
Create(
|
||||
|
||||
Reference in New Issue
Block a user