extended logging

This commit is contained in:
Stephan D
2026-02-10 11:24:45 +01:00
parent 3578ddd54f
commit f59789ab7a

View File

@@ -10,6 +10,7 @@ import (
ri "github.com/tech/sendico/pkg/db/repository/index"
"github.com/tech/sendico/pkg/merrors"
"github.com/tech/sendico/pkg/mlogger"
"github.com/tech/sendico/pkg/mutil/mzap"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.uber.org/zap"
@@ -85,10 +86,19 @@ func (p *Payouts) Upsert(ctx context.Context, record *model.CardPayout) error {
}
if record.ID == bson.NilObjectID {
return p.repository.Insert(ctx, record, nil)
if err := p.repository.Insert(ctx, record, nil); err != nil {
p.logger.Warn("Failed to insert new record", zap.Error(err), zap.String("operation_Ref", record.OperationRef))
return err
}
return nil
}
return p.repository.Update(ctx, record)
if err := p.repository.Update(ctx, record); err != nil {
p.logger.Warn("Failed to update existing record", zap.Error(err),
zap.String("operation_Ref", record.OperationRef), mzap.ObjRef("payout_ref", record.ID))
return err
}
return nil
}
var _ storage.PayoutsStore = (*Payouts)(nil)