feat: add coupon support to orders and create user_coupons model

- Added CouponID field to Order model to track used coupons.
- Updated order query generation to include CouponID.
- Introduced UserCoupon model to manage user coupon associations.
- Implemented query methods for UserCoupon to facilitate CRUD operations.
- Updated query context and default query setup to include UserCoupon.
This commit is contained in:
2025-12-30 17:28:21 +08:00
parent 69d750800c
commit dbfb08ed37
14 changed files with 1454 additions and 35 deletions

View File

@@ -38,6 +38,13 @@ func Provide(opts ...opt.Option) error {
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*coupon, error) {
obj := &coupon{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*creator, error) {
obj := &creator{}
@@ -67,12 +74,11 @@ func Provide(opts ...opt.Option) error {
audit *audit,
common *common,
content *content,
coupon *coupon,
creator *creator,
db *gorm.DB,
job *job.Job,
notification *notification,
order *order,
storage *storage.Storage,
super *super,
tenant *tenant,
user *user,
@@ -82,12 +88,11 @@ func Provide(opts ...opt.Option) error {
audit: audit,
common: common,
content: content,
coupon: coupon,
creator: creator,
db: db,
job: job,
notification: notification,
order: order,
storage: storage,
super: super,
tenant: tenant,
user: user,