[feature] add new mock client
This commit is contained in:
@@ -58,6 +58,7 @@ func (s *service) Create(ctx context.Context, req dto.CreateAssetRequest) (*dto.
|
||||
if err != nil {
|
||||
return nil, ErrAssetNotFound
|
||||
}
|
||||
|
||||
categoryID, err := uuid.Parse(req.AssetCategoryID)
|
||||
if err != nil {
|
||||
return nil, ErrCategoryNotFound
|
||||
@@ -80,7 +81,7 @@ func (s *service) Create(ctx context.Context, req dto.CreateAssetRequest) (*dto.
|
||||
Status: domainAsset.StatusPublished,
|
||||
}
|
||||
|
||||
if err := s.assetRepo.Create(ctx, asset); err != nil {
|
||||
if err = s.assetRepo.Create(ctx, asset); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package auth
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/rs/zerolog"
|
||||
"go.uber.org/fx"
|
||||
|
||||
15
internal/pkg/mail/client.go
Normal file
15
internal/pkg/mail/client.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package mail
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
"base/pkg/email"
|
||||
)
|
||||
|
||||
type client struct {
|
||||
logger zerolog.Logger
|
||||
}
|
||||
|
||||
func New(logger zerolog.Logger) email.Email {
|
||||
return &client{logger: logger}
|
||||
}
|
||||
16
internal/pkg/mail/mail.go
Normal file
16
internal/pkg/mail/mail.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package mail
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"base/pkg/email"
|
||||
)
|
||||
|
||||
func (c client) Send(ctx context.Context, params email.Request) (*email.Response, error) {
|
||||
return &email.Response{
|
||||
ID: uuid.NewString(),
|
||||
Status: "Success",
|
||||
}, nil
|
||||
}
|
||||
@@ -3,18 +3,18 @@ package pkg
|
||||
import (
|
||||
"go.uber.org/fx"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"base/internal/dto"
|
||||
"base/internal/pkg/azure/azbus"
|
||||
"base/internal/pkg/azure/communication"
|
||||
"base/internal/pkg/database"
|
||||
"base/internal/pkg/logger"
|
||||
"base/internal/pkg/mail"
|
||||
"base/internal/pkg/oauth"
|
||||
"base/pkg/cache"
|
||||
"base/pkg/metrics"
|
||||
"base/pkg/store"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func NewLandingCache(db *gorm.DB, lg zerolog.Logger, m *metrics.Metrics) cache.Cache[dto.Landing] {
|
||||
@@ -26,7 +26,7 @@ var Module = fx.Module(
|
||||
fx.Provide(
|
||||
logger.New,
|
||||
database.NewRWDatabaseConnection,
|
||||
communication.New,
|
||||
mail.New,
|
||||
oauth.New,
|
||||
azbus.New,
|
||||
fx.Annotate(store.NewPostgresStore[string], fx.ResultTags(`name:"verification_store"`)),
|
||||
|
||||
Reference in New Issue
Block a user