Files
quyun-v2/backend/database/.transform.yaml
Rogee 1da84f2af3 feat: add TenantLedger model and query generation
- Introduced TenantLedger model with fields for managing tenant transactions, including ID, TenantID, UserID, OrderID, transaction Type, Amount, and balance details.
- Implemented CRUD operations for TenantLedger with methods for Create, Update, Delete, and Reload.
- Generated query methods for TenantLedger to facilitate database interactions, including filtering, pagination, and aggregation functions.
- Established relationships with Order model for foreign key references.
2025-12-18 13:12:26 +08:00

91 lines
2.2 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
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
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
tenant_ledgers:
type: consts.TenantLedgerType
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