outbox for gateways
This commit is contained in:
@@ -42,13 +42,13 @@ func New(logger mlogger.Logger, conn *db.MongoConnection) (*Store, error) {
|
||||
defer cancel()
|
||||
|
||||
if err := result.Ping(ctx); err != nil {
|
||||
result.logger.Error("mongo ping failed during store init", zap.Error(err))
|
||||
result.logger.Error("Mongo ping failed during store init", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
documentsStore, err := store.NewDocuments(result.logger, database)
|
||||
if err != nil {
|
||||
result.logger.Error("failed to initialise documents store", zap.Error(err))
|
||||
result.logger.Error("Failed to initialise documents store", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
result.documents = documentsStore
|
||||
|
||||
@@ -38,13 +38,13 @@ func NewDocuments(logger mlogger.Logger, db *mongo.Database) (*Documents, error)
|
||||
|
||||
for _, def := range indexes {
|
||||
if err := repo.CreateIndex(def); err != nil {
|
||||
logger.Error("failed to ensure documents index", zap.Error(err), zap.String("collection", repo.Collection()))
|
||||
logger.Error("Failed to ensure documents index", zap.Error(err), zap.String("collection", repo.Collection()))
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
childLogger := logger.Named("documents")
|
||||
childLogger.Debug("documents store initialised")
|
||||
childLogger.Debug("Documents store initialised")
|
||||
|
||||
return &Documents{
|
||||
logger: childLogger,
|
||||
@@ -68,7 +68,7 @@ func (d *Documents) Create(ctx context.Context, record *model.DocumentRecord) er
|
||||
}
|
||||
return err
|
||||
}
|
||||
d.logger.Debug("document record created", zap.String("payment_ref", record.PaymentRef))
|
||||
d.logger.Debug("Document record created", zap.String("payment_ref", record.PaymentRef))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ func (d *Documents) ListByPaymentRefs(ctx context.Context, paymentRefs []string)
|
||||
decoder := func(cur *mongo.Cursor) error {
|
||||
var rec model.DocumentRecord
|
||||
if err := cur.Decode(&rec); err != nil {
|
||||
d.logger.Warn("failed to decode document record", zap.Error(err))
|
||||
d.logger.Warn("Failed to decode document record", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
records = append(records, &rec)
|
||||
|
||||
Reference in New Issue
Block a user