Skip to content

Commit 2efc32c

Browse files
committed
refactor dto in warehouse server
1 parent 6eb7f43 commit 2efc32c

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

warehouse-server/service/dto.go renamed to warehouse-server/dto/payment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package service
1+
package dto
22

33
import "go.mongodb.org/mongo-driver/bson/primitive"
44

warehouse-server/service/dlqMonitor.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import (
55
"log"
66
"time"
77

8+
localDTO "github.com/mtanzim/event-driven-bookstore/warehouse-server/dto"
89
"go.mongodb.org/mongo-driver/bson"
10+
911
"go.mongodb.org/mongo-driver/mongo"
1012
"go.mongodb.org/mongo-driver/mongo/options"
1113
)
@@ -35,7 +37,7 @@ func (s DLQMonitorService) Monitor() {
3537
log.Println(err)
3638
}
3739
for cur.Next(ctx) {
38-
var item CartPaymentDLQItem
40+
var item localDTO.CartPaymentDLQItem
3941
curErr := cur.Decode(&item)
4042
log.Println("In payment DLQ", item)
4143
if curErr == nil {

warehouse-server/service/payment.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"time"
88

99
dto "github.com/mtanzim/event-driven-bookstore/common-server/dto"
10+
localDTO "github.com/mtanzim/event-driven-bookstore/warehouse-server/dto"
1011
"go.mongodb.org/mongo-driver/bson"
1112
"go.mongodb.org/mongo-driver/mongo"
1213
"gopkg.in/confluentinc/confluent-kafka-go.v1/kafka"
@@ -51,7 +52,7 @@ func (s PaymentStatusService) persist(paymentStatus dto.CartPaymentResponse) {
5152
if err != nil || updateRes.ModifiedCount != 1 {
5253
log.Println("Failed to update shipment payment status for cart id:", paymentStatus.CartID)
5354
log.Println("Inserting approved payment into DLQ")
54-
failedCartItem := CartPaymentDLQItem{CartID: paymentStatus.CartID}
55+
failedCartItem := localDTO.CartPaymentDLQItem{CartID: paymentStatus.CartID}
5556
s.paymentDLQCollection.InsertOne(ctx, failedCartItem)
5657
} else {
5758
log.Println("Shipment", paymentStatus.CartID, "was paid for!")

0 commit comments

Comments
 (0)