Skip to content

Commit 98afe9c

Browse files
committed
Remove the sendgrid service for marketting emails
1 parent f52469e commit 98afe9c

6 files changed

Lines changed: 6 additions & 147 deletions

File tree

api/cmd/experiments/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ func main() {
2424
}
2525

2626
container := di.NewLiteContainer()
27-
container.Logger().Info("Starting experiments")
27+
logger := container.Logger()
28+
29+
logger.Info("Starting experiments")
2830
}
2931

3032
func text3CX() {

api/go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ require (
3434
github.com/redis/go-redis/extra/redisotel/v9 v9.0.5
3535
github.com/redis/go-redis/v9 v9.0.5
3636
github.com/rs/zerolog v1.30.0
37-
github.com/sendgrid/sendgrid-go v3.12.0+incompatible
3837
github.com/stretchr/testify v1.8.4
3938
github.com/swaggo/swag v1.16.1
4039
github.com/thedevsaddam/govalidator v1.9.10
@@ -117,7 +116,6 @@ require (
117116
github.com/richardlehane/msoleps v1.0.3 // indirect
118117
github.com/rivo/uniseg v0.4.4 // indirect
119118
github.com/russross/blackfriday/v2 v2.1.0 // indirect
120-
github.com/sendgrid/rest v2.6.9+incompatible // indirect
121119
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
122120
github.com/swaggo/files/v2 v2.0.0 // indirect
123121
github.com/valyala/bytebufferpool v1.0.0 // indirect

api/go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,6 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
318318
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3D/WJsDd1iXHT96alCoN2KJo6/4x1DZC3wZs8=
319319
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=
320320
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
321-
github.com/sendgrid/rest v2.6.9+incompatible h1:1EyIcsNdn9KIisLW50MKwmSRSK+ekueiEMJ7NEoxJo0=
322-
github.com/sendgrid/rest v2.6.9+incompatible/go.mod h1:kXX7q3jZtJXK5c5qK83bSGMdV6tsOE70KbHoqJls4lE=
323-
github.com/sendgrid/sendgrid-go v3.12.0+incompatible h1:/N2vx18Fg1KmQOh6zESc5FJB8pYwt5QFBDflYPh1KVg=
324-
github.com/sendgrid/sendgrid-go v3.12.0+incompatible/go.mod h1:QRQt+LX/NmgVEvmdRw0VT/QgUn499+iza2FnDca9fg8=
325321
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
326322
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo=
327323
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM=

api/pkg/di/container.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -820,18 +820,6 @@ func (container *Container) PhoneService() (service *services.PhoneService) {
820820
)
821821
}
822822

823-
// MarketingService creates a new instance of services.MarketingService
824-
func (container *Container) MarketingService() (service *services.MarketingService) {
825-
container.logger.Debug(fmt.Sprintf("creating %T", service))
826-
return services.NewMarketingService(
827-
container.Logger(),
828-
container.Tracer(),
829-
container.FirebaseAuthClient(),
830-
os.Getenv("SENDGRID_API_KEY"),
831-
os.Getenv("SENDGRID_LIST_ID"),
832-
)
833-
}
834-
835823
// UserService creates a new instance of services.UserService
836824
func (container *Container) UserService() (service *services.UserService) {
837825
container.logger.Debug(fmt.Sprintf("creating %T", service))
@@ -841,7 +829,6 @@ func (container *Container) UserService() (service *services.UserService) {
841829
container.UserRepository(),
842830
container.Mailer(),
843831
container.UserEmailFactory(),
844-
container.MarketingService(),
845832
container.LemonsqueezyClient(),
846833
)
847834
}

api/pkg/services/marketting_service.go

Lines changed: 0 additions & 121 deletions
This file was deleted.

api/pkg/services/user_service.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ type UserService struct {
2626
emailFactory emails.UserEmailFactory
2727
mailer emails.Mailer
2828
repository repositories.UserRepository
29-
marketingService *MarketingService
3029
lemonsqueezyClient *lemonsqueezy.Client
3130
}
3231

@@ -37,14 +36,12 @@ func NewUserService(
3736
repository repositories.UserRepository,
3837
mailer emails.Mailer,
3938
emailFactory emails.UserEmailFactory,
40-
marketingService *MarketingService,
4139
lemonsqueezyClient *lemonsqueezy.Client,
4240
) (s *UserService) {
4341
return &UserService{
4442
logger: logger.WithService(fmt.Sprintf("%T", s)),
4543
tracer: tracer,
4644
mailer: mailer,
47-
marketingService: marketingService,
4845
emailFactory: emailFactory,
4946
repository: repository,
5047
lemonsqueezyClient: lemonsqueezyClient,
@@ -53,7 +50,7 @@ func NewUserService(
5350

5451
// Get fetches or creates an entities.User
5552
func (service *UserService) Get(ctx context.Context, authUser entities.AuthUser) (*entities.User, error) {
56-
ctx, span := service.tracer.Start(ctx)
53+
ctx, span, ctxLogger := service.tracer.StartWithLogger(ctx, service.logger)
5754
defer span.End()
5855

5956
user, isNew, err := service.repository.LoadOrStore(ctx, authUser)
@@ -63,7 +60,7 @@ func (service *UserService) Get(ctx context.Context, authUser entities.AuthUser)
6360
}
6461

6562
if isNew {
66-
service.marketingService.AddToList(ctx, user)
63+
ctxLogger.Info(fmt.Sprintf("created a new user with ID [%s]", user.ID))
6764
}
6865

6966
return user, nil
@@ -89,7 +86,7 @@ func (service *UserService) Update(ctx context.Context, authUser entities.AuthUs
8986
}
9087

9188
if isNew {
92-
service.marketingService.AddToList(ctx, user)
89+
ctxLogger.Info(fmt.Sprintf("created a new user with ID [%s]", user.ID))
9390
}
9491

9592
user.Timezone = params.Timezone.String()

0 commit comments

Comments
 (0)