add ServiceKey
This commit is contained in:
parent
5846da07fc
commit
11d85ac864
@ -491,6 +491,9 @@ components:
|
|||||||
amount:
|
amount:
|
||||||
type: integer
|
type: integer
|
||||||
description: Количество привилегии
|
description: Количество привилегии
|
||||||
|
serviceKey:
|
||||||
|
type: string
|
||||||
|
description: Тип сервиса
|
||||||
|
|
||||||
Discount:
|
Discount:
|
||||||
type: object
|
type: object
|
||||||
|
@ -17,6 +17,7 @@ type PromoCode struct {
|
|||||||
Privilege struct {
|
Privilege struct {
|
||||||
PrivilegeID string `json:"privilegeID" bson:"privilegeID"` // айдишник привилегии, которая будет выдаваться
|
PrivilegeID string `json:"privilegeID" bson:"privilegeID"` // айдишник привилегии, которая будет выдаваться
|
||||||
Amount uint64 `json:"amount" bson:"amount"` // количество
|
Amount uint64 `json:"amount" bson:"amount"` // количество
|
||||||
|
ServiceKey string `json:"serviceKey" bson:"serviceKey"` // тип сервиса
|
||||||
} `json:"privilege" bson:"privilege"`
|
} `json:"privilege" bson:"privilege"`
|
||||||
Discount struct {
|
Discount struct {
|
||||||
Layer uint32 `json:"layer" bson:"layer"` // 1|2
|
Layer uint32 `json:"layer" bson:"layer"` // 1|2
|
||||||
@ -47,6 +48,7 @@ type ReqEditPromoCode struct {
|
|||||||
Privilege *struct {
|
Privilege *struct {
|
||||||
PrivilegeID string `json:"privilegeID,omitempty" bson:"privilegeID"`
|
PrivilegeID string `json:"privilegeID,omitempty" bson:"privilegeID"`
|
||||||
Amount uint64 `json:"amount,omitempty" bson:"amount"`
|
Amount uint64 `json:"amount,omitempty" bson:"amount"`
|
||||||
|
ServiceKey string `json:"serviceKey,omitempty" bson:"serviceKey"` // тип сервиса
|
||||||
} `json:"privilege,omitempty" bson:"privilege"`
|
} `json:"privilege,omitempty" bson:"privilege"`
|
||||||
|
|
||||||
Discount *struct {
|
Discount *struct {
|
||||||
|
@ -110,6 +110,9 @@ func (r *PromoCodeRepository) EditPromoCode(ctx context.Context, req *models.Req
|
|||||||
if req.Bonus.Privilege.Amount != 0 {
|
if req.Bonus.Privilege.Amount != 0 {
|
||||||
updateFields["bonus.privilege.amount"] = req.Bonus.Privilege.Amount
|
updateFields["bonus.privilege.amount"] = req.Bonus.Privilege.Amount
|
||||||
}
|
}
|
||||||
|
if req.Bonus.Privilege.ServiceKey != "" {
|
||||||
|
updateFields["bonus.privilege.serviceKey"] = req.Bonus.Privilege.ServiceKey
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if req.Bonus.Discount != nil {
|
if req.Bonus.Discount != nil {
|
||||||
if req.Bonus.Discount.Layer != 0 {
|
if req.Bonus.Discount.Layer != 0 {
|
||||||
|
@ -142,6 +142,7 @@ func (s *PromoCodeService) ActivatePromo(ctx context.Context, req *models.Activa
|
|||||||
privilege := models.Privilege{
|
privilege := models.Privilege{
|
||||||
PrivilegeID: promoCode.Bonus.Privilege.PrivilegeID,
|
PrivilegeID: promoCode.Bonus.Privilege.PrivilegeID,
|
||||||
Amount: promoCode.Bonus.Privilege.Amount,
|
Amount: promoCode.Bonus.Privilege.Amount,
|
||||||
|
ServiceKey: promoCode.Bonus.Privilege.ServiceKey,
|
||||||
}
|
}
|
||||||
privileges = append(privileges, privilege)
|
privileges = append(privileges, privilege)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user