mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-13 04:13:24 +00:00
feat: implement optimistic locking for payment updates
- Add version field to Payment interface and collection schema - Implement atomic updates using updateMany with version checks - Add collection hook to auto-increment version for manual admin updates - Prevent race conditions in concurrent webhook processing - Index version field for performance Co-authored-by: Bas <bvdaakster@users.noreply.github.com>
This commit is contained in:
@@ -48,6 +48,10 @@ export interface Payment {
|
||||
| boolean
|
||||
| null;
|
||||
refunds?: (number | Refund)[] | null;
|
||||
/**
|
||||
* Version number for optimistic locking (auto-incremented on updates)
|
||||
*/
|
||||
version?: number;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user