Subversion Repositories SmartDukaan

Rev

Show changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
36391 11 h 33 m aman /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/ Feat:LocalDateTime fix for insurance  
36390 11 h 44 m aman /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/ Feat:LocalDateTime fix for insurance  
36389 11 h 59 m aman /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/ Feat:LocalDateTime fix for insurance  
36388 12 h 2 m aman /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/ Feat:LocalDateTime fix for insurance  
36387 12 h 49 m ranu /trunk/ code commit for reports section v2  
36386 12 h 58 m amit /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/ Revert r36385: drop DataIntegrityViolationException handler from profitmandi-web V1 and V2 global exception handlers. Default DB-error translation is kept only in the FOFO module for now.  
36385 13 h 15 m amit /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/ Add DataIntegrityViolationException handler to V1 GlobalExceptionHandler and V2GlobalExceptionHandler. Translates MySQL truncation / duplicate / FK errors into HTTP 400 with a friendly message via the new DbErrorTranslator (V1 uses ResponseSender; V2 uses ApiResponse + ErrorDetail).  
36384 13 h 15 m amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/ GlobalExceptionHandler: handle DataIntegrityViolationException via DbErrorTranslator so MySQL truncation / duplicate / FK errors surface as HTTP 400 with a friendly ProfitMandiBusinessException payload (rendered by common.js badRequestAlert).  
36383 13 h 15 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/exception/ Add DbErrorTranslator: translates Spring DataIntegrityViolationException (truncation / duplicate key / FK violation) into ProfitMandiBusinessException with prettified field label.  
36382 13 h 15 m amit /trunk/profitmandi-common/src/main/resources/ Add DB_TRUNCATION / DB_DUPLICATE / DB_FK_VIOLATION / DB_CONSTRAINT response codes for the new DataIntegrityViolationException auto-translator.  
36381 13 h 22 m vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/controller/fofo/ Dashboard API  
36380 13 h 44 m vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/response/ Dashboard API  
36379 13 h 45 m vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/response/ Dashboard API  
36378 13 h 56 m ranu /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/v2/ code commit for reports section v2  
36377 14 h 8 m vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/ Dashboard API  
36376 14 h 36 m aman /trunk/ Feat:Cart Api Implementation  
36375 15 h 44 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/transaction/ Added Rising Star/NEW  
36374 15 h 57 m ranu /trunk/ schemes and offer for v2 version  
36373 18 h 20 m ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/controller/monitors/ login talktime hours cap on 100%  
36372 18 h 35 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Wallet: SELECT FOR UPDATE on user_wallet mutations to close lost-update hole

addAmountToWallet/consumeAmountFromWallet(x2)/rollbackAmountFromWallet all
follow a read-modify-write pattern on user_wallet with no pessimistic lock
and no @Version, so two concurrent tx for the same partner both read the
same pre-snapshot amount, compute their own deltas, and commit - the second
UPDATE silently overwrites the first's credit/debit. user_wallet_history
still gets both rows, so balance drifts vs sum(history) with no exception.

Replaces the misnamed (and body-broken) selectByIdForUpdate - whose
implementation was a plain selectById, not a lock - with a new
selectByRetailerIdForUpdate that issues SELECT ... FOR UPDATE via
LockModeType.PESSIMISTIC_WRITE, mirroring the idiom already used in
GenericRepositoryImpl.selectByIdForUpdate and OrderRepositoryImpl.
Preserves the create-on-missing behavior of selectByRetailerId so
first-time partners keep working.

Switches the four read-modify-write call sites in WalletServiceImpl from
selectByRetailerId to the new locking variant. Read-only callers
(getUserWalletByUserId, getUserWalletHistoryByUserId, etc.) keep using
the non-locking selectByRetailerId - MVCC snapshot reads stay non-blocking
for display/statement endpoints.

Also drops the stale commented-out selectByIdForUpdate line in
rollbackAmountFromWallet and removes the broken method from the
UserWalletRepository interface / impl - it had zero live callers.

Blast radius: every write call to these three wallet methods now holds
an X-lock on the target user_wallet row for the rest of the outer tx.
Concurrent write tx for the same partner will briefly serialize at the
SELECT FOR UPDATE - correct serialization instead of silent drift.
Read-only traffic is unaffected (MVCC).
 

Show All