- 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.
59 lines
1010 B
Go
59 lines
1010 B
Go
package services
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
var _db *gorm.DB
|
|
|
|
// exported CamelCase Services
|
|
var (
|
|
Audit *audit
|
|
Common *common
|
|
Content *content
|
|
Coupon *coupon
|
|
Creator *creator
|
|
Notification *notification
|
|
Order *order
|
|
Super *super
|
|
Tenant *tenant
|
|
User *user
|
|
Wallet *wallet
|
|
)
|
|
|
|
// @provider(model)
|
|
type services struct {
|
|
db *gorm.DB
|
|
// define Services
|
|
audit *audit
|
|
common *common
|
|
content *content
|
|
coupon *coupon
|
|
creator *creator
|
|
notification *notification
|
|
order *order
|
|
super *super
|
|
tenant *tenant
|
|
user *user
|
|
wallet *wallet
|
|
}
|
|
|
|
func (svc *services) Prepare() error {
|
|
_db = svc.db
|
|
|
|
// set exported Services here
|
|
Audit = svc.audit
|
|
Common = svc.common
|
|
Content = svc.content
|
|
Coupon = svc.coupon
|
|
Creator = svc.creator
|
|
Notification = svc.notification
|
|
Order = svc.order
|
|
Super = svc.super
|
|
Tenant = svc.tenant
|
|
User = svc.user
|
|
Wallet = svc.wallet
|
|
|
|
return nil
|
|
}
|