Add Balance Api

This commit is contained in:
aditya.siregar
2024-07-30 23:51:53 +07:00
parent b6f75082e9
commit b8e034d8d8
10 changed files with 127 additions and 287 deletions
+4
View File
@@ -37,6 +37,10 @@ func (r *WalletRepository) Update(ctx context.Context, db *gorm.DB, wallet *enti
}
func (r *WalletRepository) GetByPartnerID(ctx context.Context, db *gorm.DB, partnerID int64) (*entity.Wallet, error) {
if db == nil {
db = r.db
}
wallet := new(entity.Wallet)
if err := db.WithContext(ctx).Where("partner_id = ?", partnerID).First(wallet).Error; err != nil {
logger.ContextLogger(ctx).Error("error when finding wallet by partner ID", zap.Error(err))