Files
quyun-v2/backend/database/.transform.yaml
Rogee 683965ae39 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.
2025-12-22 21:11:33 +08:00

100 lines
2.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
ignores:
- migrations
- river_client
- river_client_queue
- river_job
- river_leader
- river_migration
- river_queue
imports:
- go.ipao.vip/gen
- quyun/v2/pkg/consts
- quyun/v2/database/fields
field_type:
users:
roles: types.Array[consts.Role]
status: consts.UserStatus
tenants:
uuid: types.UUID
status: consts.TenantStatus
tenant_users:
role: types.Array[consts.TenantUserRole]
status: consts.UserStatus
media_assets:
type: consts.MediaAssetType
status: consts.MediaAssetStatus
variant: consts.MediaAssetVariant
contents:
status: consts.ContentStatus
visibility: consts.ContentVisibility
content_assets:
role: consts.ContentAssetRole
content_prices:
currency: consts.Currency
discount_type: consts.DiscountType
content_access:
status: consts.ContentAccessStatus
orders:
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:
status: consts.TenantInviteStatus
tenant_join_requests:
status: consts.TenantJoinRequestStatus
field_relate:
users:
OwnedTenant:
relation: belongs_to
table: tenants
json: owned
Tenants:
json: tenants
relation: many_to_many
table: tenants
pivot: tenant_users
# foreign_key: user_id # 当前表users用于关联的键转为结构体字段名 user_id
join_foreign_key: user_id # 中间表中指向当前表的列tenant_users.user_id
# references: id # 关联表tenants被引用的列转为结构体字段名 ID
join_references: tenant_id # 中间表中指向关联表的列tenant_users.tenant_id
tenants:
Users:
relation: many_to_many
table: users
pivot: tenant_users
json: users
join_foreign_key: tenant_id
join_references: user_id
orders:
Items:
relation: has_many
table: order_items
json: items
foreign_key: order_id
references: id
order_items:
Order:
relation: belongs_to
table: orders
json: order
foreign_key: order_id
references: id
Content:
relation: belongs_to
table: contents
json: content
foreign_key: content_id
references: id
tenant_ledgers:
Order:
relation: belongs_to
table: orders
json: order
foreign_key: order_id
references: id