feat: Refactor order snapshot handling and introduce structured snapshot types

- Added new structured snapshot types for orders and order items to improve data integrity and clarity.
- Updated the Order and OrderItem models to use the new JSONType for snapshots.
- Refactored tests to accommodate the new snapshot structure, ensuring compatibility with legacy data.
- Enhanced the OrdersSnapshot struct to support multiple snapshot types and maintain backward compatibility.
- Introduced new fields for order items and orders to capture detailed snapshot information for auditing and historical display.
This commit is contained in:
2025-12-22 21:11:33 +08:00
parent 618fe116ba
commit 683965ae39
8 changed files with 239 additions and 171 deletions

View File

@@ -9,6 +9,7 @@ ignores:
imports:
- go.ipao.vip/gen
- quyun/v2/pkg/consts
- quyun/v2/database/fields
field_type:
users:
roles: types.Array[consts.Role]
@@ -37,6 +38,9 @@ field_type:
type: consts.OrderType
status: consts.OrderStatus
currency: consts.Currency
snapshot: types.JSONType[fields.OrdersSnapshot]
order_items:
snapshot: types.JSONType[fields.OrderItemsSnapshot]
tenant_ledgers:
type: consts.TenantLedgerType
tenant_invites: